Date: Wed, 3 Sep 1997 08:31:30 -0400 (EDT) Message-Id: <199709031231.IAA29822@delorie.com> From: DJ Delorie To: eldredge AT ap DOT net CC: djgpp AT delorie DOT com In-reply-to: <199709030259.TAA10342@adit.ap.net> (message from Nate Eldredge on Tue, 2 Sep 1997 19:59:21 -0700 (PDT)) Subject: Re: Optimization of math.h functions Precedence: bulk > If there's a disadvantage to this, somebody please let me know. Otherwise, I > think it should be done. Most of the i387 FPU instructions are only valid on a limited range of input values. The functions have to perform other math on the input to coerce it to the right value before doing the actual operation. For example, sin(x) is only valid for one or two quadrants, so you have to do some divides and subtracts (and maybe call cos(pi/2-x)) to get a valid number. The functions also have to deal with invalid input, like sqrt(-1), which sets errno to EDOM. If there are functions that can be inlined with 100% compatibility with published standards, we should inline them. We cannot inline if it means incompatibility.