From What is the precision of highp floats in GLSL ES 2.0 (for iPhone/iPod touch/iPad)? ...

I get, for instance, on the iPhone 5S, that highp float has a precision of "23". From the documentation (p. 33, section 4.5.2 — https://www.khronos.org/files/opengles_shading_language.pdf ), I'm interpreting that as "the difference between two floating point numbers is at least 2^-23, which is 1.1920929e-7. But I'm fairly confident I'm not understanding that correctly, because I think I've got it calculating differences that are smaller than that by two or three orders of magnitude (and crapping out beyond that).

Am I just getting lucky with my calculations, or am I misunderstanding the value?

"The difference between two floating point numbers is at least 2^-23" isn't quite correct.

From the documentation: "If the smallest representable value greater than 1 is 1+∊ then floor(-log₂(∊)) is returned in `precision`."

So, what that means for you is that in your environment, the next representable number after 1 is (1+2^-23). This is not quite the same thing as saying that epsilon is always 2^-23 because floating point precision is nonlinear - the difference between nearest representable values depends on the magnitude of the values. If you read that article (which I recommend), note in particular the increase in density of representable values around zero, especially if the encoding permits denorms.

Top