|
| setox.sa 3.1 12/10/90
|
| The entry point setox computes the exponential of a value.
| setoxd does the same except the input value is a denormalized
| number. setoxm1 computes exp(X)-1, and setoxm1d computes
| exp(X)-1 for denormalized X.
|
| INPUT
| -----
| Double-extended value in memory location pointed to by address
| register a0.
|
| OUTPUT
| ------
| exp(X) or exp(X)-1 returned in floating-point register fp0.
|
| ACCURACY and MONOTONICITY
| -------------------------
| The returned result is within 0.85 ulps in 64 significant bit, i.e.
| within 0.5001 ulp to 53 bits if the result is subsequently rounded
| to double precision. The result is provably monotonic in double
| precision.
|
| SPEED
| -----
| Two timings are measured, both in the copy-back mode. The
| first one is measured when the function is invoked the first time
| (so the instructions and data are not in cache), and the
| second one is measured when the function is reinvoked at the same
| input argument.
|
| The program setox takes approximately 210/190 cycles for input
| argument X whose magnitude is less than 16380 log2, which
| is the usual situation. For the less common arguments,
| depending on their values, the program may run faster or slower --
| but no worse than 10% slower even in the extreme cases.
|
| The program setoxm1 takes approximately ??? / ??? cycles for input
| argument X, 0.25 <= |X| < 70log2. For |X| < 0.25, it takes
| approximately ??? / ??? cycles. For the less common arguments,
| depending on their values, the program may run faster or slower --
| but no worse than 10% slower even in the extreme cases.
|
| ALGORITHM and IMPLEMENTATION NOTES
| ----------------------------------
|
| setoxd
| ------
| Step 1. Set ans := 1.0
|
| Step 2. Return ans := ans + sign(X)*2^(-126). Exit.
| Notes: This will always generate one exception -- inexact.
|
|
| setox
| -----
|
| Step 1. Filter out extreme cases of input argument.
| 1.1 If |X| >= 2^(-65), go to Step 1.3.
| 1.2 Go to Step 7.
| 1.3 If |X| < 16380 log(2), go to Step 2.
| 1.4 Go to Step 8.
| Notes: The usual case should take the branches 1.1 -> 1.3 -> 2.
| To avoid the use of floating-point comparisons, a
| compact representation of |X| is used. This format is a
| 32-bit integer, the upper (more significant) 16 bits are
| the sign and biased exponent field of |X|; the lower 16
| bits are the 16 most significant fraction (including the
| explicit bit) bits of |X|. Consequently, the comparisons
| in Steps 1.1 and 1.3 can be performed by integer comparison.
| Note also that the constant 16380 log(2) used in Step 1.3
| is also in the compact form. Thus taking the branch
| to Step 2 guarantees |X| < 16380 log(2). There is no harm
| to have a small number of cases where |X| is less than,
| but close to, 16380 log(2) and the branch to Step 9 is
| taken.
|
| Step 2. Calculate N = round-to-nearest-int( X * 64/log2 ).
| 2.1 Set AdjFlag := 0 (indicates the branch 1.3 -> 2 was taken)
| 2.2 N := round-to-nearest-integer( X * 64