Check if two floats are almost equal in JavaScript