Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect values returned for certain exponentiation operations #103

Open
ArashPartow opened this issue Nov 28, 2024 · 0 comments
Open

Incorrect values returned for certain exponentiation operations #103

ArashPartow opened this issue Nov 28, 2024 · 0 comments

Comments

@ArashPartow
Copy link

ArashPartow commented Nov 28, 2024

SpeedCrunch provides incorrect results for certain values of exponentiation. In short should be returning a NaN, but instead returns a real value.

SpeedCrunch Version: 0.12

Expression: (-13)^(1/3)
1. Speedcrunch :  -2.3513346877207574895
2. wolframalpha: https://www.wolframalpha.com/input?i=%28-13%29%5E%281%2F9%29

Expression: (-13)^(1/9)
1. Speedcrunch : -1.32975454563978597291
2. wolframalpha: https://www.wolframalpha.com/input?i=%28-13%29%5E%281%2F9%29

Expression: (-13)^(1/27)
1. Speedcrunch : -1.0996567925533755264
2. wolframalpha: https://www.wolframalpha.com/input?i=%28-13%29%5E%281%2F27%29

Expression: (-13)^(1/3.123)
1. Speedcrunch : -2.27347485100383238372
2. wolframalpha: https://www.wolframalpha.com/input?i=%28-13%29%5E%281%2F3.123%29

Expression: (-13)^(1/9.123)
1. Speedcrunch : -1.32465488702830785593
2. wolframalpha: https://www.wolframalpha.com/input?i=%28-13%29%5E%281%2F9.123%29

Expression: (-13)^(1/27.123)
1. Speedcrunch : -1.09918315510346486963
2. wolframalpha: https://www.wolframalpha.com/input?i=%28-13%29%5E%281%2F27.123%29

It seems when the base value is negative and that only for truncated integer powers of three when the result should be NaN (due to it being complex), SpeedCrunch returns the "signed" length of radius in polar coordinates, for other exponents it seems to correctly return NaN when required to do so.

Furthermore, the value returned is not reversible. Meaning if raised to the reciprocal of the power it returns NaN. Presumably the rule here would be, that if a non-NaN value is returned, then it should be reversible by the reciprocal of the power.

Rule: If A^B is C, then C^(1/B) must be equal to A, where equal would be to within some absolute and relative epsilon, and assuming A, B and C are not NaN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant