assert.equals problem when testing float

5 views
Skip to first unread message

Rusty Roy

unread,
Mar 7, 2016, 10:55:17 AM3/7/16
to Buster.JS
[assert.equals] 75.1622105380915 expected to be equal to 75.16221053809151

I get the above failure when trying to test a method that returns a float value (using browser test, not node). Is there something special that needs to be done when checking floats? Or just put a toFixed on the test value and expected value?

Christian Johansen

unread,
Mar 7, 2016, 2:50:29 PM3/7/16
to Buster.JS
toFixed sounds like a reasonable solution!

man. 7. mar. 2016 kl. 16.55 skrev Rusty Roy <shower...@hotmail.com>:
[assert.equals] 75.1622105380915 expected to be equal to 75.16221053809151

I get the above failure when trying to test a method that returns a float value (using browser test, not node). Is there something special that needs to be done when checking floats? Or just put a toFixed on the test value and expected value?

--
You received this message because you are subscribed to the Google Groups "Buster.JS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to busterjs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages