>Is this output standard conforming?
Yes.
>PROGRAM ieee_rounding_test
> USE, INTRINSIC :: ieee_arithmetic
> PRINT*, ieee_support_rounding(ieee_down)
> PRINT*, ieee_support_rounding(ieee_up)
> call ieee_set_rounding_mode(ieee_down)
> x1 = SIN(2.4)
> call ieee_set_rounding_mode(ieee_up)
> x2 = SIN(2.4)
> PRINT '(L2,2F12.9,A)', x1==x2, x1, x2, " (True value: 0.67546318...)"
>END PROGRAM ieee_rounding_test
>
>I would like to implement an interval arithmetic module based
>on 'ieee_set_rounding_mode' but it looks like a bad idea...
Not necessarily a bad idea, just more work than you thought it was.
>I did hope that x2 would be larger or equal the true value of SIN(2.4).
You ought not to have expected that.
IEEE rounding mode affects the four basic arithmetic operations.
It does not magically change the intrinsic functions so that they start
computing maxima/minima on an interval (Hint: you need to use different
approximation polynomials for that).
So to do interval arithmetic you need to rewrite the intrinsic functions, not
just reuse the existing polynomial approximations with rounding mode changes.
The same applies to user code - if the user code has used an approximation
to a function, just changing all the floating-point numbers to intervals does
not result in the correct interval function.
Cheers,
--
...........................Malcolm Cohen, NAG Ltd., Oxford, U.K.
([log in to unmask])
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|