DMD 2.105.2:
---
void main(){
import std.stdio;
assert(42*6==252);
assert(cast(int)(4.2*60)==251); // passes on linux, fails on windows
double x=4.2;
assert(cast(int)(x*60)==252); // passes on both
}
---
Constant folding/CTFE of floating-point code differs between compile time and runtime, and it differs even between platforms.
Comment #1 by robert.schadek — 2024-12-13T19:31:06Z