numbers / numbers.js

Advanced Mathematics Library for Node.js and JavaScript
Apache License 2.0
1.76k stars 168 forks source link

Change the distance (delta) between two points to calculate a derivative at a point. #29

Closed swairshah closed 11 years ago

swairshah commented 11 years ago

Using two points at distance 2*Number.MIN_VALUE won't work, as a +/- Number.MIN_VALUE = a

This commit uses 1e-15 instead of Number.MIN_VALUE.

That's the highest precision we can get. without using an external library in javascript (possible option is to use bignum lib)

ethanresnick commented 11 years ago

You're right; forgot about a + Number.MIN_VALUE = a.