Bug 22878 – importC: glibc fallback for HUGE_VAL gives 'not representable'

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-03-11T19:13:00Z
Last change time
2022-03-14T20:17:18Z
Keywords
ImportC, pull
Assigned to
No Owner
Creator
duser

Comments

Comment #0 by duser — 2022-03-11T19:13:00Z
// Error: number `1e10000` is not representable double n = 1e10000; glibc's math.h defines HUGE_VAL as 1e10000 for old or non-gnu compilers that can't use the builtin: --- /* Value returned on overflow. With IEEE 754 floating point, this is +Infinity, otherwise the largest representable positive value. * #if __GNUC_PREREQ (3, 3) # define HUGE_VAL (__builtin_huge_val ()) #else /* This may provoke compiler warnings, and may not be rounded to +Infinity in all IEEE 754 rounding modes, but is the best that can be done in ISO C while remaining a constant expression. 10,000 is greater than the maximum (decimal) exponent for all supported floating-point formats and widths. * # define HUGE_VAL 1e10000 #endif --- if using gcc to preprocess, you can get the fallback by undefining the gnu version macros: -U__GNUC__ -U__GNUC_MINOR__ -U__GNUC_PATCHLEVEL__
Comment #1 by dlang-bot — 2022-03-14T08:54:06Z
@WalterBright created dlang/dmd pull request #13818 "fix Issue 22878 - importC: glibc fallback for HUGE_VAL gives 'not rep…" fixing this issue: - fix Issue 22878 - importC: glibc fallback for HUGE_VAL gives 'not representable' https://github.com/dlang/dmd/pull/13818
Comment #2 by dlang-bot — 2022-03-14T20:17:18Z
dlang/dmd pull request #13818 "fix Issue 22878 - importC: glibc fallback for HUGE_VAL gives 'not rep…" was merged into master: - f58f26f4cb014cb7fae4791503e06cb47c233995 by Walter Bright: fix Issue 22878 - importC: glibc fallback for HUGE_VAL gives 'not representable' https://github.com/dlang/dmd/pull/13818