Fwd: complex number

Mark J. Reed markjreed@gmail.com
Wed Apr 1 18:48:00 GMT 2009


On Wed, Apr 1, 2009 at 1:30 PM, Corinna Vinschen wrote:
>
> > > That's the result of the newlib function which is defined
> > > as
> > >
> > >   double
> > >   cabs(z)
> > >   struct complex z;
> > >   {
> > >     return hypot(z.x, z.y);
> > >   }
> > >

That's from the newlib source code, I assume? While the function
cabs() exists inside newlib, and is declared as an extern in math.h,
it's not documented, nor is there a prototype for it or a declaration
of "struct complex" that I can find anywhere in the installed headers
(just the "complex" typedef in the gcc headers, whose structure
doesn't match the above).  l Yet somehow the compiler is doing some
sort of typechecking anyway and rejecting everything I try to pass as
a parameter, so I can't validate the return value of cabs.

Did you determine that the C++ std::complex::abs() method winds up
calling cabs() eventually, or was that a guess?  It's strange, because
calling hypot(a, b) directly yields the correct result.

--
Mark J. Reed <markjreed@gmail.com>

--
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/



More information about the Cygwin mailing list