Hi,

On Tue, 6 Nov 2007, Uros Bizjak wrote:
> Forwarded is a short discussion with Mr. de Dinechin (forwarded with 
> permission), where the possibility to import crlibm as the default gcc 
> math library is discussed. I would like to ask members of the GCC SC for 
> the opinion on the idea of adopting crlibm as the default math library. 

At the time we discussed and evaluated a bundled libm I've looked at 
several ones.  I rules out crlibm relatively quickly for these reasons:

* only double is implemented, hence long double and float are missing at 
  least, at least the long double would need some implementation work,
  as you can't simply enlarge the mantissa and hope all your results are
  still correct
* many C99 functions are missing: a{sin,cos}h, frexp, ldexp, modf, error 
  and gamma, remainder functions, I stoped looking somewhen
  many only partially or slowly implemented: pow, exp2
* relies on a IEEE-754 compatible processor, so it a) needs to have 
  floating point at all and b) even has to use correct precision, e.g. a 
  problem for x86.  That means that either crlibm doesn't work correctly 
  when the processor's precision is reset by the user program (e.g. to use 
  extended precision), or it has to save/set/restore the state on 
  entry/exit of all it's routines
* slow: it's much faster than other correctly rounded libraries, but 
  nevertheless also much slower then more mundane implementations of libm

I would advise against going the crlibm route.  Sorry.  It's very nice for 
the things it's designed to do (provable and correctly rounded) but is not 
a replacement for a general libm.

I think the best way would be to use FreeBSDs libm, which is maintained 
fairly well, implements all functions and is reasonably fast.  I heard 
rumors about other options (like Sony+IBMs SPU libm, which supposedly also 
is written in C + intrinsics, but it never materialized in the wild).


Ciao,
Michael.

Reply via email to