Probably this question is already existed somewhere but can't find my specific issue.
I have a two numbers that I want to add and I don't want to use round(number,7)
I user with mathjs and decimal number but still make me crazy
For example
let a = -11.7999997
let b = 11.8
//decimal number
let total = _.round(Decimal.add(a, b).toNumber(), 7)
console.log(total)
//math js
total = _.round(math.add(math.bignumber(a), math.bignumber(b)).toNumber(), 7)
total = 3e-7
console.log(total)
<script src="https://cdnjs.cloudflare.com/ajax/libs/decimal.js/10.0.0/decimal.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjs/11.2.1/math.min.js" ></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js"></script>
both of result are 3e-7 when i sum this two numbers it wrong i do not know why?