Skip to content

Commit

Permalink
_cairo_round: Fix documentation
Browse files Browse the repository at this point in the history
Despite what the comment says, this function rounds halfway cases towards
positive infinity.

_cairo_round ( 0.5) => floor ( 1.0) =>  1.0
_cairo_round (-0.5) => floor ( 0.0) =>  0.0
_cairo_round (-1.5) => floor (-1.0) => -1.0

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
  • Loading branch information
Uli Schlachter authored and Chris Wilson committed Nov 7, 2010
1 parent 6383e14 commit 5d5a7d6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cairoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ _cairo_restrict_value (double value, double min, double max)
}

/* C99 round() rounds to the nearest integral value with halfway cases rounded
* away from 0. _cairo_round rounds halfway cases toward negative infinity.
* away from 0. _cairo_round rounds halfway cases toward positive infinity.
* This matches the rounding behaviour of _cairo_lround. */
static inline double cairo_const
_cairo_round (double r)
Expand Down

0 comments on commit 5d5a7d6

Please sign in to comment.