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

large right-shift of negative loses sign #4881

Closed
p6rt opened this issue Dec 17, 2015 · 7 comments
Closed

large right-shift of negative loses sign #4881

p6rt opened this issue Dec 17, 2015 · 7 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Dec 17, 2015

Migrated from rt.perl.org#126942 (status was 'resolved')

Searchable as RT126942$

@p6rt
Copy link
Author

p6rt commented Dec 17, 2015

From zefram@fysh.org

Long right shifts (longer than operand length) of negative integers
should always produce -1, but in Rakudo after some length they stop
doing that and switch to an incorrect output​:

-123 +> 8
-1
-123 +> 31
-1
-123 +> 32
0
-123 +> (1 +< 60)
0

Some very long right shifts then run into [perl #​126940] and [perl
#​126941], but those are separate issues.

-zefram

@p6rt
Copy link
Author

p6rt commented Dec 17, 2015

From @lizmat

On 17 Dec 2015, at 03​:41, Zefram (via RT) <perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by Zefram
# Please include the string​: [perl #​126942]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=126942 >

Long right shifts (longer than operand length) of negative integers
should always produce -1, but in Rakudo after some length they stop
doing that and switch to an incorrect output​:

-123 +> 8
-1
-123 +> 31
-1
-123 +> 32
0
-123 +> (1 +< 60)
0

Some very long right shifts then run into [perl #​126940] and [perl
#​126941], but those are separate issues.

$ 6 'say -123 +> 32'
-1

Temporarily fixed with 0e24208abfcc67b22a7f , test added with 83057c9b8f97ed9b761f1 , should probably get a better fix at nqp level post Christmas. Or not.

Liz

@p6rt
Copy link
Author

p6rt commented Dec 17, 2015

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Dec 17, 2015

From 1parrota@gmail.com

Does a shift value longer than the word length make any sense anyway?

On 12/17/15, Elizabeth Mattijsen <liz@​dijkmat.nl> wrote​:

On 17 Dec 2015, at 03​:41, Zefram (via RT) <perl6-bugs-followup@​perl.org>
wrote​:

# New Ticket Created by Zefram
# Please include the string​: [perl #​126942]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=126942 >

Long right shifts (longer than operand length) of negative integers
should always produce -1, but in Rakudo after some length they stop
doing that and switch to an incorrect output​:

-123 +> 8
-1
-123 +> 31
-1
-123 +> 32
0
-123 +> (1 +< 60)
0

Some very long right shifts then run into [perl #​126940] and [perl
#​126941], but those are separate issues.

$ 6 'say -123 +> 32'
-1

Temporarily fixed with 0e24208abfcc67b22a7f , test added with
83057c9b8f97ed9b761f1 , should probably get a better fix at nqp level post
Christmas. Or not.

Liz

@p6rt
Copy link
Author

p6rt commented Dec 18, 2015

From zefram@fysh.org

Parrot Raiser via RT wrote​:

Does a shift value longer than the word length make any sense anyway?

With bignums, yes it does.

-123 +< 200
-197653379443855803891661337357963000110230968235283518742069248

(Also, 32 isn't really my word length.)

-zefram

@p6rt
Copy link
Author

p6rt commented May 10, 2017

From @zoffixznet

Thanks for the report. This is now fixed.

Fix​:
  MoarVM/MoarVM@362277b79f
  Raku/nqp@9763728215
  rakudo/rakudo@66e8e72c02
  rakudo/rakudo@ef29bb9f41

Tests​:
  Raku/roast@02d1f9d0f6
  rakudo/rakudo@6409ee582e

@p6rt
Copy link
Author

p6rt commented May 10, 2017

@zoffixznet - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed May 10, 2017
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant