CompuServe Thread

#Floating Point

5 messages in this thread
#89039From: Mike Spille/ManxFeb 7, 1990 2:29 PM
Most floating point formats start with a sign bit, and then have bits for the exponent and the mantissa. For single-precision IEEE, there's 8 bits of exponent and 23-bits of mantissa, for double precision there's 11-bits of exponent and 52-bits of mantissa, and for extended precision there's 15-bits of exponent, 63 bits of mantissa, and then 17-bits of 'guard'digits (used to catch overflows and stuff). The exponent is coded in a straightforward manner, but the mantissa is a bit complicated (you have to worry about normalized vs. denormalized numbers, depending on the format used). If you're going to be doing anything serious w/ floating point, I'd suggest getting some reference books about it. Actually, a good reference is the Motorola 68881 User's Manual – it diagrams the various formats pretty nicely. BTW, are you interfacing w/ C's (or another language's) floating point routines, or are you rolling your own?
#89086From: Mike BerroFeb 7, 1990 9:32 PM
I only need to do a few calcs using float, and I figure I will use the math lib for _LVOSPMul, SPDiv, etc. The only reason I need to know the details on the format is so I can define some constants. I'm doing 100% assembly (mainly cuz I prefer it), so I can't define a FLOAT constant; I must know the equivalent longword value. A simple utility that converts an ASCII number to the floating point equivalent would be great. I will check out the '881 manual. Thanx! —Mike
#89216From: Mike Spille/ManxFeb 8, 1990 5:21 PM
If you only need a few constants and have a C compiler, you can simply compile a program w/ the constant you need and look at the resulting assmebly code to get what you need. In Aztec C, you'd simply say 'cc -at progname' (both 3.6a and 5.0a), and the resuling assembly would be in progname.asm.
#89244From: Mike BerroFeb 8, 1990 8:58 PM
$300 is a lot to pay for a float converter. Luckily I have 3.6. >grin< It works great! Thanx! —Mike
#89301From: Mike Spille/ManxFeb 9, 1990 12:50 AM
Glad to be of assistance. The compiler's also great as a quick hex<->decimal <->octal converter when you misplace your calculator, although some might consider it slight overkill 😎