Google Answers Logo
View Question
 
Q: Indentifying parts of a floating point number ( No Answer,   2 Comments )
Question  
Subject: Indentifying parts of a floating point number
Category: Computers > Programming
Asked by: norsken-ga
List Price: $10.00
Posted: 06 May 2006 17:43 PDT
Expires: 05 Jun 2006 17:43 PDT
Question ID: 726166
These are supposedly 32 bit floating point numbers. There are multiple
recordings of the same variable, so I believe the variation is minimal
(i.e. 2.34 2.356 2.333 etc).

The byte order might be wrong (little endian/big endian) and the bits
in a byte may be "mirrored".

Variable 1:
  00100001 01110000 01001001 11000000
  00100001 10111101 10101100 11000000
  00100001 11010001 01001101 01001000
  01100001 01011000 01010000 01110110
  00100001 00101101 00110001 01000000
  10100001 10111001 10110011 10000000
  00100001 01110101 10010011 11000110
  00100001 00011110 00001101 11111100
  00100001 00100100 01011010 01110010

Variable 2:
  01100001 00101011 11100000 00110000 
  01100001 00100100 11011000 00010000 
  01100001 01011000 00110111 11000000 
  01100001 00000000 10010101 00000000 
  10100001 00101111 10000111 11011110 
  10100001 00001110 10010011 11101110 
  10100001 00111011 10000000 00101110 
  10100001 00110010 10101001 01001110 

Does anyone recognize a pattern? Answer should include decimal value,
exponent and mantissa for some of my examples.
Answer  
There is no answer at this time.

Comments  
Subject: Re: Indentifying parts of a floating point number
From: thegreatall-ga on 11 May 2006 11:34 PDT
 
I am no expert on IEEE 754 Floating Point conversion, but now know
enough to explain it. First I will give a few links to sites that
helped me during complications:

http://en.wikipedia.org/wiki/IEEE_floating-point_standard
http://www.h-schmidt.net/FloatApplet/IEEE754.html
http://www.psc.edu/general/software/packages/ieee/ieee.html

Now I will explain it myself...

Let?s take your fist example: 00100001 01110000 01001001 11000000
it is most logical to put it into this format:

0 01000010 11100000100100111000000
S EEEEEEEE FFFFFFFFFFFFFFFFFFFFFFF

The "S" stands for "Sign" witch is the position of the number
(positive or negative).

The "E" stands for "Exponent" witch is basically where the decimal
place falls on the number; you need to subtract this number from 127
(this number may be different, but for a IEEE 754 32bit it is 127).

The "F" stands for "Fraction" witch is the actual number in binary.

now that the basics are known, I will step through an example...

0 01000010 11100000100100111000000

First, we should find where the decimal place will fall. If you do not
already know how to convert binary look at this link:
http://en.wikipedia.org/wiki/Binary_numeral_system

The Exponent value is: 01000010 which is 66, but we need to subtract
this number from 127 first, which is -61. Now we know where the
decimal place is on the number. We should now convert the number;
first thing that needs to be done is add a "1" to the beginning of the
"F". Now, we need to know where on the number the decimal place falls;
since we already know that it is 61 to the left of the number. The
number we need to convert is now:
0.0000000000000000000000000000000000000000000000000000000000000111100000100100111

Since this number is so small I will only give an estimate. It is
about: 8.141277024869409E-19
or written out in a long format (about):
0.000000000000000000814277024869409

Now I have converted all the numbers for you and here are the results:

Variable 1:
  00100001 01110000 01001001 11000000 ~: 8.141277E-19
  00100001 10111101 10101100 11000000 ~: 1.2852865E-18
  00100001 11010001 01001101 01001000 ~: 1.4182847E-18
  01100001 01011000 01010000 01110110 ~: 2.4939341E20
  00100001 00101101 00110001 01000000 ~: 5.867986E-19
  10100001 10111001 10110011 10000000 ~: -1.2583601E-18
  00100001 01110101 10010011 11000110 ~: 8.3204805E-19
  00100001 00011110 00001101 11111100 ~: 5.355099E-19
  00100001 00100100 01011010 01110010 ~: 5.5685065E-19

Variable 2:
  01100001 00101011 11100000 00110000 ~: 1.9815923E20
  01100001 00100100 11011000 00010000 ~: 1.9005219E20
  01100001 01011000 00110111 11000000 ~: 2.4928212E20
  01100001 00000000 10010101 00000000 ~: 1.4824499E20
  10100001 00101111 10000111 11011110 ~: -5.9472125E-19
  10100001 00001110 10010011 11101110 ~: -4.8307255E-19
  10100001 00111011 10000000 00101110 ~: -6.352771E-19
  10100001 00110010 10101001 01001110 ~: -6.053282E-19

At first glance they may not seem very similar, but remember that the
numbers after the "E" ar the decimal place, they are actually very
close to each other.

I hope that helps,
-ALL
Subject: Re: Indentifying parts of a floating point number
From: mfripp-ga on 20 May 2006 22:06 PDT
 
Since the numbers should be similar, you would expect the
highest-order bits to be similar. With that in mind, it looks to me
like you probably have the byte- order correct (highest order to the
left), but the bit-order reversed. So I would reverse the bit order
within each byte to get this:

Variable 1:
10000100 00001110 10010010 00000011
10000100 10111101 00110101 00000011
10000100 10001011 10110010 00010010
10000110 00011010 00001010 01101110
10000100 10110100 10001100 00000010
10000101 10011101 11001101 00000001
10000100 10101110 11001001 01100011
10000100 01111000 10110000 00111111
10000100 00100100 01011010 01001110

Variable 2:
10000110 11010100 00000111 00001100
10000110 00100100 00011011 00001000
10000110 00011010 11101100 00000011
10000110 00000000 10101001 00000000
10000101 11110100 11100001 01111011
10000101 01110000 11001001 01110111
10000101 11011100 00000001 01110100
10000101 01001100 10010101 01110010

These still don't look like normal 32-bit floating point numbers,
because the exponent (stored in bits 2-9, if you start counting at 1
on the left) varies from 8 to 13 (or -114 to -119 after removing the
bias). This means the biggest numbers would be 2^5=32 times larger
than the smallest numbers, which you are not expecting.

My guess would be that someone has stored decimal numbers as integers.
For example, you could store 2.3245 as 23245, and just remember to
divide by 10000 before you use the number. If your numbers are
interpreted as integers, you get this (in base-ten notation):

Variable 1:
2215547395
2226992387
2223747602
2249853550
2226424834
2241711361
2226047331
2222501951
2216974926

Variable 2:
2262042380
2250513160
2249911299
2248190208
2247418235
2238761335
2245788020
2236388722

These are relatively invariant, which is what you are expecting. Is it
possible that someone started with a floating point value, then
multiplied by 1,000,000,000 and stored it as an integer?

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy