On Mon, 9 Sep 2019, Tejas Joshi wrote: > Hello. > I am using real_isfinite to check for overflow conditions. How should > I check for underflow? I have tried different ways but they > contradicted other cases to pass.
I think the right check for underflow is: *before* calling exact_real_truncate, if the result is rvc_normal, and the exponent is below the minimum normal exponent for the target format (emin in struct real_format), then there might be underflow - but this is only of concern if it is *also* the case that the result (of rounding to the target format) is inexact (exact underflow can be disregarded for most purposes). (Strictly, there are two kinds of architectures in IEEE 754, "before rounding" and "after rounding". The rules above are for "before rounding" architectures; on "after rounding" architectures, the rule for what counts as underflow is more complicated. The above is safe in all cases and seems better than making GCC need to know exactly which architectures use which underflow rules.) -- Joseph S. Myers jos...@codesourcery.com