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

Four extra bits after +& operation in Rakudo #2638

Closed
p6rt opened this issue Feb 3, 2012 · 6 comments
Closed

Four extra bits after +& operation in Rakudo #2638

p6rt opened this issue Feb 3, 2012 · 6 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Feb 3, 2012

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

Searchable as RT109740$

@p6rt
Copy link
Author

p6rt commented Feb 3, 2012

From @masak

<grondilu> nom​: my ($x, $y) = (2**30, 1); printf "%32b\n", +^$x +& $y;
<p6eval> nom acbec8​:
OUTPUT«1111000000000000000000000000000000000000000000000000000000000001␤»
<grondilu> where do those four bits come from??
<grondilu> niecza​: my ($x, $y) = (2**30, 1); printf "%32b", +^$x +& $y;
<p6eval> niecza v13-389-g852f0ff​: OUTPUT« 1»
<moritz> grondilu​: I just realized, libtommath (which we use for
storing bigints) uses 28bit "digits"
<moritz> grondilu​: so there might indeed a bug in there somewhere
<grondilu> oh, this explains a lot
<moritz> grondilu​: feel free to submit as rakudobug (or even fix if you want :-)
<grondilu> I don't know how to. Someone please do it.
* masak submits rakudobug
<moritz> libtommath stores sign separately from the rest of the bits,
which is why we need to emulate 2's complement math
<moritz> and that part might be buggy

@p6rt
Copy link
Author

p6rt commented Feb 3, 2012

From grizzly@smit.id.au

On 04/02/12 00​:54, Carl Mäsak (via RT) wrote​:

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

<grondilu> nom​: my ($x, $y) = (2**30, 1); printf "%32b\n", +^$x +& $y;
what is unary +^ I can only find binary +^ bitwise xor
<p6eval> nom acbec8​:
OUTPUT«1111000000000000000000000000000000000000000000000000000000000001␤»
<grondilu> where do those four bits come from??
<grondilu> niecza​: my ($x, $y) = (2**30, 1); printf "%32b", +^$x +& $y;
<p6eval> niecza v13-389-g852f0ff​: OUTPUT« 1»
<moritz> grondilu​: I just realized, libtommath (which we use for
storing bigints) uses 28bit "digits"
<moritz> grondilu​: so there might indeed a bug in there somewhere
<grondilu> oh, this explains a lot
<moritz> grondilu​: feel free to submit as rakudobug (or even fix if you want :-)
<grondilu> I don't know how to. Someone please do it.
* masak submits rakudobug
<moritz> libtommath stores sign separately from the rest of the bits,
which is why we need to emulate 2's complement math
<moritz> and that part might be buggy

--

  .~. In my life God comes first....
  /V\ but Linux is pretty high after that :-D
  /( )\ Francis (Grizzly) Smit
  ^^-^^ http://www.smit.id.au/

@p6rt
Copy link
Author

p6rt commented Feb 3, 2012

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

@p6rt
Copy link
Author

p6rt commented Feb 3, 2012

From @masak

Francis (>)​:

what is unary +^ I can only find binary +^ bitwise xor

See S03​:677. It's numeric bitwise addition.

@p6rt
Copy link
Author

p6rt commented Feb 8, 2012

From @moritz

Fixed, and tested in S03-operators/bit.t.

@p6rt
Copy link
Author

p6rt commented Feb 8, 2012

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

@p6rt p6rt closed this as completed Feb 8, 2012
@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