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 !
Post Reply
Yicker
Pilot Officer
Posts: 86
Joined: Thu Jan 26, 2006 11:27 pm
Location: St. Helens, Merseyside, UK

Displaying a packed floating point number in C#

Post by Yicker » Fri Oct 15, 2010 11:26 pm

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: 352
Joined: Tue Nov 07, 2006 7:38 am

Post by JamesD » Sat Oct 16, 2010 6:46 am


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

Post by JamesD » 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

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

Post by JamesD » Sat Oct 16, 2010 7:30 am


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

Post by JamesD » 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.

User avatar
Dbug
Site Admin
Posts: 2326
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Post by Dbug » 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 :)

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests