Float Bug?

Discuss PocketC for Palm OS (including Desktop Edition)

Postby tonyhunterajh on Thu Feb 16, 2006 11:10 pm

I am having a problem with floats. This equation...

(float)(1000000)/(float)(65)

should give me a result of 15384.61538. It does not; rather, it gives me 1.5384615e04. Can PocketC handle calculations like this? Am I doing something wrong?

Tony
tonyhunterajh
 
Posts: 29
Joined: Sat Feb 11, 2006 12:28 pm
Location: USA

Postby MN OrbUser on Fri Feb 17, 2006 11:37 am

It has given the right answer, but in a different format than you were expecting. 1.5384615e04 = 1.5384615 * 10000 = 15384.615

To get the format you are expecting try
format((float)(1000000)/(float)(65),5)
MN OrbUser
 
Posts: 12
Joined: Wed Feb 01, 2006 4:52 pm
Location: USA

Postby tonyhunterajh on Fri Feb 17, 2006 11:46 am

Great! Thanks alot for your help.

Tony
tonyhunterajh
 
Posts: 29
Joined: Sat Feb 11, 2006 12:28 pm
Location: USA


Return to PocketC for Palm OS

Who is online

Users browsing this forum: No registered users and 4 guests

cron