Does D optimize sqrt(2.0)?
crimaniak via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Feb 11 00:10:36 PST 2016
On Thursday, 11 February 2016 at 07:41:55 UTC, Enjoys Math wrote:
> If I just type out sqrt(2.0) in D, is that automatically made
> into a constant for me?
>
> Thanks.
for DMD -O :
import std.math;
immutable foo = sqrt(2.0);
pure float precalculated()
{
return foo;
}
pure float not_precalculated()
{
return sqrt(2.0);
}
More information about the Digitalmars-d-learn
mailing list