This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: complex number


On 2009-04-01 14:48Z, Marco Atzeri wrote:
>
> I was trying to understand why this code
> 
> #include <iostream>
> #include <complex>
> 
> int main()
> {
>   double a = 0;
>   double b = 1. / a;
>   a += 1;
>   std::cout << std::abs (std::complex<double> (b, a)) << '\n';
>  }
> 
> produce Inf on most platform and NaN on cygwin.

As I read C++2003 26.2/3, this use of std::abs has undefined
behavior, so NaN would be conforming even though Inf would
be less surprising.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]