Library func. 2's complement conversion to float?

Discuss PocketC for Palm OS (including Desktop Edition)

Postby jjenkins on Thu Feb 08, 2001 7:58 pm

Does any library function exist to convert a 16-bit 2's complement number to a floating point number?
Any C or C++ library exist that I could try to compile in PocketC?
jjenkins
 
Posts: 2
Joined: Mon Dec 18, 2000 7:27 pm

Postby jstadolnik on Fri Feb 09, 2001 7:45 pm

float conv(int a) {
//sign extend if 16 bit number if negetive
if(a&0x8000) a=a|0xffff0000;
return((float)a);
}

That's it.

Joe
jstadolnik
 
Posts: 1741
Joined: Wed Dec 06, 2000 3:34 am
Location: USA


Return to PocketC for Palm OS

Who is online

Users browsing this forum: No registered users and 2 guests

cron