On 2011-Feb-06 11:13:57 +0100, Burcin Erocal <bur...@erocal.org> wrote: >I am not sure what the speed of the cephes implementation is compared >to that of the C library though. The float evaluations are used for >plotting, so any slow down in the numerical approximation of these >functions will degrade plotting performance significantly.
Note that cephes is used to implement functions that aren't available in the base system libraries and an implementation that exists is going to produce better results than one that doesn't. As for speed, if that's a concern, I suggest you try some benchmarks. But note that correctly handling all the exceptional conditions available in IEEE754 and providing accuracy to 1 ULP or so can mean the code is slower than a sloppy implementation - and I'm aware that some libm implementations have some quite sloppy code. Whilst plotting probably doesn't require much precision in most cases, other uses of libm functions do expect precise results. >On another note, if Cephes is only included for the evaluation of these >few functions, I am not convinced it should be shipped in the standard >distribution. There are quite a few libraries already in Sage, which >have this capability. For example, can't we just use GSL to evaluate >gamma on Cygwin? One issue is that Sage expects that the gamma() family exists in libm, similarly with the other libm functions. If they are implemented elsewhere, this is likely to require changes to header includes and linking for some libraries. There's the associated problem of identifying the functions that are either missing or inadequately implemented in the host libm and locating alternative implementations within Sage. It's also worth noting that this is the 3rd platform where cephes is needed - it was initially introduced as part of Cygwin support. I've found it necessary for the FreeBSD port and now it seems necessary for the ARM port. If you want to start de-bloating Sage, there are lots of other low-hanging fruit. Note that since FreeBSD is gradulally implementing the missing parts of libm, the functions that are needed from cephes (or equivalent) changes between FreeBSD versions. #9543 therefore includes scripts to only select those parts of cephes that are missing from the base OS. It also provides some include and linker trickery to make the split of functions between two libm.so files transparent to consumer apps. -- Peter Jeremy
pgpHFCeDV9fcG.pgp
Description: PGP signature