I am using mocha for testing in nodejs.
The problem is I don't know how to deal with matching nth decimal point precision. For example the following code
value.should.equal((0.8+0.4+1/3)/3)
fails with error message
AssertionError: expected 0.5111111111111111 to equal 0.5111111111111112
+ expected - actual
-0.5111111111111111
+0.5111111111111112
But this is the same stuff for me. How to deal with this precision?
Aucun commentaire:
Enregistrer un commentaire