Struct rbatis_core::types::decimal::Decimal [−][src]
pub struct Decimal {
pub inner: BigDecimal,
}
Expand description
Rbatis Decimal
Fields
inner: BigDecimal
Implementations
Methods from Deref<Target = BigDecimal>
Return a new BigDecimal object equivalent to self, with internal scaling set to the number specified. If the new_scale is lower than the current value (indicating a larger power of 10), digits will be dropped (as precision is lower)
Return a new BigDecimal object with precision set to new value
Return the sign of the BigDecimal
as num::bigint::Sign
.
Examples
extern crate num_bigint;
extern crate bigdecimal;
use std::str::FromStr;
assert_eq!(bigdecimal::BigDecimal::from_str("-1").unwrap().sign(), num_bigint::Sign::Minus);
assert_eq!(bigdecimal::BigDecimal::from_str("0").unwrap().sign(), num_bigint::Sign::NoSign);
assert_eq!(bigdecimal::BigDecimal::from_str("1").unwrap().sign(), num_bigint::Sign::Plus);
Return the internal big integer value and an exponent. Note that a positive exponent indicates a negative power of 10.
Examples
extern crate num_bigint;
extern crate bigdecimal;
use std::str::FromStr;
assert_eq!(bigdecimal::BigDecimal::from_str("1.1").unwrap().as_bigint_and_exponent(),
(num_bigint::BigInt::from_str("11").unwrap(), 1));
Compute the absolute value of number
Divide this efficiently by 2
Note, if this is odd, the precision will increase by 1, regardless of the context’s limit.
Take the square root of the number
If the value is < 0, None is returned
Take the cube root of the number
Compute the reciprical of the number: x-1
Return number rounded to round_digits precision after the decimal point
Return true if this number has zero fractional part (is equal to an integer)
Evaluate the natural-exponential function ex
Trait Implementations
type Target = BigDecimal
type Target = BigDecimal
The resulting type after dereferencing.
Decimal allow deserialize by an String or Binary
Deserialize this value from the given Serde deserializer. Read more
Performs the conversion.
Performs the conversion.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for Decimal
impl UnwindSafe for Decimal
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.