Fix for Undefined Property warning
Status: Beta
Brought to you by:
lmeyrick
https://sourceforge.net/p/bcmath-js/code/HEAD/tree/src/libbcmath.js#l154
Line 154 will throw an "undefined property" warning to the browser console, since the last repetition of the while loop will check for an out-of-range ptr index in str.
while ((str[ptr]) % 1 === 0)
Easy fix, just use a range-limited for loop instead, works a treat.
for(; ptr<str.length; ++ptr)
Cheers
Of course, the ptr then doesn't have to be incremented inside the loop anymore.
I just noticed that there will be more "undefined property" warnings if no decimal point is used, i.e. when multiplying 10 and 10 instead of 10.0 and 10.0 ... the following snippet takes care of everything, including the original issue mentioned above, replace lines 144 - 157 with this: