Skip to content

Instantly share code, notes, and snippets.

@db
Created May 11, 2012 03:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save db/2657389 to your computer and use it in GitHub Desktop.
Save db/2657389 to your computer and use it in GitHub Desktop.
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);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment