Hi all:
I just read about definitions of Prelude [1], and noticing that.
In 6.4.6 Coercions and Component Extraction, it discribes like this:
round x returns the nearest integer to x, the even integer if x is equidistant
between two integers.
I think this is unresonable. then try it in GHC
On Mon, 27 Oct 2008, L.Guo wrote:
I think this is unresonable. then try it in GHC 6.8.3.
Prelude round 3.5
4
Prelude round 2.5
2
Is there any explanation about that ?
It's the definition we learnt in school ...
I think one reason is that repeated rounding should not be worse than
PROTECTED] On Behalf Of L.Guo
Sent: 27 October 2008 9:49 am
To: MailList Haskell-Cafe
Subject: [Haskell-cafe] Why 'round' does not just round numbers ?
Hi all:
I just read about definitions of Prelude [1], and noticing that.
In 6.4.6 Coercions and Component Extraction, it discribes
Henning Thielemann wrote:
On Mon, 27 Oct 2008, L.Guo wrote:
I think this is unresonable. then try it in GHC 6.8.3.
Prelude round 3.5
4
Prelude round 2.5
2
Is there any explanation about that ?
It's the definition we learnt in school ...
Hmm, Henning, this is strange. The two of us
On Mon, 27 Oct 2008, Janis Voigtlaender wrote:
Henning Thielemann wrote:
On Mon, 27 Oct 2008, L.Guo wrote:
I think this is unresonable. then try it in GHC 6.8.3.
Prelude round 3.5
4
Prelude round 2.5
2
Is there any explanation about that ?
It's the definition we learnt in school ...
(Janis, sorry for e-mailiing just for you on the first time.)
On Mon, Oct 27, 2008 at 8:15 AM, Janis Voigtlaender
[EMAIL PROTECTED] wrote:
That is of course true (and was the topic of heated discussion with my
fourth grade math teacher), but does not explain 2.5 - 2.
If you round to odd
Felipe Lessa wrote:
On Mon, Oct 27, 2008 at 8:15 AM, Janis Voigtlaender
[EMAIL PROTECTED] wrote:
That is of course true (and was the topic of heated discussion with my
fourth grade math teacher), but does not explain 2.5 - 2.
If you round to odd instead of round to even, then 4.5 rounds to
Janis Voigtlaender wrote:
2.4x - x
That's supposed to be 2.4x - 2, of course.
--
Dr. Janis Voigtlaender
http://wwwtcs.inf.tu-dresden.de/~voigt/
mailto:[EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
On Mon, Oct 27, 2008 at 8:30 AM, Janis Voigtlaender
[EMAIL PROTECTED] wrote:
Well, of course I did not learn to round to odd. I learned to round .5
to above, but not to do repeated rounding.
Nobody rounds in passes, of course =). I was talking about two
successive rounds.
In fact, by your
Henning Thielemann wrote:
I think one reason is that repeated rounding should not be worse than
rounding in one go. Consider the rule 'use ceiling when the first
removed digit is 5'. Then
0.45 - (round to one place) - 0.5 - (round to integer) - 1
But repeated rounding *is* worse than
Felipe Lessa wrote:
On Mon, Oct 27, 2008 at 8:30 AM, Janis Voigtlaender
[EMAIL PROTECTED] wrote:
Well, of course I did not learn to round to odd. I learned to round .5
to above, but not to do repeated rounding.
Nobody rounds in passes, of course =).
Oh, Mrs. I forgot her name actually
On Mon, 27 Oct 2008, Janis Voigtlaender wrote:
Henning Thielemann wrote:
I think one reason is that repeated rounding should not be worse than
rounding in one go. Consider the rule 'use ceiling when the first removed
digit is 5'. Then
0.45 - (round to one place) - 0.5 - (round to integer)
Janis Voigtlaender [EMAIL PROTECTED] writes:
If you round to odd instead of round to even, then 4.5 rounds to 5,
Well, of course I did not learn to round to odd. I learned to round .5
to above, but not to do repeated rounding.
Since just about every floating point operation involves some
Am Montag, 27. Oktober 2008 11:46 schrieb Henning Thielemann:
On Mon, 27 Oct 2008, Janis Voigtlaender wrote:
Henning Thielemann wrote:
I think one reason is that repeated rounding should not be worse than
rounding in one go. Consider the rule 'use ceiling when the first
removed digit is
On Mon, 27 Oct 2008, Daniel Fischer wrote:
Am Montag, 27. Oktober 2008 11:46 schrieb Henning Thielemann:
On Mon, 27 Oct 2008, Janis Voigtlaender wrote:
Henning Thielemann wrote:
I think one reason is that repeated rounding should not be worse than
rounding in one go. Consider the rule 'use
Ketil Malde wrote:
Janis Voigtlaender [EMAIL PROTECTED] writes:
If you round to odd instead of round to even, then 4.5 rounds to 5,
Well, of course I did not learn to round to odd. I learned to round .5
to above, but not to do repeated rounding.
Since just about every floating point
2008/10/27 Janis Voigtlaender [EMAIL PROTECTED]:
Janis Voigtlaender wrote:
2.4x - x
That's supposed to be 2.4x - 2, of course.
Ah, damn it. I was hoping for a long discussion on just what math
would look like with rounding like that ;-)
/M
--
Magnus Therning
It is certainly what I learnt in school. But that was another school.
On Mon, Oct 27, 2008 at 12:15 PM, Janis Voigtlaender
[EMAIL PROTECTED] wrote:
Henning Thielemann wrote:
On Mon, 27 Oct 2008, L.Guo wrote:
I think this is unresonable. then try it in GHC 6.8.3.
Prelude round 3.5
4
Lennart Augustsson wrote:
It is certainly what I learnt in school. But that was another school.
Hmm, on reflection, taking Neil's explanation into account and the fact
that this rounding mode was referred to as banker's rounding, the
point may be that it was not only another school, but
I can't remember the method being called anything.
It was just what we were being taught. With the obvious explanation
that .5 is right in the middle so always going one way would introduce
a bias. This was circa 1969.
On Mon, Oct 27, 2008 at 3:30 PM, Janis Voigtlaender
[EMAIL PROTECTED]
Lennart Augustsson wrote:
I can't remember the method being called anything.
It was just what we were being taught. With the obvious explanation
that .5 is right in the middle so always going one way would introduce
a bias. This was circa 1969.
Well, I wasn't serious about the political
On Mon, Oct 27, 2008 at 9:48 AM, L.Guo [EMAIL PROTECTED] wrote:
Hi all:
I just read about definitions of Prelude [1], and noticing that.
In 6.4.6 Coercions and Component Extraction, it discribes like this:
round x returns the nearest integer to x, the even integer if x is
equidistant
On Mon, Oct 27, 2008 at 1:37 PM, Lennart Augustsson
[EMAIL PROTECTED] wrote:
I can't remember the method being called anything.
It was just what we were being taught. With the obvious explanation
that .5 is right in the middle so always going one way would introduce
a bias. This was circa
[1] The Haskell 98 Report: Predefined Types and Classes
http://haskell.org/onlinereport/basic.html
This behaviour is not what I expect after reading the description at
http://haskell.org/ghc/docs/latest/html/libraries/base/
Prelude.html#v:round
. Given that this behaviour has caused a bit
On 2008 Oct 27, at 6:00, Henning Thielemann wrote:
On Mon, 27 Oct 2008, L.Guo wrote:
I think this is unresonable. then try it in GHC 6.8.3.
Prelude round 3.5
4
Prelude round 2.5
2
Is there any explanation about that ?
It's the definition we learnt in school ...
Maybe you did; I learned
Janis Voigtlaender [EMAIL PROTECTED] writes:
Since just about every floating point operation involves some sort of
loss of precision, repeated rounding is a fact of life.
Of course. But that was not the point of the discussion...
Well, allow me to contribute to keeping the discussion on
Ketil Malde wrote:
Janis Voigtlaender [EMAIL PROTECTED] writes:
Since just about every floating point operation involves some sort of
loss of precision, repeated rounding is a fact of life.
Of course. But that was not the point of the discussion...
Well, allow me to contribute to
This behaviour is not what I expect after reading the description at
http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:round
. Given that this behaviour has caused a bit of confusion I think a
change to the documention might be in order.
The authority here is the report
Ketil Malde wrote:
Of course, Haskell should discard the rather tasteless IEEE754 crud,
and do its calculations on infinite streams of digits. Then, rounding
upwards after 'take'ing a sufficient amount of decimals will be the
right thing to do.
Except arbitrary-precision real arithmetic is
It's well known from numerical analysis that you can achieve the best
general behavior by rounding to even in half the cases, and rounding
to odd in half the cases. It's usually deterministic by looking at
the digit to the right of the round point.
Regards,
John A. De Goes
N-BRAIN, Inc.
L.Guo wrote:
Hi all:
I just read about definitions of Prelude [1], and noticing that.
In 6.4.6 Coercions and Component Extraction, it discribes like this:
round x returns the nearest integer to x, the even integer if x is equidistant
between two integers.
I think this is unresonable.
On Mon, 27 Oct 2008, Ketil Malde wrote:
Of course, Haskell should discard the rather tasteless IEEE754 crud,
and do its calculations on infinite streams of digits. Then, rounding
upwards after 'take'ing a sufficient amount of decimals will be the
right thing to do.
When I implemented just
On Mon, 27 Oct 2008, Janis Voigtlaender wrote:
Lennart Augustsson wrote:
I can't remember the method being called anything.
It was just what we were being taught. With the obvious explanation
that .5 is right in the middle so always going one way would introduce
a bias. This was circa 1969.
G'day all.
Quoting Mitchell, Neil [EMAIL PROTECTED]:
With rounding to the nearest even integer for 0.5's you get 6, otherwise
if you always round up you get 7. If you bias towards rounding up you
get a general upwards trend as numbers are rounded, which is bad, while
the even condition ensures
G'day all.
Henning Thielemann suggested:
In measured data the .5-case should be very rare - a null set?
However I assume that .5 happens more often in practice - because of
prior rounding, which was shown to be bad practice in this thread.
The usual case in floating point is usually not
On 27 Oct 2008, at 11:00 pm, Henning Thielemann wrote:
On Mon, 27 Oct 2008, L.Guo wrote:
I think this is unresonable. then try it in GHC 6.8.3.
Prelude round 3.5
4
Prelude round 2.5
2
Is there any explanation about that ?
It's the definition we learnt in school ...
Check
On 28 Oct 2008, at 11:11 am, Henning Thielemann wrote:
In measured data the .5-case should be very rare - a null set?
However I assume that .5 happens more often in practice - because of
prior rounding,
Think about money.
When I was a child, farthings (1/4 of a penny) had just been
dropped.
37 matches
Mail list logo