Bug 10187 – Precision of floating-point returned values
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2013-05-27T23:54:00Z
Last change time
2013-05-28T00:05:10Z
Assigned to
nobody
Creator
dlang-bugzilla
Comments
Comment #0 by dlang-bugzilla — 2013-05-27T23:54:51Z
real n = 6287.4;
float f() { return n; }
void main()
{
assert(f() == f());
}
The assert fails, presumably because one value is on the stack, and another is in an FPU register.
Stumbled upon it while attempting:
allData.sort!((a, b) => a["!Price"].to!float() < b["!Price"].to!float())();
std.algorithm throws, because "Predicate for isSorted is not antisymmetric".
Comment #1 by maxim — 2013-05-28T00:02:05Z
This is a dup of issue 8745.
You can use is operator for identity check.
Comment #2 by dlang-bugzilla — 2013-05-28T00:05:10Z
Thanks!
*** This issue has been marked as a duplicate of issue 8476 ***