[−][src]Trait fixnum::ops::CheckedMul
Associated Types
Loading content...Required methods
pub fn cmul(self, rhs: Rhs) -> Result<Self::Output, Self::Error>
[src]
Checked multiplication. Returns Err
on overflow.
This is multiplication without rounding, hence it's available only when at least one operand is integer.
use fixnum::{FixedPoint, typenum::U9, ops::CheckedMul}; type Amount = FixedPoint<i64, U9>; fn amount(s: &str) -> FixedPoint<i64, U9> { s.parse().unwrap() } assert_eq!(amount("0.000000001").cmul(12)?, amount("0.000000012")); assert_eq!(12.cmul(amount("0.000000001"))?, amount("0.000000012"));
Implementations on Foreign Types
impl CheckedMul<i8> for i8
[src]
type Output = i8
type Error = ArithmeticError
pub fn cmul(self, rhs: Self) -> Result<Self::Output, Self::Error>
[src]
impl CheckedMul<i16> for i16
[src]
type Output = i16
type Error = ArithmeticError
pub fn cmul(self, rhs: Self) -> Result<Self::Output, Self::Error>
[src]
impl CheckedMul<i32> for i32
[src]
type Output = i32
type Error = ArithmeticError
pub fn cmul(self, rhs: Self) -> Result<Self::Output, Self::Error>
[src]
impl CheckedMul<i64> for i64
[src]
type Output = i64
type Error = ArithmeticError
pub fn cmul(self, rhs: Self) -> Result<Self::Output, Self::Error>
[src]
impl CheckedMul<i128> for i128
[src]
type Output = i128
type Error = ArithmeticError
pub fn cmul(self, rhs: Self) -> Result<Self::Output, Self::Error>
[src]
impl<P: Precision> CheckedMul<FixedPoint<i16, P>> for i16
[src]
type Output = FixedPoint<i16, P>
type Error = ArithmeticError
pub fn cmul(
self,
rhs: FixedPoint<i16, P>
) -> Result<FixedPoint<i16, P>, ArithmeticError>
[src]
self,
rhs: FixedPoint<i16, P>
) -> Result<FixedPoint<i16, P>, ArithmeticError>
impl<P: Precision> CheckedMul<FixedPoint<i32, P>> for i32
[src]
type Output = FixedPoint<i32, P>
type Error = ArithmeticError
pub fn cmul(
self,
rhs: FixedPoint<i32, P>
) -> Result<FixedPoint<i32, P>, ArithmeticError>
[src]
self,
rhs: FixedPoint<i32, P>
) -> Result<FixedPoint<i32, P>, ArithmeticError>
impl<P: Precision> CheckedMul<FixedPoint<i64, P>> for i64
[src]
type Output = FixedPoint<i64, P>
type Error = ArithmeticError
pub fn cmul(
self,
rhs: FixedPoint<i64, P>
) -> Result<FixedPoint<i64, P>, ArithmeticError>
[src]
self,
rhs: FixedPoint<i64, P>
) -> Result<FixedPoint<i64, P>, ArithmeticError>