Math functions (was Re: C optimizer)
Norman Diamond
diamond at diamond.csl.sony.junet
Wed Feb 15 11:05:01 AEST 1989
news at beaver.cs.washington.edu 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?
'fraid I don't know if it's true, but if it is, the IEEE should send someone
back to school for grade 9 arithmetic. (So should many other organizations
though.)
xxxxx.5 should be rounded to an EVEN number, xxxxx or xxxxx+1 (all of these
numbers scaled by whatever exponent). In binary, .bbbb01 becomes .bbbb0 and
.bbbb11 becomes .cccc0 where .cccc0 == .bbbb0 + .00010 (and if there is an
overflow, then the 1.cccc gets shifted down).
> "Security and Liberty are at war. Which side are you on?"
I'm on each person's side. If you want security, feel free to do your best,
but don't interfere with someone else's liberty, as long as they don't inter-
fere with yours....
Norman Diamond, Sony Computer Science Lab (diamond%csl.sony.jp at relay.cs.net)
The above opinions are my own. | Why are programmers criticized for
If they're also your opinions, | re-inventing the wheel, when car
you're infringing my copyright. | manufacturers are praised for it?
More information about the Comp.lang.c
mailing list