develooper Front page | perl.perl6.compiler | Postings from February 2012

Re: [perl #109740] [BUG] Four extra bits after +& operation in Rakudo

Thread Previous | Thread Next
From:
Francis Smit
Date:
February 3, 2012 06:08
Subject:
Re: [perl #109740] [BUG] Four extra bits after +& operation in Rakudo
Message ID:
4F2BEA55.80501@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.perl.org:443/rt3/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/



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About