the case is: pow(1.01, int.min); because int.min == -int.min Maybe the while loop should be put into pow(F, uint) instead of pow(F, int) like the following: pure nothrow F pow(F)(F x, int n) { if (n < 0) { return 1 / pow(x, cast(uint)(-n)); } return pow(x, cast(uint)n); }
(In reply to comment #0) > Maybe the while loop should be put into pow(F, uint) instead of pow(F, int) > like the following: what about: pure nothrow F pow(F)(F x, int n) if (isFloatingPoint!(F)) { if (n < 0) return 1 / pow(x, cast(uint)(-n)); else return pow(x, cast(uint)n); } pure nothrow F pow(F)(F x, uint n) // allow integer if n is uint { ... } This also solve #2973
http://www.dsource.org/projects/phobos/changeset/1677
Fixed DMD 2.048