Mail Archives: djgpp/1999/03/04/07:46:16
Eli Zaretskii wrote:
>
> On Wed, 3 Mar 1999, Martin Ambuhl wrote:
>
> > polar to_polar(vector v)
> > {
> > polar p;
> > p.r = sqrt(sqr(v.x) + sqr(v.y));
>
> It's much better to use library function `hypot' to do this. (Hint:
> try the above with v.x = v.y = 1.e160 or v.x = v.y = 1.e-160.)
But you we note that nothing in my post was non-standard C, while
hypot() is. This is not the only improvement available if the
non-standard functions in djgpp's libm.a are used, btw. Also note that
my post was an answer to a beginner's math question.
Also, note that the representation of the plane as
__complex__ double
would have been cleaner, but even 'more' non-standard C.
--
Martin Ambuhl (mambuhl AT earthlink DOT net)
Note: mambuhl AT tiac DOT net will soon be inactive
- Raw text -