delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/06/09/12:32:57

Date: Wed, 09 Jun 1999 11:30:16 -0500
From: Eric Rudd <rudd AT cyberoptics DOT com>
Subject: Re: libm sources from cyberoptics
To: djgpp-workers AT delorie DOT com
Message-id: <375E9698.7D32C155@cyberoptics.com>
Organization: CyberOptics
MIME-version: 1.0
X-Mailer: Mozilla 4.05 [en] (Win95; U)
References: <Pine DOT SUN DOT 3 DOT 91 DOT 990609162440 DOT 2045B-100000 AT is>
Reply-To: djgpp-workers AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019