Re: Haskell 98 draft report

1998-12-22 Thread Matthew Donadio

Hans Aberg wrote:
 Thinking of it, "round" should probably be viewed as a method to convert a
 float to another float of less precision (and not a conversion to an
 integer)

To be picky, rounding a fixed point value to less bits is a very common
procedure (at least it is in the DSP world) to acount for bit-growth in
an algorithm.

--Matt Donadio ([EMAIL PROTECTED])





RE: Haskell 98 draft report

1998-12-21 Thread Simon Peyton-Jones

 p. 83 'Coercions and Component Extraction'
 I find it quite odd that round 3.5 returns 4, but round 2.5 returns 2.
 I always thought that round x.5 returns x+1 (instead of the 
 even integer).
 That's the behaviour in most math books and programming languages

It looks odd to me too.   I think this is just taken from some other
standard, so I don't propose to alter it.


Can anyone shed light?

Simon





Re: Haskell 98 draft report

1998-12-21 Thread Keith Wansbrough

  p. 83 'Coercions and Component Extraction'
  I find it quite odd that round 3.5 returns 4, but round 2.5 returns 2.
  I always thought that round x.5 returns x+1 (instead of the 
  even integer).
  That's the behaviour in most math books and programming languages
 
 It looks odd to me too.   I think this is just taken from some other
 standard, so I don't propose to alter it.
 
 
 Can anyone shed light?

This is generally considered the most accurate kind of rounding, since it 
avoids cumulative errors.  If you get lots of values on the 0.5 boundary, 
`round up' gives you an error of +0.5 for each, whereas round-to-even gives 
you a mean error of zero.

I think IEEE floating point does this by default for its basic operations.

--KW 8-)
-- 
: Keith Wansbrough, MSc, BSc(Hons) (Auckland) :
: PhD Student, Computer Laboratory, University of Cambridge, England. :
:  (and recently of the University of Glasgow, Scotland. [] )   :
: Native of Antipodean Auckland, New Zealand: 174d47' E, 36d55' S.:
: http://www.cl.cam.ac.uk/users/kw217/  mailto:[EMAIL PROTECTED] :
:-:



-- 
: Keith Wansbrough, MSc, BSc(Hons) (Auckland) :
: PhD Student, Computer Laboratory, University of Cambridge, England. :
:  (and recently of the University of Glasgow, Scotland. [] )   :
: Native of Antipodean Auckland, New Zealand: 174d47' E, 36d55' S.:
: http://www.cl.cam.ac.uk/users/kw217/  mailto:[EMAIL PROTECTED] :
:-:



-- 
: Keith Wansbrough, MSc, BSc(Hons) (Auckland) :
: PhD Student, Computer Laboratory, University of Cambridge, England. :
:  (and recently of the University of Glasgow, Scotland. [] )   :
: Native of Antipodean Auckland, New Zealand: 174d47' E, 36d55' S.:
: http://www.cl.cam.ac.uk/users/kw217/  mailto:[EMAIL PROTECTED] :
:-: