on-internet
← Community

Round down operation result in IEEE 754

Stack Overflow ·

For operations using single precision values in IEEE 754 (float, 32bit), is there a way to somehow condition the two operands to ensure that the operation result is rounded down, when an exact result is not possible? In other words, how can I force round to -Inf? Example: Typical result (using 'round to nearest'): 1.0f / 3.0f = 0.3333333432674407958984375f Expected result (using 'round down'): 1.0f / 3.0f = 0.333333313465118408203125f As additional info, I would be doing this in C99, and (unfortunatly) it's not possible to configure the FPU.

Comments

Sign in or sign up to comment and upvote.

No comments yet.