digitalmars.D.bugs - [Bug 21] New: unexpected results for: double -> real with value 1.7976931348623157e+308
- d-bugmail puremagic.com (51/51) Mar 06 2006 http://d.puremagic.com/bugzilla/show_bug.cgi?id=21
- d-bugmail puremagic.com (13/13) Mar 06 2006 http://d.puremagic.com/bugzilla/show_bug.cgi?id=21
http://d.puremagic.com/bugzilla/show_bug.cgi?id=21
Summary: unexpected results for: double -> real with value
1.7976931348623157e+308
Product: D
Version: 0.148
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P3
Component: DMD
AssignedTo: walter digitalmars.com
ReportedBy: thomas-dloop kuehne.cn
Porting from C to D.
== test.c ==
== test.d ==
test results:
==C code (64 bit mode)==
[PASS]
double: 0xFFFFFFFFFFFFEF7F
long double: 0x00F8FFFFFFFFFFFFFE43400000000000
==C code (32 bit mode)==
[PASS]
double: 0xFFFFFFFFFFFFEF7F
long double: 0x00F8FFFFFFFFFFFFFE43FFFF
==D code (32 bit mode)==
[FAIL]
double: 0xFFFFFFFFFFFFEF7F
real: 0x00F8FFFFFFFFFFFFFE430000
test cases:
http://dstress.kuehne.cn/run/d/double_28_A.d
http://dstress.kuehne.cn/run/d/double_28_B.d
--
Mar 06 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=21
walter digitalmars.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
This is not a bug. D always tries to do any compile time evaluation of floating
point constants at max precision. So, you can get different results by
assigning the same literal to a double than if it is assigned to a real. The
assignment to double rounds the literal to double precision, the assignment to
real rounds it to real precision.
--
Mar 06 2006








d-bugmail puremagic.com