View topic - maths formula

Page 1 of 1

maths formula

PostPosted: Tue Dec 30, 2003 7:52 am
by rldchua
I'll like to find out the correct writing of the syntax when i have the followings:

from normal calculations, changing all to decimal, I'll get 82.6, however this is not the case here. Can someone help me with the writing of this syntax so that i can at least get to 2 decimal place?

PostPosted: Tue Dec 30, 2003 2:24 pm
by thegman
int main (void)
float a=0x00;
float b=0x00;
float c;
sscanf("EA", "%X", &a);
sscanf("FF", "%X", &b);
c = (a/b) * 90;

I'm assuming you're using C, there may be an easier way, but this seems to work.



PostPosted: Mon Jan 05, 2004 5:16 pm
by Drex
there may be an easier way

I know its trivial,but :wink:

printf("Decimal value is : %f\n", 90*(double)0xea / (double)0xff);