Saturday, 22 August 2015

nerdamer Powers Aug 22 2015

The original this.pow didn't check for edge cases and was written weirdly.

For one of the edge cases 0^0, the original code was:

The code didn't account for symbol1 to be 0 or infinity. The fix only applies to 0. Infinity is another case.......

Modified code:


Now for other other case of (-1)^x being wrong. The original:

I isolated the problem to Math.abs(symbol1.multiplier). Why Math.abs? I have no idea. It just doesn't work if symbol1.multiplier is -1.

Fixed code:


The problem is covert function doesn't account for negative numbers again....

Original convert code:

Math.abs(this.multiplier) is the problem again...

New convert code:

Now that the exponents are fixed... I need to fix the rounding issues.


No comments:

Post a Comment