-
Notifications
You must be signed in to change notification settings - Fork 1
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
LTA and wrong results when using rational exponents #5439
Comments
From @titsukiSee the following results $ perl6 -e 'say -1 ** -0.1' My Perl 6 version is |
From @titsukiSorry "negative integers with negative decimal exponents" is the correct expression. On 2016-7月-09 土 05:19:49, cookbook_000@yahoo.co.jp wrote:
|
From @pmichaudOn Sat, Jul 09, 2016 at 05:19:49AM -0700, Itsuki Toyota wrote:
This is not a bug in "reduce" itself. Exponentiation has higher $ ./perl6 -e 'say -1 ** -0.1' So, the reduce subroutine is doing exactly the same thing as &infix:<**> here does with a negative base. At the moment I'm inclined to believe that a negative integer with Pm |
The RT System itself - Status changed from 'new' to 'open' |
From @zoffixznetFirst a bit of deconfusion: negative exponents just mean x⁻² = 1/x². That works just fine and is not relevant to this ticket: <ZoffixW> m: say (-2) ** -2 Fractional exponents mean the number is raised to the power of the numerator and then the denominator-th-root is taken from it. So raising to 0.1th power simply means we take 10th root: <ZoffixW> m: say 1024 ** .1 So far so good for positive base numbers, but some stuff appears to be broken for roots of negatives. First, the NaN case described in this ticket: <ZoffixW> m: say (-1) ** .5 We're taking a square root of a negative number which "doesn't exist", so we're dealing with Complex numbers. <ZoffixW> m: say sqrt(-1) BUT, unlike sqrt(), if we request to deal with Complex numbers, the output from the infix:<**> is incorrect: <ZoffixW> m: say sqrt(-1+0i) Moreover, if we raise a negative number to an *odd* power, the result will be negative: <ZoffixW> m: say (-5)**3 This means that taking an *odd* root doesn't have anything to do with Complex numbers and should Just Work™, but Rakudo still gives us a NaN, instead of the original -5: <ZoffixW> m: say (-125)**(1/3) We can try using the "Complex mode", and that doesn't give NaN, but the result is wrong, so we can't use that to perform such a computation: <ZoffixW> m: say (-125+0i) ** (1/3) In summation, the buggy behaviour revealed by this ticket is: On Sat Jul 09 09:51:38 2016, pmichaud wrote:
|
Migrated from rt.perl.org#128584 (status was 'open')
Searchable as RT128584$
The text was updated successfully, but these errors were encountered: