[comp.os.minix] Floating point routines for gcc on 386

eesrajm@cc.brunel.ac.uk (Andrew J Michael) (01/15/91)

Has anyone got any PD floating point routines that I can use for
a port of gcc-1.38 to the 386 ?  I'm not using a 80387, and gas 
assembler format would be preferred .....

Thanks in advance

Andy Michael


-- 
Andy Michael (eesrajm@cc.brunel.ac.uk)      "You might think that.  I
85 Hawthorne Crescent                        couldn't possibly comment."
West Drayton
Middlesex                                  
UB7 9PA   

steveq@syd.dms.CSIRO.AU (Stephen Quigg) (01/18/91)

In article <1950@Terra.cc.brunel.ac.uk> eesrajm@cc.brunel.ac.uk (Andrew J Michael) writes:
>Has anyone got any PD floating point routines that I can use for
>a port of gcc-1.38 to the 386 ?  I'm not using a 80387, and gas 
>assembler format would be preferred .....
>
>Thanks in advance
>
>Andy Michael
>
------------------------------------------------------------------------------
This has been asked a few times, and the following may be of interest. It is
part of the README file for a package available via ftp from;
	suphys.physics.su.oz.au (129.78.129.1) in directory Esix/src/math.
You will still need an emulator for the 387 if you do not have one, (any
offers :-) ), but it's a good start.
-------------------------------------------------------------------------------

VERSION: This is version 2.0
--------
This is version 2.0 of the alternative 386 math library. It supplants
all previous versions.

Version Notes
-------------
The main change between 1.1 and 2.0 is that all functions are now available
in float versions. To use them you need gcc/gas in order to create the
library (libffpu.a) and an ANSI C compiler to compile your source code because
K&R-1 compilers pass all floating point argumnets to functions as doubles and
this is not the desired behaviour.

The float function names are formed from the double versions by appending
an 'f', for example sin -> sinf. These functions are fully prototyped in
fpumath.h.

Note that jn and yn are not available at this time.

Three libraries are now built:
libfpu.a - double version
libffpu.a - float version
libcfpu.a - combined version 

The speed difference between floats and doubles is dependent on the
instruction mix - from memory operands or on stack operands. Floats are
faster to load from memory but once on the stack, all operations occur on
the 80 bit temporary real representation.

To use the float version effectively you really need an ANSI stdio
implementation.

Introduction
------------
The files in this directory consist of assembler and C source for an 
alternative maths library for Unices (including Xenix) running on an
80386/80387 combination and using gcc/gas as the compiler system. These
routines are typically from 2 to 10 times faster than those in the 
supplied maths library; assuming that your library, like mine 
(ESIX rev. D and Xenix 2.3.2), does not use the '387 inbuilts to perform 
transcendental calculations.

For those of you without a '387 you must use the full emulator and
consequently may not see any speed up. I haven't tried. Under Xenix you
must have a '387---some of the '387 instructions are not emulated. If you
have a '287 your in the same boat; some of the assembler routines won't
work.

I have coded the additional IEEE 754 required functions to provide a
conforming double precision implementation. 

You require gcc/gas in order to compile the assembler source code.

People who are using SUN 386i's (Roadrunner) may also find this useful.

I have found that writing good low level numerical code is far harder
than I initially thought it would be. But I've learnt a lot, and I still 
enjoy doing it.

File List
---------
CHANGELOG       atanhf.s        expm1f.s        j0.c            rint.s
COPYING         ceil.s          fabs.s          j0f.c           rintf.s
COPYRIGHT       ceilf.s         fabsf.s         j1.c            scalb.s
Makefile        copysign.s      finite.s        j1f.c           scalbf.s
PROBLEMS        copysignf.s     finitef.s       lgamma.c        setcont.s
README          cos.s           floor.s         lgammaf.c       setinternal.s
TODO            cosf.s          floorf.s        log.s           sin.s
_getsw.s        cosh.s          fmod.s          log10.s         sinf.s
acos.s          coshf.s         fmodf.s         log10f.s        sinh.s
acosf.s         d2dcomb.summ    fpumath.h       log1p.s         sinhf.s
acosh.s         drem.s          gamma.c         log1pf.s        sqrt.s
acoshf.s        dremf.s         gammaf.c        log2.s          sqrtf.s
asin.s          erf.c           hypot.s         log2f.s         sqrtp.s
asinf.s         erff.c          hypotf.s        logb.s          sqrtpf.s
asinh.s         exp.s           ieee_ext.s      logbf.s         tan.s
asinhf.s        exp10.s         ieee_extf.s     logf.s          tanf.s
atan.s          exp10f.s        ieee_retro.c    nextafter.c     tanh.s
atan2.s         exp2.s          ieee_values.s   nextafterf.c    tanhf.s
atan2f.s        exp2f.s         ieee_valuesf.s  paranoia.c
atanf.s         expf.s          infinity.s      pow.s
atanh.s         expm1.s         infinityf.s     powf.s