Converting floor to rint

Gabriel Dos Reis gdr@integrable-solutions.net
Thu Nov 7 06:23:00 GMT 2002


Andreas Schwab <schwab@suse.de> writes:

| Gabriel Dos Reis <gdr@integrable-solutions.net> writes:
| 
| |> "may" part refers to the fact  whether the programmer might want
| |> to run rint() under a particular floating-point control mode that
| |> would permit rint() to raise the inexact exception.
| |> rint() cannot unconditionally set it. If FENV_ACCESS is on and
| |> FE_INEXACT is supported then rint() should raise the exception if
| |> appropriate. That is my understanding.
| 
| If the implementation defines __STDC_IEC_559__ then F.9.6.4 applies.  I
| have no copy of IEC 60559, but if it states that rint must raise the
| exception then it must do it independent of FENV_ACCESS.

My concern is this:

       F.7.1  Environment management

       [#1]   IEC 60559  requires  that  floating-point  operations
       implicitly raise floating-point exception status flags,  and
       that  rounding control modes can be set explicitly to affect
       result values of floating-point operations.  When the  state
       for  the FENV_ACCESS pragma (defined in <fenv.h>) is ``on'',
       these changes to the floating-point  state  are  treated  as
       *side effects* which respect sequence points.304)

(my emphasis)

| Otherwise, if
| __STDC_IEC_559__ is not defined, then no requirements on the exceptions
| are stated for rint, since 7.12.9.4 does not have a "shall".

Agreed.

-- Gaby



More information about the Gcc-patches mailing list