[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ROUNDing



    Date: Thu, 27 Jun 1991 11:44-0400
    From: JGA@alderaan.scrc.symbolics.com (John G. Aspinall)

	Date: Thu, 27 Jun 1991 05:29 EDT
	From: kddlab!atr-la.atr.co.jp!myers@uunet.UU.NET (John K. Myers)

	What is the rationale for having ROUND round to the nearest
	even integer on a .5 boundary, instead of rounding down in every case?
	Does it make it easier to implement?  Not rounding down
	creates beat frequencies in my numeric representations.
	I'd vote for having the standard changed next time.
	Unless, is there a graphics application or something that likes
	having ROUND wobble?

    The behaviour of ROUND is determined by the IEEE standard on
    floating-point operations.  The rationale behind the standard is, in
    turn, that rounding should be unbiased in a statistical sense.

Also, if you genuinely want to round down in all cases, you can always
say
  
  (FLOOR (+ X 0.5))	; Or (+ x 0.5d0) or (+ X 1/2), as appropriate.
or
  (TRUNCATE (+ X 0.5))

as appropriate.