Naruyoko / OmegaNum.js

A huge number library holding up to 10{1000}9e15. A basement for planned {10,x,1,2}.
https://naruyoko.github.io/OmegaNum.js/index.html
MIT License
32 stars 15 forks source link

surprising exception in mul #5

Closed Patashu closed 5 years ago

Patashu commented 5 years ago
OmegaNum.mul("ee99999999999999", "eee15").toString()
"e1e1000000000000000"
OmegaNum.mul("ee999999999999999", "eee15").toString()
OmegaNum.html:238 Uncaught TypeError: x.div(...).max is not a function
    at OmegaNum.P.plus.P.add (OmegaNum.html:238)
    at OmegaNum.P.times.P.mul (OmegaNum.html:289)
    at Function.Q.times.Q.mul (OmegaNum.html:292)
    at <anonymous>:1:10
OmegaNum.mul("eee15", "eee15").toString()
"e1.7782794100389228e1000000000000000"
Decimal.mul("ee999999999999999", "eee15").toString()
"ee1000000000000000"
OmegaNum.mul("eee15", "eee15").toString()
"e1.7782794100389228e1000000000000000"

It seems like the bug is in div specifically:

OmegaNum.div("e999999999999999", "ee15")
ƒ (){
    return OmegaNum(this);
  }
Naruyoko commented 5 years ago

Well, someone forgot a parenthesis after clone.

Naruyoko commented 5 years ago

α 1.0.1

Patashu commented 5 years ago

This is now fixed!