Re: Does D optimize sqrt(2.0)?

2016-02-11 Thread Johannes Pfau via Digitalmars-d-learn
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 GDC the answer is yes: http://explore.dgnu.org/#%7B%22version%22%3A3%2C%22filterAsm%22%3A%7B%22labels%22%3Atrue%2C%22directives%2

Re: Does D optimize sqrt(2.0)?

2016-02-11 Thread crimaniak via Digitalmars-d-learn
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_precalcula

Does D optimize sqrt(2.0)?

2016-02-10 Thread Enjoys Math via Digitalmars-d-learn
If I just type out sqrt(2.0) in D, is that automatically made into a constant for me? Thanks.