-
Notifications
You must be signed in to change notification settings - Fork 4
Closed
Description
extern crate apint;
use apint::{ApInt, BitWidth};
use std::i128;
fn main() {
println!(
"{:?}",
ApInt::from_i128(i128::MAX).into_sign_extend(BitWidth::new(256).unwrap()),
);
println!(
"{:?}",
ApInt::from_i128(i128::MIN).into_sign_extend(BitWidth::new(256).unwrap()),
);
}
If I were you, I would add tests for the problematic {integer}::MIN values everywhere applicable.
Also, I found this in the documentation:
pub fn from_i128(val: i128) -> ApInt
[src]
[−]
Creates a new ApInt from a given i128 value with a bit-width of 64.
pub fn from_u128(val: u128) -> ApInt
[src]
[−]
Creates a new ApInt from a given u128 value with a bit-width of 64.
It should be 128 not 64.
Also, now that i128 is stabilized (except for repr(i128)), check that the implementation and docs of all the i128 stuff is also correct.
This crate perfectly fits my use case (and I think that it is much, much better than the num_bigint crate in general), but there is some unimplemented! stuff in the multiply and divide functions that prevents me from using it.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels