IEEE floating-point...

David Stewart 249-4502 room 134 uunet!thrain.anu.edu.au!des
Thu Apr 1 15:10:29 PST 1993



Doug Gwyn <gwynaBRL.MIL> writes
[stuff deleted]
>> I think it would be useful for the C binding to 754 to impose tighter
>> constraints in SOME areas, for example requiring the math functions to
>> return values that are close to the mathematically right answers.  But,
>> for example, I don't think the programmer needs to be able to specify
>> rounding modes because for that to make sense he will also need to be

As a numerical analyst, I ** would ** like to see some sort of standard for
setting rounding modes, at least for arithmetic operations.  Otherwise
there is no way of writing a portable
(or possibly no way at all of writing a) library for interval arithmetic
(unless you write your own arithmetic operations).

>> able to force expression evaluation order to some well-defined choice
>> which the C standard doesn't currently impose, and in adding requirements
>> like that one runs a significant risk of badly breaking the C language spec.

Rounding modes don't have to be set ** within ** expressions.
I think the point is that you should at least be able to turn rounding
up/down on and off for particular statements.

Rounding modes would not change the ** order ** of evaluation, but it would
prevent re-arranging sub-expressions involving taking things out of one
sub-expression and putting it in another.  But this is part of ANSI C
anyway; see K&R2, ARM p.200, sect A7, para 2

"However, each operator combines the values produced by its operands in a
way compatible with the parsing of the expression in which it appears."

and follows this with an annotation saying that it ** does ** affect the
freedom in K&R1 to ".. reorder expressions with operators that are
mathematically ... associative but fail to be computationally associative."
------------------------------------------------------------------------
David Stewart			Program in Advanced Computation
desathrain.anu.edu.au		School of Mathematical Sciences
				Australian National University



More information about the Numeric-interest mailing list