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/