are trigonometric function broken ?
- Dominant language
- JavaScript
- Stars
- 15.1k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
hello, every trigonometric functions seems to trigger a precision limit exceeded error from decimal.js
in console of https://mathjs.org/, execute this
```
var math_cfg = {
number: "BigNumber",
precision: 509,
relTol: 1e-320,
absTol: 1e-323
}
math.config(math_cfg);
math.evaluate('tan(pi/2)')
```
decimal.mjs:3164 Uncaught Error: [DecimalError] Precision limit exceeded
at Ct (decimal.mjs:3164:32)
at Ut (decimal.mjs:3762:10)
at yt.sine.yt.sin (decimal.mjs:1700:18)
at yt.tangent.yt.tan (decimal.mjs:1836:9)
at Complex | BigNumber (tan.js:36:35)
at tan (typed-function.js:1465:22)
at FunctionNode.js:203:24
at Object.evaluate (Node.js:54:16)
at Object.string (evaluate.js:49:36)
at Object.evaluate (typed-function.js:1459:22)
Contributor guide
Research direction
Start by reproducing the reported math.evaluate('tan(pi/2)') case with the shown BigNumber configuration in the mathjs console. Trace the failure through tan.js and the decimal.mjs stack frames, using typed-function.js and FunctionNode.js as needed. Done means the reported trigonometric evaluation no longer raises the precision-limit exception, with regression coverage for the reproduced configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100