pub fn int_sub(self, rhs: Self, flags: IntFlags) -> Option<Number> {
        let layout = self.layout();
        assert_eq!(layout, rhs.layout(), "subtracting numbers with different layout");
        match (layout, flags.signed) {
            (Layout::Integer(IntLayout { bytes, .. }), true) => self
                .to_i1024_bytes()
                .checked_sub(rhs.to_i1024_bytes())
                .map(Number::from)
                .and_then(|n| n.reshaped(Layout::signed(n.layout().bytes()), true))
                .and_then(|mut n| (n.reshape(Layout::signed(bytes)) || flags.wrap).then(|| n)),
            (Layout::Integer(IntLayout { bytes, .. }), false) => self
                .to_u1024_bytes()
                .checked_sub(rhs.to_u1024_bytes())
                .map(Number::from)
                .and_then(|n| n.reshaped(Layout::unsigned(n.layout().bytes()), true))
                .and_then(|mut n| (n.reshape(Layout::unsigned(bytes)) || flags.wrap).then(|| n)),
            (Layout::Float(_), _) => panic!("integer subtraction of float numbers"),
        }
    }
/// Subtraction of two integers with configuration flags for overflow and signed format.
/// If `signed` flag is inconsistent with Number layout,
/// the layout will be discarded before computing.
///
/// # Panics
///
/// - if applied to float number layouts
/// - if numbers in arguments has different layout.
Subtraction of two integers with configuration flags for overflow and signed format.
If `signed` flag is inconsistent with Number layout,
the layout will be discarded before computing.
Subtraction of two integers with configuration flags for overflow and signed format . If ` signed ` flag is inconsistent with Number layout the layout will be discarded before computing .
pub fn int_sub(self, rhs: Self, flags: IntFlags) -> Option<Number> {
        let layout = self.layout();
        assert_eq!(layout, rhs.layout(), "subtracting numbers with different layout");
        match (layout, flags.signed) {
            (Layout::Integer(IntLayout { bytes, .. }), true) => self
                .to_i1024_bytes()
                .checked_sub(rhs.to_i1024_bytes())
                .map(Number::from)
                .and_then(|n| n.reshaped(Layout::signed(n.layout().bytes()), true))
                .and_then(|mut n| (n.reshape(Layout::signed(bytes)) || flags.wrap).then(|| n)),
            (Layout::Integer(IntLayout { bytes, .. }), false) => self
                .to_u1024_bytes()
                .checked_sub(rhs.to_u1024_bytes())
                .map(Number::from)
                .and_then(|n| n.reshaped(Layout::unsigned(n.layout().bytes()), true))
                .and_then(|mut n| (n.reshape(Layout::unsigned(bytes)) || flags.wrap).then(|| n)),
            (Layout::Float(_), _) => panic!("integer subtraction of float numbers"),
        }
    }
pub fn int_sub ( self , rhs : Self , flags : IntFlags ) -> Option < Number > { let layout = self . layout ( ) ; assert_eq ! ( layout rhs layout ( ) " " ) ; match ( layout , flags . signed ) { ( Layout :: Integer ( IntLayout { bytes , .. } ) , true ) => self . to_i1024_bytes ( ) . checked_sub ( rhs . to_i1024_bytes ( ) ) . map ( Number :: from ) . and_then ( | n | n . reshaped ( Layout :: signed ( n . layout ( ) . bytes ( ) ) , true ) ) . and_then ( | mut n | ( n . reshape ( Layout :: signed ( bytes ) ) || flags . wrap ) . then ( | | n ) ) , ( Layout :: Integer ( IntLayout { bytes , .. } ) , false ) => self . to_u1024_bytes ( ) . checked_sub ( rhs . to_u1024_bytes ( ) ) . map ( Number :: from ) . and_then ( | n | n . reshaped ( Layout :: unsigned ( n . layout ( ) . bytes ( ) ) , true ) ) . and_then ( | mut n | ( n . reshape ( Layout :: unsigned ( bytes ) ) || flags . wrap ) . then ( | | n ) ) , ( Layout :: Float ( _ ) , _ ) => panic ! ( " " ) , } }
Subtraction of two integers with configuration flags for overflow and signed format.
Subtraction of two integers with configuration flags for overflow and signed format .
self
rhs
Self
flags
IntFlags
self
rhs
Self
flags
IntFlags
panics
if applied to float number layouts
if numbers in arguments has different layout.
if applied to float number layouts if numbers in arguments has different layout .