ftp.nice.ch/pub/next/developer/hardware/m68k/libjv.README

This is the README for libjv.1.0.N.s.tar.gz [Download] [Browse] [Up]

Enclosed is a floating point library that avoids the problems of line-f 
calls as is done in NeXT-step 2.
The problem is the following:
In the 68030 there are no floating point operations. Hence the 68882 has 
been added. Its instructions are accessed by a direct link between the 
68030 and the 68882. The instructions that use this link are called 
line-f instructions and they can be programmed even at the assembly 
level. This system was used in the old NeXT computers that worked with 
the 68030.
The NeXT-stations and the newer cubes use a 68040. This chip has a 
number of floating point operations (*,/,+,-,sqrt) built in. Because of 
this no floating point coprocessor has been added. These operations are 
again accessed by (the same) line-f instructions. The problems arise 
with the extra transcendental functions that were available in the 
68882. These have to be simulated in software. However the math library 
still provides the old routines with the lin-f calls for these 
functions. What happens when such a function is called is then:
1:  the chip gets the line-f instruction.
2:  it does not recognize it
3:  it generates an exception
4:  the exception handler figures out what went wrong
5:  the exception handler calls the appropriate routine
The overhead of this is such that it can make floating point intensive 
programs, that use the transcendental functions frequently, 
significantly slower than necessary. Often even by more than a factor 2. 
The routines in this distribution avoid this problem. If you use 
cc ........ -ljv -lm
rather than
cc ........ -lm
the routines that are in libjv.a take priority. This avoids the 
exception handler. The -lm may be necessary if you use routines that are 
not in libjv.a. If you do not use such routines, it can be omitted.
I did not have time to do all routines because when I made this I was in 
the middle of a project and needed some speed.

Caution:
The routines are guaranteed to work for IEEE precision. They do not 
return extended 80 bits precision. In the way these routines are used 
and because the compiler never uses the passing of arguments by 
(floating point) registers there is no need for this precision. 

Remark 1:
From version 3.0 on there will be similar routines in libm.a

Remark 2:
You may use these routines freely. All rights remain with the author.

Remark 3:
The author is Jos Vermaseren (t68@nikhef.nl). If you have useful 
suggestions (like bug reports), please send them.

Remark 4:
In the distribution you should find the files
  acos.c asin.c atan.c atan2.c cos.c exp.c floor.c fmod.c
  libjv.a log.c log10.c makefile pow.c sin.c sqrt.s tan.c
You can use the libjv.a file directly. You can also make a new library 
file by typing in 'make'.

Remark 5:
Note that if you try to make additional routines you should try to avoid 
divisions. They are quite 'expensive'.

Remark 6:
If your programs use only multiplications, divisions, additions and 
subtractions the use of libjv.a will not make a difference at all. 
Hence the actual improvement is very much a function of your program.

Remark 7:
Extract the library from the file libjv.1.tar.Z with the commands:
uncompress libjv.1.tar.Z
tar -xf libjv.1.tar
This creates the directory libjv which contains all the files.

Good Luck
Jos Vermaseren

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.