J3/97-260 Date: November 12, 1997 To: J3 From: Tony Warnock Subject: Per Operation Rounding Modes Per operation rounding is one of the six features suggested in order to support intervals as a user-defined type. This feature is also useful in and of itself. Some hardware exists that supports changing the rounding mode on an instruction by instruction basis. Other hardware is unable to switch rounding modes quickly. Both kinds of system can possibly generate more efficient code with this source construct. There are many possibilities for the form of such operators. Some of these are illustrated below. The illustrations show encodings of the Fortran expression: (Sqrt(b**2-4*a*c)+b)/(2*a) 1. ( sqrt_up ( b .**up. 2 .-down. 4 .*up. a .*up. c ) .+down. b ) ./up. ( 2 .*down. a ) 2. ( sqrt_up ( b .**^. 2 .- . 4 .*^. a .*^. c ) .+ . b ) ./^. ( 2 .* . a ) 3. ( sqrt_up ( b **^ 2 - 4 *^ a *^ c ) + b ) /^ ( 2 * a ) 4. ( sqrt_up ( b **/ 2 -\ 4 */ a */ c ) +\ b ) // ( 2 *\ a ) 5. divide_up (sqrt_up (minus_down (power_up(b, 2), multiply_up(4, a, c))), multiply_down(2, a))