Q: Can't you just subtract the smallest representable value?
A: No. Floating point numbers are distributed logarithmically, not linearly. Subtracting any fixed value, such as 0.000001, will not affect the large floatand will have excessively large effects for tiny values float.
Q: ... IEEE 754 Float ?
A: "IEEE 754" "Float", , - . 32- .
float IEEE 754 binary32. int32_t float. NaN, -INF.
float nextdown(float x) {
union {
float x;
int32_t i;
} u;
u.x = x;
if (u.i > 0) {
u.i--;
}
else if (u.i < 0) {
u.i++;
}
else {
u.i = 0x80000001;
}
return u.x;
}
NaN. :
float nextdown(float x) {
if (x != x) return x;
union {
float x;
int32_t i;
} u;
...
. OP , <math.h> nextafterf(x,-1.0f/0.0f), . NaN -INF.