Bug 4198 – [FreeBSD] imprecision in decimal floating-point literals

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
FreeBSD
Creation time
2010-05-16T04:42:00Z
Last change time
2015-06-09T05:15:13Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
rsinfu

Attachments

IDFilenameSummaryContent-TypeSize
632freebsd-decimal-reals.patchPatch for DMD (svn r490)text/plain2945

Comments

Comment #0 by rsinfu — 2010-05-16T04:42:15Z
Created attachment 632 Patch for DMD (svn r490) This assertion fails with DMD built on FreeBSD 8: -------------------- static assert(1.0L == 0x1.0p+0L); // Error: static assert (0x1.00000000000004p+0L == 1L) is false -------------------- The left decimal floating-point literal is slightly wrong. The compiler uses some tables (negtab and postab) for converting decimal strings to long double values, but GCC on FreeBSD/i386 slightly changes them by rounding everything in the table to double precision. This causes precision loss of decimal floating-point literals. The attached patch fixes the problem, by adding byte sequence version of the numeric tables to backend/strtold.c so that the tables' contents will not be rounded by GCC.
Comment #1 by bugzilla — 2010-08-04T13:17:51Z