zenith-float-num 1.0.1

Software big-float kernel for zenith-float.
Documentation
//! Static constants.

use crate::{defs::DEFAULT_P, num::ExactNumNumber, Exponent, WORD_BIT_SIZE};
use lazy_static::lazy_static;

#[cfg(feature = "std")]
use crate::ops::consts::Consts;
#[cfg(feature = "std")]
use core::cell::RefCell;

lazy_static! {

    /// 1
    pub(crate) static ref ONE: ExactNumNumber = ExactNumNumber::from_word(1, DEFAULT_P).expect("Constant ONE initialization.");

    /// 2
    pub(crate) static ref TWO: ExactNumNumber = ExactNumNumber::from_word(2, DEFAULT_P).expect("Constant TWO initialization.");

    /// 4
    pub(crate) static ref FOUR: ExactNumNumber = ExactNumNumber::from_word(4, DEFAULT_P).expect("Constant FOUR initialization.");

    /// 6
    pub(crate) static ref SIX: ExactNumNumber = ExactNumNumber::from_word(6, DEFAULT_P).expect("Constant SIX initialization.");

    /// 8
    pub(crate) static ref EIGHT: ExactNumNumber = ExactNumNumber::from_word(8, DEFAULT_P).expect("Constant EIGHT initialization.");

    /// 16
    pub(crate) static ref SIXTEEN: ExactNumNumber = ExactNumNumber::from_word(16, DEFAULT_P).expect("Constant SIXTEEN initialization.");

    /// 3
    pub(crate) static ref THREE: ExactNumNumber = ExactNumNumber::from_word(3, DEFAULT_P).expect("Constant THREE initialization.");

    /// 5
    pub(crate) static ref FIVE: ExactNumNumber = ExactNumNumber::from_word(5, DEFAULT_P).expect("Constant FIVE initialization.");

    /// 10
    pub(crate) static ref TEN: ExactNumNumber = ExactNumNumber::from_word(10, DEFAULT_P).expect("Constant TEN initialization.");

    /// 15
    pub(crate) static ref FIFTEEN: ExactNumNumber = ExactNumNumber::from_word(15, DEFAULT_P).expect("Constant FIFTEEN initialization.");

    /// 24
    pub(crate) static ref C24: ExactNumNumber = ExactNumNumber::from_word(24, DEFAULT_P).expect("Constant C24 initialization.");

    /// 40
    pub(crate) static ref FOURTY: ExactNumNumber = ExactNumNumber::from_word(40, DEFAULT_P).expect("Constant FOURTY initialization.");

    /// 120
    pub(crate) static ref C120: ExactNumNumber = ExactNumNumber::from_word(120, DEFAULT_P).expect("Constant C120 initialization.");
}

// Thread-local Consts cache used by decimal conversion under std.
#[cfg(feature = "std")]
thread_local! {
    pub static TENPOWERS: RefCell<Consts> = RefCell::new(Consts::new().expect("Failed to initialize thread-local constants cache"));
}

pub const TRIG_EXP_THRES: Exponent = -(WORD_BIT_SIZE as Exponent);