You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Another issue with power is that it doesn't support negative powers. The solution is just to divide instead of multiply in the power function, but I'd like to fix this issue before fixing negative powers.
This issue has been fixed. The entire loop has been replaced with first^power, second*power.
I tried this solution before, but it was giving incorrect results and I tossed it.
Turns out its correct, but the way I handle numbers was a problem that wasn't run into before.
Before I believed something like {2.5, 1.3}(2.5 * 10^1.3) just needed to be floored to {2.5, 1} and the answer would be correct. This was never a problem because second was never getting decimals.
This new power solution however would give second with a decimal. And because I was just flooring it out, first was wrong and so I thought it was wrong.
Turns out if you want to get rid of the decimal in second, you multiply first by 10^(second % 1). second % 1 will give us just the decimal of second. 25.532 % 1 = 0.532.
Power of 2, 3, etc. will work, but anything like 1.7 or 0.5 will do nothing. This means that sqrt() is actually not working.
I have mostly fixed this, but not quite. I can get decimals of 0.5 to work, 0.5, 1.5, etc. will work. Anything like 0.6 or 0.4 will not however.
The text was updated successfully, but these errors were encountered: