Bug creation and email sending has been disabled, file new bugs at gcc.gnu.org/bugzilla
Bug 159 - Correctly handle excess FPU precision
Summary: Correctly handle excess FPU precision
Status: RESOLVED DUPLICATE of bug 200
Alias: None
Product: GDC
Classification: Unclassified
Component: gdc (show other bugs)
Version: development
Hardware: All All
: --- normal
Assignee: Iain Buclaw
URL:
Depends on:
Blocks:
 
Reported: 2014-09-18 09:29 CEST by Iain Buclaw
Modified: 2016-09-17 08:24 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Iain Buclaw 2014-09-18 09:29:20 CEST
Taken from:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=323

---
import std.stdio;

void test(double x, double y)
{
  double y2 = x + 1.0;
  if (y != y2)
    writeln("error");
}

void main()
{
  immutable double x = .012;  // Remove 'immutable', and 'error' is not printed.
  double y = x + 1.0;

  test(x, y);
}
---


This is a GCC bug with a front-end fix.  It may be a good idea to conform to this behaviour in D (GDC) too.  If not at least because the reference compiler doesn't appear to optimise aggressively enough to get this problem.
Comment 1 Iain Buclaw 2014-09-18 09:30:06 CEST
This is the original GCC C front-end patch, for reference.

https://gcc.gnu.org/ml/gcc-patches/2008-11/msg00105.html
Comment 2 Iain Buclaw 2016-09-17 08:24:59 CEST

*** This bug has been marked as a duplicate of bug 200 ***