When I receive a number, for example, from the structure of GetSystemTime, it is in hex format. I want to load this number in a FPU register (fld) but the number needs to be in memory and in a real format.
Summarizing, EAX point to a mem with a DWORD HEX value, how can I convert this number into REAL8 value?
Thanks
:rolleyes:
I think I can help you here, well i have no idea what a Real8 value is but i can help you w/ conversion here, ok lets start off converting a number from a base 10 (thats what we normaly use) to base 16 (hex).
say we have a number like 91, ok the first thing we do is find the highest power of 16 that does not exceed our number, in this case the highest is 1; 16^0=1, 16^1=16, 16^2=256; so 1 is what we are going to use.
91/16= 5 remainder(rem from now on)=11
we now know our first number is 5, now we go back thing and find the highest power of our rem, which is 0 so where done, 11 in hex is be, so 91 is 5B in hex. kewl huh?
Lets try that again, with a bigger number like 5469, ok?
16^0=1, 16^1=16, 16^2=256, 16^3=4096, 16^4=65536, so we will use 16^3.
5469/4096=1 rem=1373
now we use 16^2 for the remainder...
1373/256=5 rem=93
now we use 16^1 for the remainder...
93/16=5 rem=13
and now the rem is less then 16^1 which means its one of the first 16 hex numbers, allright!!! Remember that 13 becomes a 'd'
so our hex number is: 155d
Now why did I have you do that because it makes base 16 or any other base to another much easyer, and its a good math lesson!!!
ok lets convert a hex number like 1dfc to base 10...
here's the best way i have seen to do it:
each place to the left of the decimal point is a power of 16 string at 16^0.
our number has 4 places so....
16^3 16^2 16^1 16^0 ; 16 to the __ power
4096 256 16 1 ; equivelnt to 16 to the __ power
1 d f c ; our hex numbers
1 13 15 12 ; our hex letters to digets
4096 + 3328 + 240 + 12 = 7676
see (4096 * 1) + (13 * 256) + (15 * 16) + (12 * 1) = 7676 in base 10, wasn't that fun??? for extra practice brake 7676 back down into hex.
I really hope this helps, hell took me long enough to type :]
-brad
This message was edited by Rage9, on 4/10/2001 10:07:00 PMfild does what you want
It load in fpu a integer value
(s)
Thanks all!!!
I used fild and worked!!!
(How dummy I was... :rolleyes:)