Description
Hello all,
I've written some special boundary tests for the math.log(x,b) function and found possible bugs. Some or all of these may be trivial ones and some might not be bugs at all. Either way just thought it would bring it to your attention.
From the code, I understood that when two int parameters are entered into the function the answer is calculated by dividing log(number)/log(base). so log(x,b) = log(x)/log(b). This may then point to bugs in the division function. The special boundary tested for both parameters was x >=0. Since that is what an if statement in the overloaded log (x) function checks for.
Attached is my code for the test I wrote with Jest: https://jestjs.io/
General Information -
Version: 5.2.0 (Production) Reproduction Steps:
-Run the function with the same inputs in a js file attached to an HTML document
OR
-To run the test suite... [code.zip]
- Install all needed libraries for node.js and jest
- Unzip the contents of the attached folder into a directory
- Open the terminal
- cd into the directory with files
- run command: "sudo yarn test"
Severity: 4 - trivial Enviroment: Node.js
Bug Description -
First and last failed case - Division of thesame logarithms sometime yeilds answers that are not an integer 1 (one). log(0,0) = log(0)/log(0) = -Infinity/-Infinity = 1 but returns NaN log(-1,-1) = log(-1)/log(-1) = 1.36i/1.36i = 1 (integer) but returns a complex object with real value of 1
2nd and 3rd failed case - Division of a logarithm by a zero in some cases doesn't return NaN (since division by zero) log(0,1) = log(0)/log(1) = -Infinity/0 = NaN but returns -Infinity log(-1,1) = log(-1)/log(1) = 1.36i/0 = NaN but returns complex object with both imaginary and real values as Infinity