uint
uint copied to clipboard
`from`: Correctly implement wrapping.
On 2022-06-11 @recmo wrote in e80cbc5
“Merge pull request #136 from recmo/small-devex”:
Correctly implement wrapping.
impl_from_signed_int!(isize, usize);
impl<const BITS: usize, const LIMBS: usize> TryFrom<f64> for Uint<BITS, LIMBS> {
type Error = ToUintError<Self>;
// TODO: Correctly implement wrapping.
fn try_from(value: f64) -> Result<Self, Self::Error> {
if value.is_nan() {
return Err(ToUintError::NotANumber(BITS));
}
if value < 0.0 {
From src/from.rs:420