I have a case where a floating point precision error generates an 'out of bounds' error. This is from a user of my dxf library (https://github.com/bjnortier/dxf), which uses b-spline to interpolate DXF splines.
Using the parameters in the example I added to test/index.js, when t = 1.0, remapped t and high are:
t -120.35864538112247
high -120.3586453811225
which then generates an error. My proposal in this pull request is to move the bounds check to the beginning of the function (0 <= t <= 1.0), and then clamping the remapped t between "high" and "low".
I have a case where a floating point precision error generates an 'out of bounds' error. This is from a user of my dxf library (https://github.com/bjnortier/dxf), which uses b-spline to interpolate DXF splines.
Using the parameters in the example I added to test/index.js, when t = 1.0, remapped t and high are:
which then generates an error. My proposal in this pull request is to move the bounds check to the beginning of the function (0 <= t <= 1.0), and then clamping the remapped t between "high" and "low".