-
I've been using The errors thrown are all the same regardless of the integer input:
The conversions that have caused this underflow error are, e.g.: I'm not too sure what is causing this issue. Is it due to the following line of code below? And why does L244 of bignumber.ts throw an underflow fault if // bignumber.ts
if (typeof(value) === "number") {
if (value % 1) { // why?
throwFault("underflow", "BigNumber.from", value);
}
if (value >= MAX_SAFE || value <= -MAX_SAFE) {
throwFault("overflow", "BigNumber.from", value);
}
return BigNumber.from(String(value));
} Thanks for your help! :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Are you sure those first two are causing underflow? I can use your first two examples and they work fine. The BigNumber class does not handle e-notation (it can be confused with hex too easily, although that might be relaxed in the future). The underflow error you are getting indicates you are passing |
Beta Was this translation helpful? Give feedback.
Are you sure those first two are causing underflow? I can use your first two examples and they work fine. The BigNumber class does not handle e-notation (it can be confused with hex too easily, although that might be relaxed in the future).
The underflow error you are getting indicates you are passing
0.6931471805599453
into it, which is indeed an arithmetic underflow error. Useconsole.log
before your calls toBigNumber.from
To verify you are passing in what you think you are. Hoisting and masking might mean you are calling it with unexpected values.