Closed wmgrove closed 9 months ago
If I had to assume, your func call for exponents only accepts integers, and should probably be changed. If that is unreasonable, you would at least get a more accurate result if you took the decimal remainder, and multiplied the previous result by the nth root of the starting number where n is the reciprocal of the decimal, though this would likely suffer from having a decimal itself.
Issue begins on line 286 of Calculator.kt, where you explicitly truncate to an integer
Also, you make the result infinity if the power is 10000 or so, however, this will cause errors when x is -1 <= x <= 1
After further research, kotlin specifically allows non-integers as arguments in the pow function
Partially fixed (https://github.com/Darkempire78/OpenCalc/commit/6efcee90b9ece58b61502c4211711a2afff149e6). Negative float exponents still cause issues
Fixed in the latest v3-beta3
Describe the bug App does not accurately calculate the power of a number if that number is not an integer, specifically, it truncated to the nearest integer.
To Reproduce Steps to reproduce the behavior:
Expected behavior Steps 2 and 3 above should return approximately 11.314, not 8.
Smartphone (please complete the following information):