Page 1 of 1
Displaying a packed floating point number in C#
Posted: Fri Oct 15, 2010 11:26 pm
I need to convert a packed floating point number as stored by the Oric to it's original value.
Code: Select all
118 would be stored as #87 #66 #00 #00 #00
Can anyone tell me how I can convert it back to it's original value of decimal 118 using C#
Posted: Sat Oct 16, 2010 6:46 am
Posted: Sat Oct 16, 2010 7:23 am
BTW, you can find a similar topic on the worldofspectrum.org started recently.
http://www.worldofspectrum.org/forums/s ... hp?t=31499
Posted: Sat Oct 16, 2010 7:30 am
Posted: Sat Oct 16, 2010 7:34 am
Look for other 8 bit computer 5 byte format floating point numbers.
It will be 4 bytes representing the number, 1 bit the sign, and 7 bits the exponent. At least if it is consistent with other machines.
Posted: Sat Oct 16, 2010 1:32 pm
Look at the C compiler source code:
http://miniserve.getmyip.com/svn/public ... rces/gen.c
The void printfloat(double val)
routine is charged to convert a double accuracy floating point value to a 5 byte format.
Doing the opposite is not much complex I guess