Summary: Refuse std.math.isnan() on not floating point values?
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: enhancement
          Priority: P2
         Component: Phobos

--- Comment #0 from 2012-04-27 04:52:46 PDT ---
std.math.sqrt() refuses an argument of type long (despite this is handy):

import std.math;
void main() {
    long x;

With (dmd 2.060alpha):

test.d(4): Error: function std.math.sqrt called with argument types:
matches both:
    std.math.sqrt(float x)
    std.math.sqrt(real x)

While this compiles with no errors:

import std.math;
void main() {
    long 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).

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to