0

I'm trying to edit a smali file in smali itself. I do however have the corresponding java file.

comparing the code

I'm trying to figure out why a 15.0F in java is 0x4170 in smali? Isn't 0x4170 in decimal = 16752?

Code: java, smali

laggingreflex
  • 32,948
  • 35
  • 141
  • 196

1 Answers1

6

Yes. See http://babbage.cs.qc.cuny.edu/IEEE-754.old/Decimal.html

15.0f = 0x41700000 as a 32-bit IEEE-754 floating point number. The value 0x4170 would seem to imply 16-bit floats, which wouldn't have enough precision to be useful.

For completeness, 15.0d (64-bit float) is 0x402E000000000000.

Jim Garrison
  • 85,615
  • 20
  • 155
  • 190
  • 1
    +1 and the high-16 bits is 0x4170. By setting the top 16-bit to be 4170 it may be implying the low 16-bit is 0000 and thus a more compact form. Imagine the 64-bit value could be set using the high-16 bits 402E, it would be much smaller. – Peter Lawrey Oct 06 '13 at 08:48