I did not do any more work as I do not know, what is the preferred way. I would see three options:
- Leave it as it is: use Javascript's internal functions (if qalculate is not present, else use that). Then I would suggest the above patch (or similar) to round to less digits to avoid some rounding problems.
- Make qalculate a dependency and always use that.
- Do exact calculations for floating point numbers (convert them to base10-fractions. Then all calculations without functions like sin, log, … are integer calculations, which can be done exactly; in the end put a point at the right place in the integer). Then qalculate would not be a dependency, but some functionality of qalculate would be implemented here.