A coworker passed this site along to me.
I still do not understand how floating point works, but this sure does help visualize what I do not understand.
https://www.h-schmidt.net/FloatConverter/IEEE754.html
A coworker passed this site along to me.
I still do not understand how floating point works, but this sure does help visualize what I do not understand.
https://www.h-schmidt.net/FloatConverter/IEEE754.html
Floating point is just binary scientific notation, 2^e * mantissa, where the mantissa is between 1.0 and 1.9… (except in binary). The exponent portion of IEEE-754 is biased by an amount, probably to make it easier to implement (pull out the bits by rotation and masking, then subtracting the bias to get the -exp to +exp range).
I’ve also been playing around with floating point on the 6809 (and Coco) in assembly with my custom assembler (https://github.com/spc476/a09). The first article is about converting from IEEE-754 to Microsoft format (https://boston.conman.org/2024/02/28.1), and the second one is a speed comparison between the MC6839 (floating point library) and Microsoft BASIC (https://boston.conman.org/2024/03/01.1).
Floating point is just a binary version of the scientific notion: 2^exp * mantissa, where the mantissa is between 1.0 and 1.9… (just in binary notation). The exponent portion is biased by an amount for storage. You isolate the exponent bits, rotate them down, then subtract the bias to get the actual exponent.
I’ve been playing around with floating point on the 6809 (and the Coco in particular) with a custom assembler (https://github.com/spc476/a09). I’ve written about converting from IEEE-754 to Microsoft BASIC (https://boston.conman.org/2024/02/28.1), and the speed of the MC6839 (IEEE-754 ROM routines) vs. Microsoft (https://boston.conman.org/2024/03/01.1).
Let’s see … does a comment sans links get through?
Looks like comments with URLs get held for moderation, then I can approve.
Sigh. Okay. Let’s try again.
The floating point format is just a binary version of scientific notation, 2^exp * mantissa, where the mantissa is 1.0 to 1.9… (but in binary) and where the leading 1 is assumed but not stored (to get an extra bit of range). The only confusing bit is the exponent is stored biased by some value, probably to make it easier to extract it out—isolate the bits, then subtract the bias to get the actual exponent.
Okay, now for the links that aren’t links. I’ve been playing around with floating point on the 6809/Coco using a custom assembler I wrote (github.com/spc476/a09). I wrote about converting IEEE-754 floating point to Microsoft BASIC format (boston.conman.org/2024/02/28.1) and the speed difference between the MC6839 (IEEE-754 ROM) and MS BASIC (boston.conman.org/2024/03/01.1). Microsoft BASIC was faster, which I found slightly surprising.