Floating-point numbers (on the Amiga)

Andrew Burton aliensrcooluk at yahoo.co.uk
Sun Jul 27 15:39:45 CDT 2008


Hi,

I am trying (and failing) to learn how AMOS Basic (and Amiga's) store floating point numbers. Whilst it is clear that it uses Motorola Fast Floating Point (MFPP) I have been unable to get it to work based on an equation found online (the Amiga RKRM's all say to use the FPP functions in the maths libraries, and also confirm the layout - 24 bit mantissa, 1bit sign, 7bit exponent).
Am I doing something wrong with my maths??


Formula:

FP result =[(-1)^SIGN] * [2^(EXP - 0x40)] * [MANTISSA / 0x1000000]


0x1000000 = 16,777,216
0x40=64
floating-point variable value=0.5
Binary value of variable=%10000000 00000000 00000000 01000000


Values calculated using formula (above):
SIGN=0 (positive)
EXPONENT=64 - 64 (bias) = 0
MANTISSA=2.51658 E+07 / 16,777,216 = 1.5

Thus:

result    = [(-1)^SIGN] * [2^(EXP - 0x40)] * [MANTISSA / 0x1000000]
             = [(-1)^0]*[2^(0)]*[1.5]
             = 1*1*1.5
             = 1.5!

I have uploaded a bitmap image of my maths to my site if it isn't clear from above what I am doing.

http://www.geocities.com/aliensrcooluk/public/MFPP_problem.bmp


Please help!
Andrew B
aliensrcooluk at yahoo.co.uk



More information about the cctech mailing list