Bug 13469 – x^^y wrong result

Status
RESOLVED
Resolution
INVALID
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2014-09-13T19:24:45Z
Last change time
2017-12-12T22:45:40Z
Keywords
wrong-code
Assigned to
No Owner
Creator
Илья Ярошенко

Comments

Comment #0 by ilyayaroshenko — 2014-09-13T19:24:45Z
import std.math; static assert(1.7^^1000 == 1.7.pow(1000));//OK void main() { assert(1.7^^1000 == 1.7.pow(1000)); //Assertion failure } //std.math.pow is correct! x^^y - wrong
Comment #1 by clugdbug — 2014-09-18T12:53:21Z
Are you sure this isn't just the difference in precision between double and real? The compile time values are done at 80 bit precision. The runtime pow() is done with 64 bit floats.
Comment #2 by ilyayaroshenko — 2014-09-18T13:02:45Z
You are right! Any way CTFE^^ and Runtime^^ should be identical between each other and std.math pow. import std.math; static assert(1.7^^1000 == double(1.7).pow(1000));//OK void main() { assert(1.7^^1000 == real(1.7).pow(1000));//OK (but should fails!) }
Comment #3 by ibuclaw — 2017-12-12T22:45:40Z
CTFE folds floating point expressions at the highest precision supported by target. This is not going to change.