Hexadecimal floating point

Apparently, 0x1.0p-24f is a valid floating-point literal in Java (I didn’t know). What’s the Scala equivalent?

I don’t recall this ever being raised before.

For anyone wondering (like me) what the hell that even means, here’s the relevant JLS section.

If I needed this I suppose I’d:

scala 2.13.8> java.lang.Float.valueOf("0x1.0p-24f")
val res1: Float = 5.9604645E-8
2 Likes