Skip to content

Instantly share code, notes, and snippets.

Giorgio Gamberini giorgiogamberini

Block or report user

Report or block giorgiogamberini

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nfreear
nfreear / floating-point-compare.js
Created Jul 4, 2013
Floating point Javascript: less than & greater than comparisons.
View floating-point-compare.js
/*
http://stackoverflow.com/questions/4915462/how-should-i-do-floating-point-comparison
*/
var EPSILON = 0.000001;
function fp_less_than(A, B, Epsilon) {
Epsilon = Epsilon || EPSILON;
return (A - B < Epsilon) && (Math.abs(A - B) > Epsilon);
};
You can’t perform that action at this time.