You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
>>'ing a primitive integer (or a GMP Mpz) will round to negative infinity, while ramp currently rounds to zero (same as division). Maybe this should be changed?
externcrate ramp;externcrate gmp;use ramp::Int;fnmain(){let x = -1;let shift = 1;let r = Int::from(x);let g = gmp::mpz::Mpz::from(x);let div = 1i32 << shift;println!("ramp {} {}\ngmp {} {}\ni32 {} {}",&r >> shift,
r / div,&g >> shift,
g / div asu64,
x >> shift,
x / div);}
ramp 0 0
gmp -1 0
i32 -1 0
The text was updated successfully, but these errors were encountered:
Well right now it says that the bit-shift operators correspond to a multiplication or division by a power-of-two, so the results Ramp gets are correct. That said, I am using the same "pretend it's two's complement" thing for BitOr and BitAnd, so using for the shl/shr isn't too weird.
huonw
added a commit
to huonw/ramp
that referenced
this issue
Oct 22, 2015
This compares pretty much every operation Ramp exposes against the
result of the same computation performed with GMP.
Several bugs/issues were found, and the corresponding tests are
currently commented out: Aatch#24, Aatch#25, Aatch#26, Aatch#27.
This compares pretty much every operation Ramp exposes against the
result of the same computation performed with GMP.
Several bugs/issues were found, and the corresponding tests are
currently commented out: Aatch#24, Aatch#25, Aatch#26, Aatch#27, Aatch#30.
>>
'ing a primitive integer (or a GMP Mpz) will round to negative infinity, while ramp currently rounds to zero (same as division). Maybe this should be changed?The text was updated successfully, but these errors were encountered: