Can you explain the arithmetic you did to get that results?
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
Can you show how you got C.E6666 from 12.9? I see where the C came from. What about the E6666?
Also can you show what the HEX STRING of 1234.678 would be?
java function/library to convert a floating point to a a floating point hexadecimal.
What is the problem with the Float class's toHexString method?
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
decimal 12.9 is equivalent to C.E6666
Please explain how you get that value. This is the third time I have asked this question.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
Now floating part: 0.9
160.9= 14.4, integer part= 14 =E in hex
160.4= 6.4, int part= 6 = 6 in hex
16*0.4= 6.4, same 6 in hex
contd upto 5 places
to get E6666
That makes no sense to me. How does 0.9 become E6666? Your explanation leaves out some stuff.
What is this: 160.9 = 14.4??? where did the 160.9 come from? What operation do you do on that amount to get 14.4?
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
I think I see now. The digits to the right of the decimal point are 1/16^x where x goes from 1 to n as the digits go to the right.
Converting E666 to decimal would give: 14/16 + 6/256 + 6/4096 + 6/65536 = 0.899993896484375
If you have the algorithm for converting a float to that format, what is your question? Where are you having problems writing the code?
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
Sorry,I don't know of any such methods in java SE.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16