-
Notifications
You must be signed in to change notification settings - Fork 39
Description
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.