Struct forest_actor::reward::BASELINE_EXPONENT [−][src]
pub struct BASELINE_EXPONENT { /* fields omitted */ }
Expand description
Floor(e^(ln[1 + 200%] / epochsInYear) * 2^128 Q.128 formatted number such that f(epoch) = baseExponent^epoch grows 200% in one year of epochs Calculation here: https://www.wolframalpha.com/input/?i=IntegerPart%5BExp%5BLog%5B1%2B200%25%5D%2F%28%28365+days%29%2F%2830+seconds%29%29%5D*2%5E128%5D
Methods from Deref<Target = StoragePower>
pub fn to_bytes_be(&self) -> (Sign, Vec<u8, Global>)
[src]
pub fn to_bytes_be(&self) -> (Sign, Vec<u8, Global>)
[src]Returns the sign and the byte representation of the BigInt
in big-endian byte order.
Examples
use num_bigint::{ToBigInt, Sign}; let i = -1125.to_bigint().unwrap(); assert_eq!(i.to_bytes_be(), (Sign::Minus, vec![4, 101]));
pub fn to_bytes_le(&self) -> (Sign, Vec<u8, Global>)
[src]
pub fn to_bytes_le(&self) -> (Sign, Vec<u8, Global>)
[src]Returns the sign and the byte representation of the BigInt
in little-endian byte order.
Examples
use num_bigint::{ToBigInt, Sign}; let i = -1125.to_bigint().unwrap(); assert_eq!(i.to_bytes_le(), (Sign::Minus, vec![101, 4]));
pub fn to_u32_digits(&self) -> (Sign, Vec<u32, Global>)
[src]
pub fn to_u32_digits(&self) -> (Sign, Vec<u32, Global>)
[src]Returns the sign and the u32
digits representation of the BigInt
ordered least
significant digit first.
Examples
use num_bigint::{BigInt, Sign}; assert_eq!(BigInt::from(-1125).to_u32_digits(), (Sign::Minus, vec![1125])); assert_eq!(BigInt::from(4294967295u32).to_u32_digits(), (Sign::Plus, vec![4294967295])); assert_eq!(BigInt::from(4294967296u64).to_u32_digits(), (Sign::Plus, vec![0, 1])); assert_eq!(BigInt::from(-112500000000i64).to_u32_digits(), (Sign::Minus, vec![830850304, 26])); assert_eq!(BigInt::from(112500000000i64).to_u32_digits(), (Sign::Plus, vec![830850304, 26]));
pub fn to_u64_digits(&self) -> (Sign, Vec<u64, Global>)
[src]
pub fn to_u64_digits(&self) -> (Sign, Vec<u64, Global>)
[src]Returns the sign and the u64
digits representation of the BigInt
ordered least
significant digit first.
Examples
use num_bigint::{BigInt, Sign}; assert_eq!(BigInt::from(-1125).to_u64_digits(), (Sign::Minus, vec![1125])); assert_eq!(BigInt::from(4294967295u32).to_u64_digits(), (Sign::Plus, vec![4294967295])); assert_eq!(BigInt::from(4294967296u64).to_u64_digits(), (Sign::Plus, vec![4294967296])); assert_eq!(BigInt::from(-112500000000i64).to_u64_digits(), (Sign::Minus, vec![112500000000])); assert_eq!(BigInt::from(112500000000i64).to_u64_digits(), (Sign::Plus, vec![112500000000])); assert_eq!(BigInt::from(1u128 << 64).to_u64_digits(), (Sign::Plus, vec![0, 1]));
pub fn iter_u32_digits(&self) -> U32Digits<'_>
[src]
pub fn iter_u32_digits(&self) -> U32Digits<'_>
[src]Returns an iterator of u32
digits representation of the BigInt
ordered least
significant digit first.
Examples
use num_bigint::BigInt; assert_eq!(BigInt::from(-1125).iter_u32_digits().collect::<Vec<u32>>(), vec![1125]); assert_eq!(BigInt::from(4294967295u32).iter_u32_digits().collect::<Vec<u32>>(), vec![4294967295]); assert_eq!(BigInt::from(4294967296u64).iter_u32_digits().collect::<Vec<u32>>(), vec![0, 1]); assert_eq!(BigInt::from(-112500000000i64).iter_u32_digits().collect::<Vec<u32>>(), vec![830850304, 26]); assert_eq!(BigInt::from(112500000000i64).iter_u32_digits().collect::<Vec<u32>>(), vec![830850304, 26]);
pub fn iter_u64_digits(&self) -> U64Digits<'_>
[src]
pub fn iter_u64_digits(&self) -> U64Digits<'_>
[src]Returns an iterator of u64
digits representation of the BigInt
ordered least
significant digit first.
Examples
use num_bigint::BigInt; assert_eq!(BigInt::from(-1125).iter_u64_digits().collect::<Vec<u64>>(), vec![1125u64]); assert_eq!(BigInt::from(4294967295u32).iter_u64_digits().collect::<Vec<u64>>(), vec![4294967295u64]); assert_eq!(BigInt::from(4294967296u64).iter_u64_digits().collect::<Vec<u64>>(), vec![4294967296u64]); assert_eq!(BigInt::from(-112500000000i64).iter_u64_digits().collect::<Vec<u64>>(), vec![112500000000u64]); assert_eq!(BigInt::from(112500000000i64).iter_u64_digits().collect::<Vec<u64>>(), vec![112500000000u64]); assert_eq!(BigInt::from(1u128 << 64).iter_u64_digits().collect::<Vec<u64>>(), vec![0, 1]);
pub fn to_signed_bytes_be(&self) -> Vec<u8, Global>ⓘ
[src]
pub fn to_signed_bytes_be(&self) -> Vec<u8, Global>ⓘ
[src]Returns the two’s-complement byte representation of the BigInt
in big-endian byte order.
Examples
use num_bigint::ToBigInt; let i = -1125.to_bigint().unwrap(); assert_eq!(i.to_signed_bytes_be(), vec![251, 155]);
pub fn to_signed_bytes_le(&self) -> Vec<u8, Global>ⓘ
[src]
pub fn to_signed_bytes_le(&self) -> Vec<u8, Global>ⓘ
[src]Returns the two’s-complement byte representation of the BigInt
in little-endian byte order.
Examples
use num_bigint::ToBigInt; let i = -1125.to_bigint().unwrap(); assert_eq!(i.to_signed_bytes_le(), vec![155, 251]);
pub fn to_str_radix(&self, radix: u32) -> String
[src]
pub fn to_str_radix(&self, radix: u32) -> String
[src]Returns the integer formatted as a string in the given radix.
radix
must be in the range 2...36
.
Examples
use num_bigint::BigInt; let i = BigInt::parse_bytes(b"ff", 16).unwrap(); assert_eq!(i.to_str_radix(16), "ff");
pub fn to_radix_be(&self, radix: u32) -> (Sign, Vec<u8, Global>)
[src]
pub fn to_radix_be(&self, radix: u32) -> (Sign, Vec<u8, Global>)
[src]Returns the integer in the requested base in big-endian digit order.
The output is not given in a human readable alphabet but as a zero
based u8 number.
radix
must be in the range 2...256
.
Examples
use num_bigint::{BigInt, Sign}; assert_eq!(BigInt::from(-0xFFFFi64).to_radix_be(159), (Sign::Minus, vec![2, 94, 27])); // 0xFFFF = 65535 = 2*(159^2) + 94*159 + 27
pub fn to_radix_le(&self, radix: u32) -> (Sign, Vec<u8, Global>)
[src]
pub fn to_radix_le(&self, radix: u32) -> (Sign, Vec<u8, Global>)
[src]Returns the integer in the requested base in little-endian digit order.
The output is not given in a human readable alphabet but as a zero
based u8 number.
radix
must be in the range 2...256
.
Examples
use num_bigint::{BigInt, Sign}; assert_eq!(BigInt::from(-0xFFFFi64).to_radix_le(159), (Sign::Minus, vec![27, 94, 2])); // 0xFFFF = 65535 = 27 + 94*159 + 2*(159^2)
pub fn sign(&self) -> Sign
[src]
pub fn sign(&self) -> Sign
[src]Returns the sign of the BigInt
as a Sign
.
Examples
use num_bigint::{BigInt, Sign}; use num_traits::Zero; assert_eq!(BigInt::from(1234).sign(), Sign::Plus); assert_eq!(BigInt::from(-4321).sign(), Sign::Minus); assert_eq!(BigInt::zero().sign(), Sign::NoSign);
pub fn magnitude(&self) -> &BigUint
[src]
pub fn magnitude(&self) -> &BigUint
[src]Returns the magnitude of the BigInt
as a BigUint
.
Examples
use num_bigint::{BigInt, BigUint}; use num_traits::Zero; assert_eq!(BigInt::from(1234).magnitude(), &BigUint::from(1234u32)); assert_eq!(BigInt::from(-4321).magnitude(), &BigUint::from(4321u32)); assert!(BigInt::zero().magnitude().is_zero());
pub fn bits(&self) -> u64
[src]
pub fn bits(&self) -> u64
[src]Determines the fewest bits necessary to express the BigInt
,
not including the sign.
pub fn to_biguint(&self) -> Option<BigUint>
[src]
pub fn to_biguint(&self) -> Option<BigUint>
[src]Converts this BigInt
into a BigUint
, if it’s not negative.
pub fn checked_add(&self, v: &BigInt) -> Option<BigInt>
[src]
pub fn checked_sub(&self, v: &BigInt) -> Option<BigInt>
[src]
pub fn checked_mul(&self, v: &BigInt) -> Option<BigInt>
[src]
pub fn checked_div(&self, v: &BigInt) -> Option<BigInt>
[src]
pub fn modpow(&self, exponent: &BigInt, modulus: &BigInt) -> BigInt
[src]
pub fn modpow(&self, exponent: &BigInt, modulus: &BigInt) -> BigInt
[src]Returns (self ^ exponent) mod modulus
Note that this rounds like mod_floor
, not like the %
operator,
which makes a difference when given a negative self
or modulus
.
The result will be in the interval [0, modulus)
for modulus > 0
,
or in the interval (modulus, 0]
for modulus < 0
Panics if the exponent is negative or the modulus is zero.
pub fn sqrt(&self) -> BigInt
[src]
pub fn sqrt(&self) -> BigInt
[src]Returns the truncated principal square root of self
–
see Roots::sqrt.
pub fn cbrt(&self) -> BigInt
[src]
pub fn cbrt(&self) -> BigInt
[src]Returns the truncated principal cube root of self
–
see Roots::cbrt.
pub fn nth_root(&self, n: u32) -> BigInt
[src]
pub fn nth_root(&self, n: u32) -> BigInt
[src]Returns the truncated principal n
th root of self
–
See Roots::nth_root.
pub fn trailing_zeros(&self) -> Option<u64>
[src]
pub fn trailing_zeros(&self) -> Option<u64>
[src]Returns the number of least-significant bits that are zero,
or None
if the entire number is zero.
Trait Implementations
impl Deref for BASELINE_EXPONENT
[src]
impl Deref for BASELINE_EXPONENT
[src]type Target = StoragePower
type Target = StoragePower
The resulting type after dereferencing.
fn deref(&self) -> &StoragePower
[src]
fn deref(&self) -> &StoragePower
[src]Dereferences the value.
impl LazyStatic for BASELINE_EXPONENT
[src]
impl LazyStatic for BASELINE_EXPONENT
[src]fn initialize(lazy: &Self)
[src]
Auto Trait Implementations
impl RefUnwindSafe for BASELINE_EXPONENT
impl Send for BASELINE_EXPONENT
impl Sync for BASELINE_EXPONENT
impl Unpin for BASELINE_EXPONENT
impl UnwindSafe for BASELINE_EXPONENT
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,