C++ Logo

std-discussion

Advanced search

Question regarding [c.math¶11]

From: Matthew Woehlke <mwoehlke.floss_at_[hidden]>
Date: Tue, 2 Nov 2021 15:50:30 -0400
In C++11, [c.math¶11] says:

> if any argument corresponding to a double parameter has type double or an integer type, then all arguments corresponding to double parameters are effectively cast to double.

(The latest draft appears to contain equivalent wording.)

About `isnan` in particular, cppreference¹ says:

> bool isnan( IntegralType arg ); (since C++11)

...which appears to be a result of the above quoted paragraph.

Accordingly, is this snippet expected to compile?

   long long x = ...;
   std::isnan(x);

At least MSVC rejects it². Is my understanding wrong, or is MSVC
non-conforming?

https://en.cppreference.com/w/cpp/numeric/math/isnan)
https://godbolt.org/z/b3E5b5bzE)

-- 
Matthew

Received on 2021-11-02 14:50:36