Re: How to coerce a real to an integer in X?
Re: How to coerce a real to an integer in X?
- Subject: Re: How to coerce a real to an integer in X?
- From: "Bob.Kalbaugh" <email@hidden>
- Date: Fri, 01 Feb 2002 11:44:59 -0500
on 2/1/02 2:48 AM, email@hidden at email@hidden wrote:
>
On Thu, 31 Jan 2002 22:18:58 -0500, "Bob.Kalbaugh"
>
<email@hidden>
>
asked,
>
>
> And what's up with this?
>
>
>
> (3.5)
>
> integer result
>
> --> 4
>
>
>
> (4.5)
>
> integer result
>
> --> 4 (???)
>
>
>
> (5.5)
>
> integer result
>
> --> 6
>
>
>
> (6.5)
>
> integer result
>
> --> 6 (???)
>
>
This is the IEEE Floating Point standard's rounding rules, which are to round
>
a
>
value that is exactly half way between two points so that the resulting least
>
significant digit is even. This way, half the rounding is up, and half the
>
rounding is down, and you have no bias to the error. IEEE Floating Point is
>
how
>
the PowerPC chip is hardwired.
I won't even pretend to understand this. I don't know enough about it to
challenge such a standard. I'll just take it as fact and leave it at that :)
>
The Standard Additions 'round' command provides other options, like "as taught
>
in school", which always round dddd.5 up.
Thank you Scott. Seeing that I didn't mention it, You knew where I was
coming from. I would think that rounding up, also in standard additions,
would be the preferable way to go, because I can't imagine that "as taught
in school" applies to everyone. And it is probably what Mr. Baxter is
referring to when he stated:
>
--John (who doesn't plan to participate further in the week-long thread
>
which will ensue)
Please folks, no debate. I've got the facts and that's good enough for me.
Thanks again guys.
--
Bob.Kalbaugh