On Sunday, 6 January 2019 at 01:05:08 UTC, Adam D. Ruppe wrote:
That's because it is done at compile time, since both are
compile-time constants. The compiler will evaluate it using the
maximum precision available to the compiler, ignoring your
request to cast it to double (which annoys some pe
On Sunday, 6 January 2019 at 00:20:40 UTC, Samir wrote:
[1] https://news.ycombinator.com/item?id=18832155
[2] https://en.wikipedia.org/wiki/IEEE_754
Since you got your answer you may also like
http://dconf.org/2016/talks/clugston.html
On Sunday, 6 January 2019 at 00:20:40 UTC, Samir wrote:
import std.stdio: writeln;
void main(){
writeln(cast(double).0-9998.0);
}
That's because it is done at compile time, since both are
compile-time constants. The compiler will evaluate it using the
ma
I saw the following thread[1] today on Hacker News that discusses
an article that compares how various languages compute
.0 - 9998.0. A surprisingly large
number of languages return 2 as the answer. I ran the following
which returned 1:
import std.stdio: writeln