Math functions (was Re: C optimizer)

Tim Olson tim at crackle.amd.com
Tue Feb 14 15:38:38 AEST 1989


In article <JEFF.89Feb13122608 at stormy.atmos.washington.edu> jeff at stormy.atmos.washington.edu (Jeff L. Bowden) writes:
| Even if the compiler knew something about the math functions (i.e. they are
| not going to do i/o with the user) it still might have to generate the calls.
| I have heard that for math libraries to be IEEE conformant they must round
| up and down on .5 *randomly* with a uniform distribution.  I was floored when
| I heard this.  Anyone know if it is actually true?

P854 only specifies that conforming implementations provide add,
subtract, multiply, divide, square-root, remainder, round-to-integer in
floating-point format, conversions, and comparisons.  For these
operations, the result must be infinitely-precise, modified by the
rounding mode in effect.  There is no "random" rounding mode.  For
"round to nearest" (the default), if the two nearest representable
values are equally near, the one with its least significant bit zero is
delivered. 


	-- Tim Olson
	Advanced Micro Devices
	(tim at crackle.amd.com)



More information about the Comp.lang.c mailing list