[Issue 7996] Refuse std.math.isnan() on not floating point values?

2016-12-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=7996

Andrei Alexandrescu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--


[Issue 7996] Refuse std.math.isnan() on not floating point values?

2016-11-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=7996

RazvanN  changed:

   What|Removed |Added

 CC||razvan.nitu1...@gmail.com

--- Comment #1 from RazvanN  ---
(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

--


[Issue 7996] Refuse std.math.isnan() on not floating point values?

2016-10-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=7996

Andrei Alexandrescu  changed:

   What|Removed |Added

   Keywords||bootcamp
 CC||and...@erdani.com

--