Displaying a packed floating point number in C#

Since we do not have native C compilers on the Oric, this forum will be mostly be used by people using CC65 or the OSDK. But any general C related post will be welcome !
Yicker
Pilot Officer
Posts: 97
Joined: Thu Jan 26, 2006 11:27 pm
Location: St. Helens, Merseyside, UK

Displaying a packed floating point number in C#

Post by Yicker »

Hi,

I need to convert a packed floating point number as stored by the Oric to it's original value.

For example

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#


Cheers
Scott
JamesD
Flight Lieutenant
Posts: 358
Joined: Tue Nov 07, 2006 7:38 am

Post by JamesD »

JamesD
Flight Lieutenant
Posts: 358
Joined: Tue Nov 07, 2006 7:38 am

Post by JamesD »

BTW, you can find a similar topic on the worldofspectrum.org started recently.
http://www.worldofspectrum.org/forums/s ... hp?t=31499
JamesD
Flight Lieutenant
Posts: 358
Joined: Tue Nov 07, 2006 7:38 am

Post by JamesD »

JamesD
Flight Lieutenant
Posts: 358
Joined: Tue Nov 07, 2006 7:38 am

Post by JamesD »

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.
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Post by Dbug »

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 :)
Post Reply