Bruno Haible wrote:
Here's the module for the floorl() function. Very much like the truncl()
function.
Paolo, this replaces the floorl part of the 'mathl' module. I think the
following changes are all improvements:
- Don't assume that LDBL_EPSILON is a power of two. If LDBL_EPSILON
is not a power of two, I think the rounding will be incorrect for
some numbers between 0.5/LDBL_EPSILON and 1.0/LDBL_EPSILON.
- Forbid compiler optimizations: Compilers are allowed to rearrange
y = 1.0L / LDBL_EPSILON + x - 1.0 / LDBL_EPSILON;
into
y = x,
which would obviously break the function.
- In math.h, do a "#define floorl rpl_floorl", in order to avoid
possible undesired compiler optimizations.
No problem, but I wonder what's the rationale for the last item.
Paolo