Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Converting float DWORD into decimals

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Muffin Baker
How do I cheat?
Reputation: 0

Joined: 08 Aug 2008
Posts: 8
Location: In your scripts.

PostPosted: Sat Oct 18, 2008 9:49 am    Post subject: Converting float DWORD into decimals Reply with quote

Hi, couldn't find a good place to post this =(

I have a binary float DWORD which I need to convert into decimals. I can pretty much understand how I'm suposed to do it, but it wont work Sad

11000001 01001000 00000000 00000000 <- The binary DWORD I need to convert

11000001 01001000 00000000 00000000

1 Is the sign ( 1 = minus )
1000001 0 The exponent Is equal to 3 ( 10000001 0 = 130 decimal; 130-127 = 3)
1001000 00000000 00000000 Is the fraction
Between 1000001 0 and 1001000 00000000 00000000 Is the comma (,) and the binary 1

So the real fraction 1001000 00000000 00000000 is 1,100 1000 0000 0000 0000 0000

Now how the hell do I convert this into a decimal number ? Sad Its really important for me. Help!!

_________________
Always Outnumbered Never Outgunned.


Last edited by Muffin Baker on Sat Oct 18, 2008 11:32 pm; edited 1 time in total
Back to top
View user's profile Send private message
Psy
Grandmaster Cheater Supreme
Reputation: 1

Joined: 27 Mar 2008
Posts: 1366

PostPosted: Sat Oct 18, 2008 9:55 am    Post subject: Reply with quote

Use cheat engine to alter the data-type or use one of the many html pages around which do the same job. As I found out, float converting is not as straight forward as it seems, there are many steps to doing it. There is some very detailed information out there if you just search for it.

~Psych
Back to top
View user's profile Send private message
Muffin Baker
How do I cheat?
Reputation: 0

Joined: 08 Aug 2008
Posts: 8
Location: In your scripts.

PostPosted: Sat Oct 18, 2008 10:35 am    Post subject: Reply with quote

[Psych] wrote:
Use cheat engine to alter the data-type or use one of the many html pages around which do the same job. As I found out, float converting is not as straight forward as it seems, there are many steps to doing it. There is some very detailed information out there if you just search for it.

~Psych


Thanks for the fast reply, I did find several websites that convert binary to decimal but they don't convert floats. Also found several pages that explain how its suposed to be done but after finding the mantissa (which I did) it just shows the answer without explaining the converting steps....

_________________
Always Outnumbered Never Outgunned.
Back to top
View user's profile Send private message
majick
Expert Cheater
Reputation: 1

Joined: 08 Sep 2007
Posts: 112
Location: tennessee

PostPosted: Mon Oct 27, 2008 7:51 pm    Post subject: Reply with quote

i think this is what your asking im a bit toasty i hate to make an a$. of myself

The Conversion Procedure
The rules for converting a decimal number into floating point are as follows:
Convert the absolute value of the number to binary, perhaps with a fractional part after the binary point. This can be done by converting the integral and fractional parts separately. The integral part is converted with the techniques examined previously. The fractional part can be converted by multiplication. This is basically the inverse of the division method: we repeatedly multiply by 2, and harvest each one bit as it appears left of the decimal.
Append × 20 to the end of the binary number (which does not change its value).
Normalize the number. Move the binary point so that it is one bit from the left. Adjust the exponent of two so that the value does not change.
Place the mantissa into the mantissa field of the number. Omit the leading one, and fill with zeros on the right.
Add the bias to the exponent of two, and place it in the exponent field. The bias is 2k−1 − 1, where k is the number of bits in the exponent field. For the eight-bit format, k = 3, so the bias is 23−1 − 1 = 3. For IEEE 32-bit, k = 8, so the bias is 28−1 − 1 = 127.
Set the sign bit, 1 for negative, 0 for positive, according to the sign of the original number.
Using The Conversion Procedure
Convert 2.625 to our 8-bit floating point format.
The integral part is easy, 210 = 102. For the fractional part: 0.625 × 2 = 1.25 1 Generate 1 and continue with the rest.
0.25 × 2 = 0.5 0 Generate 0 and continue.
0.5 × 2 = 1.0 1 Generate 1 and nothing remains.
So 0.62510 = 0.1012, and 2.62510 = 10.1012.
Add an exponent part: 10.1012 = 10.1012 × 20.
Normalize: 10.1012 × 20 = 1.01012 × 21.
Mantissa: 0101
Exponent: 1 + 3 = 4 = 1002.
Sign bit is 0.
The result is 01000101. Represented as hex, that is 4516.
Convert -4.75 to our 8-bit floating point format.
The integral part is 410 = 1002. The fractional: 0.75 × 2 = 1.5 1 Generate 1 and continue with the rest.
0.5 × 2 = 1.0 1 Generate 1 and nothing remains.
So 4.7510 = 100.112.
Normalize: 100.112 = 1.00112 × 22.
Mantissa is 0011, exponent is 2 + 3 = 5 = 1012, sign bit is 1.
So -4.75 is 11010011 = d316
Convert 0.40625 to our 8-bit floating point format.
Converting: 0.40625 × 2 = 0.8125 0 Generate 0 and continue.
0.8125 × 2 = 1.625 1 Generate 1 and continue with the rest.
0.625 × 2 = 1.25 1 Generate 1 and continue with the rest.
0.25 × 2 = 0.5 0 Generate 0 and continue.
0.5 × 2 = 1.0 1 Generate 1 and nothing remains.
So 0.4062510 = 0.011012.
Normalize: 0.011012 = 1.1012 × 2-2.
Mantissa is 1010, exponent is -2 + 3 = 1 = 0012, sign bit is 0.
So 0.40625 is 00011010 = 1a16
Convert -12.0 to our 8-bit floating point format.
1210 = 11002.
Normalize: 1100.02 = 1.12 × 23.
Mantissa is 1000, exponent is 3 + 3 = 6 = 1102, sign bit is 1.
So -12.0 is 11101000 = e816
Convert decimal 1.7 to our 8-bit floating point format.
The integral part is easy, 110 = 12. For the fractional part: 0.7 × 2 = 1.4 1 Generate 1 and continue with the rest.
0.4 × 2 = 0.8 0 Generate 0 and continue.
0.8 × 2 = 1.6 1 Generate 1 and continue with the rest.
0.6 × 2 = 1.2 1 Generate 1 and continue with the rest.
0.2 × 2 = 0.4 0 Generate 0 and continue.
0.4 × 2 = 0.8 0 Generate 0 and continue.
0.8 × 2 = 1.6 1 Generate 1 and continue with the rest.
0.6 × 2 = 1.2 1 Generate 1 and continue with the rest.

The reason why the process seems to continue endlessly is that it does. The number 7/10, which makes a perfectly reasonable decimal fraction, is a repeating fraction in binary, just as the faction 1/3 is a repeating fraction in decimal. (It repeats in binary as well.) We cannot represent this exactly as a floating point number. The closest we can come in four bits is .1011. Since we already have a leading 1, the best eight-bit number we can make is 1.1011.
Already normalized: 1.10112 = 1.10112 × 20.
Mantissa is 1011, exponent is 0 + 3 = 3 = 0112, sign bit is 0.
The result is 00111011 = 3b16. This is not exact, of course. If you convert it back to decimal, you get 1.6875.
Convert -1313.3125 to IEEE 32-bit floating point format.
The integral part is 131310 = 101001000012. The fractional: 0.3125 × 2 = 0.625 0 Generate 0 and continue.
0.625 × 2 = 1.25 1 Generate 1 and continue with the rest.
0.25 × 2 = 0.5 0 Generate 0 and continue.
0.5 × 2 = 1.0 1 Generate 1 and nothing remains.
So 1313.312510 = 10100100001.01012.
Normalize: 10100100001.01012 = 1.010010000101012 × 210.
Mantissa is 01001000010101000000000, exponent is 10 + 127 = 137 = 100010012, sign bit is 1.
So -1313.3125 is 11000100101001000010101000000000 = c4a42a0016
Convert 0.1015625 to IEEE 32-bit floating point format.
Converting: 0.1015625 × 2 = 0.203125 0 Generate 0 and continue.
0.203125 × 2 = 0.40625 0 Generate 0 and continue.
0.40625 × 2 = 0.8125 0 Generate 0 and continue.
0.8125 × 2 = 1.625 1 Generate 1 and continue with the rest.
0.625 × 2 = 1.25 1 Generate 1 and continue with the rest.
0.25 × 2 = 0.5 0 Generate 0 and continue.
0.5 × 2 = 1.0 1 Generate 1 and nothing remains.
So 0.101562510 = 0.00011012.
Normalize: 0.00011012 = 1.1012 × 2-4.
Mantissa is 10100000000000000000000, exponent is -4 + 127 = 123 = 011110112, sign bit is 0.
So 0.1015625 is 00111101110100000000000000000000 = 3dd0000016
Convert 39887.5625 to IEEE 32-bit floating point format.
The integral part is 3988710 = 10011011110011112. The fractional: 0.5625 × 2 = 1.125 1 Generate 1 and continue with the rest.
0.125 × 2 = 0.25 0 Generate 0 and continue.
0.25 × 2 = 0.5 0 Generate 0 and continue.
0.5 × 2 = 1.0 1 Generate 1 and nothing remains.
So 39887.562510 = 1001101111001111.10012.
Normalize: 1001101111001111.10012 = 1.00110111100111110012 × 215.
Mantissa is 00110111100111110010000, exponent is 15 + 127 = 142 = 100011102, sign bit is 0.
So 39887.5625 is 01000111000110111100111110010000 = 471bcf9016

_________________
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Psy
Grandmaster Cheater Supreme
Reputation: 1

Joined: 27 Mar 2008
Posts: 1366

PostPosted: Tue Oct 28, 2008 3:28 am    Post subject: Reply with quote

Its ok to copy and paste isn't it, without understanding what you have put or giving any credits....
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites