This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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]

Re: ***[Possible UCE]*** [PATCH] Special case math library fixes.


--- n8tm@aol.com wrote:
> log() and log10() of negative numbers should return
> NaN. The existing code was returning minus infinity,
> but NaN is a better choice when you consider that NaN
> often represents Not A real Number. The documentation
> in w_log.c was also changed to describe the new
> behavior. Other libraries produce NaN.
>
_______________________________________________________________________________
> 
> Technically correct, of course, but not necessarily an improvement in
> practice.
> 
> Arguments such as -FLT_MIN < arg < 0.  are likely to be a result of
> normal
> 
> numerical roundoff, and then the -Inf result, or anything beyond
> log(DBL_MIN*DBL_EPSILON),
> 
> is easier to handle.
>
______________________________________________________________________________

Allowing very small negative numbers to also give minus infinity would not
be that hard to implement. The biggest problem is deciding what limit
value to use for the different cases (log/log10/logf/log10f). Though I
would argue that if someone is already handling -Inf it's not that much
more work to handle NaNs (Inf and NaN have identical exponent bit
patterns).

Cary

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


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