Skip to content

Instantly share code, notes, and snippets.

View commel's full-sized avatar

Bernd Ritter commel

View GitHub Profile
@db
db / FloatUtil.hx
Created May 11, 2012 03:41
HaXe Float Precision
class FloatUtil
{
public static function fixedFloat(v:Float, ?precision:Int = 2):Float
{
return Math.round( v * Math.pow(10, precision) ) / Math.pow(10, precision);
}
}