March 11, 2022 [Issue 22878] New: importC: glibc fallback for HUGE_VAL gives "not representable" | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22878 Issue ID: 22878 Summary: importC: glibc fallback for HUGE_VAL gives "not representable" Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: duser@neet.fi // 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__ -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply