Thread overview | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
June 18, 2020 [Issue 20951] Wrong Decimal Literals Encoding | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20951 Илья Ярошенко <ilyayaroshenko@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code -- |
June 18, 2020 [Issue 20951] Wrong Decimal Literals Encoding | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20951 kinke <kinke@gmx.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kinke@gmx.net --- Comment #1 from kinke <kinke@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. -- |
June 18, 2020 [Issue 20951] Wrong Decimal Literals Encoding | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20951 --- Comment #2 from kinke <kinke@gmx.net> --- Oh, I forgot the reason for the broader overview - both assertions of the testcase are CTFE-optimized to `assert(false)` (see -vcg-ast). -- |
June 19, 2020 [Issue 20951] Wrong Decimal Literals Encoding | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20951 --- Comment #3 from Илья Ярошенко <ilyayaroshenko@gmail.com> --- In C: ``` static double d = 2075e23; ``` is encoded as ``` .LCPI0_0: .quad 5000531031573652307 # double 2.0749999999999998E+26 ``` and ``` static double d = 2075e23L; // with L at the end ``` is encoded as ``` .LCPI0_0: .quad 5000531031573652308 # double 2.0750000000000002E+26 ``` as expected. In D we always have the last case which makes D a non-IEEE language, as well as non-C compatible. `toPrec` can't solve this issue. -- |
July 07, 2020 [Issue 20951] Wrong Decimal Literals Encoding | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20951 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> --- @kinke created dlang/dmd pull request #11387 "Fix Issue 20951 - Don't use excess precision when parsing single- and double-precision literals" fixing this issue: - Fix Issue 20951 - Don't use excess precision when parsing single- and double-precision literals https://github.com/dlang/dmd/pull/11387 -- |
July 10, 2020 [Issue 20951] Wrong Decimal Literals Encoding | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20951 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ibuclaw@gdcproject.org --- Comment #5 from Iain Buclaw <ibuclaw@gdcproject.org> --- (In reply to kinke from comment #1) > 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. toPrec was added precisely because CTFE does everything at the highest supported precision, even if you are only working with floats. -- |
July 10, 2020 [Issue 20951] Wrong Decimal Literals Encoding | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20951 --- Comment #6 from Iain Buclaw <ibuclaw@gdcproject.org> --- (In reply to Илья Ярошенко from comment #3) > In D we always have the last case which makes D a non-IEEE language, as well as non-C compatible. `toPrec` can't solve this issue. I don't think we pretend to be a C-compatible language when it comes to floating point, so you can't use that argument. The same goes for IEEE during CTFE as well. This has been discussed relentlessly since at least 2012, the status-quo is not expected to change. -- |
August 09, 2020 [Issue 20951] Wrong Decimal Literals Encoding | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20951 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@digitalmars.com See Also| |https://issues.dlang.org/sh | |ow_bug.cgi?id=20972 -- |
August 09, 2020 [Issue 20951] Wrong Decimal Literals Encoding | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20951 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://issues.dlang.org/sh | |ow_bug.cgi?id=5229 -- |
December 17, 2022 [Issue 20951] Wrong Decimal Literals Encoding | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20951 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P2 -- |
Copyright © 1999-2021 by the D Language Foundation