--- Mer 1/4/09, Greg Chicares ha scritto:
> Da: Greg Chicares
> Oggetto: Re: complex number
> A: cygwin@cygwin.com
> Data: Mercoledì 1 Aprile 2009, 17:32
> 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.
>
>
you could be right but, I expect that gcc-4.3.2 work
in similar way in linux and cygwin, so a call to cabs.
In newlib cabs is wrapper for hypot and
hypot (0, Inf) gives Inf
Regards
Marco
--
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/