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]

newlib: pow function can produce incorrect results.


I'm not certain if this is a newlib compilation flag
problem, something that has been fixed in the 1.15
version of newlib or just that newlib does things
differently. Looking at the 1.15 code implies that
some of these should work and the rest appear to be a
deviation from other systems. I tested this on my RH
Linux enterprise 3 machine and got the expected
results for everything. My cygwin is up to date.

First the ones that the 1.15 code says should work
correctly: pow(1.0, nan) and pow(nan, 0.0) both should
return 1.0. I'm currently getting nan for both of
them.

The other ones are pow(1.0, inf), pow(-1.0, inf),
pow(1.0, -inf) and pow(-1.0, -inf) which I believe
should all return 1.0 as well. They are also returning
nan. What's interesting about these are that if you
look at
http://www.opengroup.org/onlinepubs/009695399/functions/pow.html
it describes exactly how to handle every case of x ^
inf except for the case of positive 1. Maybe they are
assuming we all remember that 1 raised to any power is
1.

The later ones may not belong here, but whoever is
maintaining newlib for cygwin likely has a stronger
voice with the newlib developers than I would have so
I thought I would include them as well.

Regards,

Cary

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.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/


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