[Issue 20951] Wrong Decimal Literals Encoding
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jun 18 21:51:17 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20951
kinke <kinke at gmx.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kinke at gmx.net
--- Comment #1 from kinke <kinke at gmx.net> ---
Some context:
At compile-time, i.e., inside the frontend, floating-point literals and CTFE
values of *any precision* are represented using a type called real_t (see
dmd.root.ctfloat), which is the host's `real` most of the time, except for gdc,
which uses a host-independent high-precision software implementation AFAIK (so
consistent behavior for cross-compilation too). So all literals are parsed as
real_t (although there are precision-dependent over-/underflow checks), and
CTFE calculations incl. some transcendental math functions are performed using
the compiler's real_t type, regardless of whether the compile-time value is
typed as a float, double or real.
Iain has recently added a core.math.toPrec() function, I don't know if he had
CTFE in mind for this and whether he changed something in the compiler as well.
--
More information about the Digitalmars-d-bugs
mailing list