bug in logarithm()

Jeff Johnston jjohnstn@redhat.com
Wed Oct 17 20:16:00 GMT 2007

Patrick Mansfield wrote:
> On Wed, Oct 17, 2007 at 12:28:47PM +0200, Martin Koeppe wrote:
>> Hi again,
>> I'm using newlib on a i386 architecture, and now I wonder if it's 
>> possible to configure libm in such a way that the fast asm versions of 
>> e.g. log() are used. In my current newlib-libm.a there are the entry 
>> points for _f_log() etc., but apparently log() doesn't make use of 
>> _f_log().
>> (How) Is it possible to configure newlib's libm to make use of _f_log 
>> within log()?
>> Thank you very much
> They aren't compatible per comments in the code. You could call them
> directly. AFAIUI there should be prototypes and proper names (without
> underscore prefix, like #define f_log _f_log) for them in newlib, but I
> don't see any.
> -- Patrick Mansfield
Actually, they are meant to be called when the user specifies 
-ffast-math on the compilation.

The definitions used to be part of libc/include/machine/fastmath.h with 
an i386 check.  This got inadvertently left out when we initially made 
the transition of newlib from internal to external repositories.

Anyway, I have added libc/machine/i386/machine/fastmath.h based on the 
older sources plus a few changes.  If you compile your code with the 
-ffast-math option, <math.h> will bring in <machine/fastmath.h> and you 
will get access to the few fast math routines available for x86, 
including log().

-- Jeff J.

More information about the Newlib mailing list