[comp.sources.wanted] wanted: floating point add/subtrsact routines

smiller@wet.UUCP (Gregory Shane Miller) (10/29/90)

This is a repost of an earlier request:

Wanted: source code for floating point addition and subtraction

I fully realize most any compilier has 80x87 support aswell as 80x87
emulation.

They would likely have the form:

	float sum(float,float)
	float difference(float,float)

I prefer C; ASM is ok so long as it has comments.

Does anybody know of a book which provides basic algorithms to +,-,*,/
floating point numbers?

The reason I ask is simply this: 80x87 emulation is too slow.  As I 
understand it, TC and MC do 80x87 emulation by generating 80x87 opcodes
as usual and *then* replacing the bad-opcode NMI handler with their own.
In this way, when the 80x87 code is executed, it will generate a NMI
which they catch.  The NMI handler finds out which function *was* called
and reroutes the arguments (floats -> 4 bytes, doubles -> 8 bytes) to
the proper function.  Of course, the 80x86 must, at last, do the actual
operation, as will the routines I asked for.  In this sense nothing is
gained.  However, anybody familiar with the clock-cycles interrupt handlers
eat together with execution rerouting and argument passing will agree for
high speed needs (like the DDA I'm working on which requires +,-) should
be skipped if possible.  Second, I can fold the +,- routines into my stuff
eliminating, say, redundant arg passing etc.

Thanks for any help.
Regards-
smiller@wet.UUCP


-- 
--
G. Shane Miller [ smiller@wet.UUCP ]  Von Neumann eat your heart out!