Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FlxMath: use fround() to fix roundDecimals() precison, closes #2126 #2127

Merged
merged 5 commits into from
Mar 22, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions flixel/math/FlxMath.hx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class FlxMath
{
mult *= 10;
}
return Math.round(Value * mult) / mult;
return Math.fround(Value * mult) / mult;
}

/**
Expand Down Expand Up @@ -276,7 +276,7 @@ class FlxMath
* @param stop2 Upper bound of the value's target range
* @return The remapped value
*/
public static function remapToRange(value:Float, start1:Float, stop1:Float, start2:Float, stop2:Float)
public static function remapToRange(value:Float, start1:Float, stop1:Float, start2:Float, stop2:Float):Float
{
return start2 + (value - start1) * ((stop2 - start2) / (stop1 - start1));
}
Expand Down