Mail Archives: djgpp-workers/1999/06/09/12:32:57
Eli Zaretskii wrote:
> Why is the rounding mode important for these functions, but not for
> others?
Several functions, such as exp, pow, and the hyperbolics, issue the F2XM1
instruction to compute exponential functions. This instruction needs range
reduction, which is accomplished by separating the argument into integer and
fractional parts. However, the coprocessor instruction to do this (FRNDINT)
operates differently, depending on the rounding mode of the coprocessor. The
range of approximation for F2XM1 on the newer processors is [-1,+1], which
works regardless of the rounding direction, but it may be only [-0.5,+0.5] on
some older processors, which would require round-to-nearest. I don't have my
old 387 book at my fingertips, so I can't check this at this moment.
Several other functions, such as modf, floor and ceil, use FRNDINT directly to
produce explicit rounding, but in those functions I change and restore the
control word, since round-to-nearest is not what is needed.
-Eric Rudd
- Raw text -