firmata.js icon indicating copy to clipboard operation
firmata.js copied to clipboard

encodeCustomFloat: "must encode custom floats when they are less than 1" is failing

Open rwaldron opened this issue 5 years ago • 4 comments

@dtex I don't understand this failure :|

1) Numeric encoding/decoding and formatting
       must encode custom floats when they are less than 1:

      AssertionError: expected Array [ 69, 2, 0, 20 ] deepEqual Array [ 79, 46, 70, 5 ]
      + expected - actual

       [
      -  69
      -  2
      -  0
      -  20
      +  79
      +  46
      +  70
      +  5
       ]

rwaldron avatar Dec 28 '19 00:12 rwaldron

This appears to only occur locally for me 🤷🏼‍♂️

rwaldron avatar Dec 28 '19 03:12 rwaldron

I'm able to replicate in node 12, but works fine in node 10. I can't imagine what has changed but I'll dig into it.

dtex avatar Dec 28 '19 19:12 dtex

Tired: Off by 1 errors Wired: Off by 0.00000000000000000001 errors

Here's the scoop:

In node 10:

Math.pow(10, -4) === 0.0001

but in node 12

Math.pow(10, -4) === 0.00009999999999999999

Appears to be this issue which will be fixed by this commit and will eventually make its way to node.js. If we need to, we can comment out that test for now, or we could just leave this issue open and findable until node has the corrected version of v8.

dtex avatar Dec 28 '19 22:12 dtex

Thanks for checking into that! I say we take no action on our end and leave this open for folks to easily find.

rwaldron avatar Jan 06 '20 14:01 rwaldron