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

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4198 - [FreeBSD] imprecision in decimal floating-point literals
Summary: [FreeBSD] imprecision in decimal floating-point literals
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 FreeBSD
: P2 normal
Assignee: No Owner
URL:
Keywords: patch, rejects-valid
Depends on:
Blocks:
Reported: 2010年05月16日 04:42 UTC by Shin Fujishiro
Modified: 2015年06月09日 05:15 UTC (History)
1 user (show)

See Also:


Attachments
Patch for DMD (svn r490) (2.88 KB, patch)
2010年05月16日 04:42 UTC, Shin Fujishiro
Details | Diff
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Shin Fujishiro 2010年05月16日 04:42:15 UTC
Created attachment 632 [details] 
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 Walter Bright 2010年08月04日 13:17:51 UTC
http://www.dsource.org/projects/dmd/changeset/597 


AltStyle によって変換されたページ (->オリジナル) /