Failed Special Boundary Tests with math.log()
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 15.1k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
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
Results Report:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the attached Jest test suite from code.zip in the Node.js environment and inspect the math.log(x, b) entry point. Compare the reported boundary cases for zero, negative values, and base one with the project's intended behavior; done means the expected results are established and the failing cases are covered by passing regression tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- backend, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100