From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <199903031736.SAA15424@pauillac.inria.fr> Date: Wed, 3 Mar 1999 18:36:07 +0100 (MET) From: Robert Harley Subject: Re: Free Compaq Math Library for Linux Joachim quoted: >> Now, this CPML will enable customers to significantly increase the >> precision and speed of mathematical calculations by more than 10 times >> compared to other mathematical libraries currently available on Linux. and wrote: >I'd say, don't expect that much. And precision, AFAIK, is actually >comparable or worse than current libs The file http://www.unix.digital.com/linux/cpml.0.1.tar.gz contains a README that gives the following numbers: ==============================================================================               Accuracy Performance         ----------------------- -----------------------------------------                                                CPML Fast CPML                      Fast Input ----------- ----------- Func CPML libm CPML FFM Value Tru64 Linux libm Tru64 Linux FFM ----- ------------------------ -------------------------------------------- sqrt .50 .50 1.90 .97 10.0 68 68 1017 41 44 75 sin .54 .83 1.91 3.20 1.96 68 74 268 54 61 85 log10 .55 1.92 3.22 3.57 2.1 56 62 367 43 49 105 rsqrt 1.43 - - 2.19 10.0 45 50 - - - 73 atan .53 .76 - 1.86 200. 81 83 242 - - 95 acos .59 .88 - 1.44 -.99 89 95 1185 - - 161 atan2 1.27 1.43 - 2.89 1.1,2.1 105 108 408 - - 139 sinh .51 1.78 - 2.43 2.1 78 83 535 - - 122 log .55 .85 3.45 3.78 2.1 56 62 299 43 49 104 tanh .61 2.08 - 3.34 2.1 134 139 489 - - 155 asin .63 .85 - 2.50 .99 92 99 1193 - - 162 tan .54 .83 2.67 3.46 7.85 90 101 505 75 81 97 log2 .58 - - 3.26 10.0 57 61 - - - 102 cosh .51 1.31 - 2.51 2.1 79 82 440 - - 122 cos .53 .81 1.97 3.00 1.57 68 73 251 53 61 89 exp .50 .85 3.53 2.14 2.1 62 67 376 47 52 87 pow .51 .82 3.76 2706 1.1,10.1 113 118 1047 91 91 203 cot .54 - - 4.05 2.1 84 92 - - - 88 ============================================================================== Those suggest that the precision really is good and, compared to libm at least, there are several functions for which there is a 10x speed-up. >(I played around with some DU binary, sqrt is NOT correctly rounded). That happens is you use the "-fast" flag which is documented as: ==============================================================================   -fast       Provides a single method for turning on a collection of optimizations       for increased performance.       Note that the -fast flag can produce different results for floating-       point arithmetic and math functions, although most programs are not       sensitive to these differences. [...] ============================================================================== I doubt very much if the non "-fast" sqrt() has any last bit errors... >AND, regarding the latest discussion here, it's HEAVILY table driven ! Doh! Is there any consensus on what size of tables are accpetable for a library? For a specific app, it would be "as big as necessary to go as fast as possible" but for a library routine I try to stick to <= 256 bytes. The sqrt code I posted a few days ago can be sped up by abut 5 cycles (and the branch removed) by doubling the table size to 512 bytes to handle even and odd exponents in one go. It's quite annoying because the entries are floats but have only a byte of information each. A table of bytes would be 4 times smaller but then it would cost several cycles to stash the byte into a float. Bye,   Rob. PS: I haven't looked into Kazushige's reply yet. I'll get around to it RSN!