Fix for truncated instead of rounded results
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: //while (bcmath.isdigit(str[ptr])) while((ptr<str.length) && ((str[ptr]) % 1 === 0)) { //bcmath.isdigit(str[ptr])) { ptr++; digits++; /* digits */ } if((ptr<str.length) && (str[ptr] === '.')) { ptr++; /* decimal point...
Of course, the ptr then doesn't have to be incremented inside the loop anymore. for(;ptr < str.length;++ptr) { //bcmath.isdigit(str[ptr])) { //ptr++; strscale++; /* digits */ }
Fix for Undefined Property warning