Math Function - fract -

In description of function ‘fract’ on OpenCL Specification (pg. 164), I am not able to understand the second argument to fmin i.e. 0x1.fffffep-1f

As per my understanding it is trying to subtract one from a value just less than 2.0

Any clue !

I think 0x1.fffffep-1f means a number just under 2, divided by 2 (the p means 2^) (which would give you the biggest number just under one: 0.ffffff)

how 0x1.fffffep-1 is different to 0x0.ffffff I’m not sure (not a c programmer), maybe you can’t use a 0 before the . separator and so the 2nd form wouldn’t be valid.

It’s a hexadecimal float constant as supported by C99, and it is indeed the largest number < 1.0 which can be represented as single precision float. It’s probably written with the 1 before the decimal point because that’s how IEEE754 floats are actually stored, with an implicit leading 1 (unless it’s a denormalized number). Then fffffe means all 23 mantissa bits are set to 1.