cortex-js / compute-engine

An engine for symbolic manipulation and numeric evaluation of math formulas expressed with MathJSON
https://cortexjs.io
MIT License
356 stars 42 forks source link

When evaluating special inverse trig values, use isEqual rather than isSame #152

Closed dcbradley closed 6 months ago

dcbradley commented 6 months ago

Apparently, my fingers typed isSame() when I was thinking isEqual().

By the way: the comparison is redundant, since the argument to the inverse trig function is compared numerically to the key value and only if that approximately matches does it compare using isEqual(), which may just boil down to the same numerical test. However, I thought it might be best to call isEqual() to express the formal intent to do an exact comparison here. If the philosophy is to allow actual floating point input to match exact values in cases like this, then I think the isEqual() test should be removed.

arnog commented 6 months ago

Ah, I see. I think the test is redundant, comparing with the floating point value is sufficient.

arnog commented 6 months ago

OK, I've removed the test.