# HG changeset patch # User IBBoard # Date 1249816825 0 # Node ID ebc01964a9182d6f2c53d3e01a179de27245576e # Parent a47736adb1e8f60d794d341122b2d30f88acd27f * Add short method to round up or down based on a boolean - useful for compacting rounding up/down calls when they need to be done inline no-open-ticket diff -r a47736adb1e8 -r ebc01964a918 Lang/IBBMath.cs --- a/Lang/IBBMath.cs Sun Jul 05 09:46:12 2009 +0000 +++ b/Lang/IBBMath.cs Sun Aug 09 11:20:25 2009 +0000 @@ -112,5 +112,22 @@ return val; } + + /// + /// Returns the number rounded up or down to the closest whole number. + /// + /// + /// The to round + /// + /// + /// true to round up, else rounds down + /// + /// + /// The rounded + /// + public static double Round(double number, bool roundUp) + { + return (roundUp ? Math.Ceiling(number) : Math.Floor(number)); + } } }