[racket] Rounding

From: Eli Barzilay (eli at barzilay.org)
Date: Sat Mar 16 21:46:08 EDT 2013

40 minutes ago, Carl Eastlund wrote:
> That's an overly specific solution.  I believe the more general rounding
> function taught in grade-school math would be:
> (define (my-round n)
>   (floor (+ n 1/2)))

If you want 0.5 to round down to 0, then

  (define (my-round n) (ceiling (- n 1/2)))

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the users mailing list.