https://issues.dlang.org/show_bug.cgi?id=7996
RazvanN <razvan.nitu1...@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |razvan.nitu1...@gmail.com --- Comment #1 from RazvanN <razvan.nitu1...@gmail.com> --- (In reply to bearophile_hugs from comment #0) > std.math.sqrt() refuses an argument of type long (despite this is handy): > > import std.math; > void main() { > long x; > sqrt(x); > } > > > > With (dmd 2.060alpha): > > test.d(4): Error: function std.math.sqrt called with argument types: > ((long)) > matches both: > std.math.sqrt(float x) > and: > std.math.sqrt(real x) > > > > While this compiles with no errors: > > import std.math; > void main() { > long x; > assert(!isnan(x)); > } > > > Maybe isnan() has to statically refuse arguments that aren't built-in > floating point (maybe with a std.traits.isFloatingPoint template > constraint), this avoids some bugs (I have had a bug caused by this). Actually, the function isnan is deprecated. Instead, the function isNaN has the constraint isFloatingPoint [1]. Maybe this should be closed? [1] https://dlang.org/phobos/std_math#.isNaN --