use crate::{f256, EXP_BIAS, U256};
pub const PI: f256 = f256 {
bits: U256::new(
85070776964233020888379420810864062491,
174929234171320688473765933587459524450,
),
};
pub const TAU: f256 = f256 {
bits: U256::new(
85071101482786679315106203966884638747,
174929234171320688473765933587459524450,
),
};
pub const FRAC_3_PI_2: f256 = f256::new(
0,
2,
U256::new(
382314414047586946914081706939412,
216267517358725132221168102048536696202,
),
);
pub const FRAC_PI_2: f256 = f256 {
bits: U256::new(
85070452445679362461652637654843486235,
174929234171320688473765933587459524450,
),
};
pub const FRAC_PI_3: f256 = f256 {
bits: U256::new(
85070282528162007978565120285195957607,
230046945087859946803635491535562420119,
),
};
pub const FRAC_PI_4: f256 = f256 {
bits: U256::new(
85070127927125704034925854498822909979,
174929234171320688473765933587459524450,
),
};
pub const FRAC_PI_6: f256 = f256 {
bits: U256::new(
85069958009608349551838337129175381351,
230046945087859946803635491535562420119,
),
};
pub const FRAC_PI_8: f256 = f256 {
bits: U256::new(
85069803408572045608199071342802333723,
174929234171320688473765933587459524450,
),
};
pub const FRAC_1_PI: f256 = f256 {
bits: U256::new(
85069706845875500327645499421189881510,
206986278175927573935717840202627382231,
),
};
pub const FRAC_2_PI: f256 = f256 {
bits: U256::new(
85070031364429158754372282577210457766,
206986278175927573935717840202627382231,
),
};
pub const SQRT_PI: f256 = f256 {
bits: U256::new(
85070517887287421179178408574669870555,
196081862527210367688260911531529420449,
),
};
pub const FRAC_2_SQRT_PI: f256 = f256 {
bits: U256::new(
85070308873102583148344920635171925375,
287655892912639724059401590396951075229,
),
};
pub const SQRT_2: f256 = f256 {
bits: U256::new(
85070401631667124460448299797938859689,
116743028156957324320397937785460273254,
),
};
pub const FRAC_1_SQRT_2: f256 = f256 {
bits: U256::new(
85070077113113466033721516641918283433,
116743028156957324320397937785460273254,
),
};
pub const SQRT_5: f256 = f256 {
bits: U256::new(
85070630034453927516731555118236173774,
293111668962265138556237643962472537356,
),
};
pub const PHI: f256 = f256 {
bits: U256::new(
85070467775177098303368163540225885646,
293111668962265138556237643962472537356,
),
};
pub const GAMMA: f256 = f256 {
bits: U256::new(
85069992808959086250767892500525883434,
118855979546025341659232107741091106323,
),
};
pub const E: f256 = f256 {
bits: U256::new(
85070708278124661195610032245162902759,
222802656701688313363499752982718194317,
),
};
pub const LOG2_10: f256 = f256 {
bits: U256::new(
85070806225331312509001490326926387637,
334184565493856695912495380663507095645,
),
};
pub const LOG2_E: f256 = f256 {
bits: U256::new(
85070410874435338483602230749821537571,
223066862001648268900030815613626456629,
),
};
pub const LOG10_2: f256 = f256 {
bits: U256::new(
85069684415295184869522113457298964847,
194311423393590205950065478848290805498,
),
};
pub const LOG10_E: f256 = f256 {
bits: U256::new(
85069857402488498475189653211593438630,
164192268774284829881731129619354525426,
),
};
pub const LN_2: f256 = f256 {
bits: U256::new(
85070068052814656045284994940811804798,
126058098762831240896900834817458532725,
),
};
pub const LN_10: f256 = f256 {
bits: U256::new(
85070640827472984379971325288035741786,
129293958477818015387240946310013009982,
),
};
#[cfg(test)]
mod consts_tests {
use super::*;
#[test]
fn test_pi() {
assert_eq!(PI * f256::TWO, TAU);
assert_eq!(PI / f256::TWO, FRAC_PI_2);
assert_eq!(PI, FRAC_PI_2 + FRAC_PI_2);
assert_eq!(PI + FRAC_PI_2, FRAC_3_PI_2);
assert_eq!(PI / f256::from(3), FRAC_PI_3);
assert_eq!(PI / f256::from(4), FRAC_PI_4);
assert_eq!(PI / f256::from(6), FRAC_PI_6);
assert_eq!(PI / f256::from(8), FRAC_PI_8);
assert_eq!(f256::ONE / PI, FRAC_1_PI + FRAC_1_PI.ulp());
assert_eq!(f256::TWO / PI, FRAC_2_PI + FRAC_2_PI.ulp());
}
#[test]
fn test_phi() {
assert_eq!(PHI + f256::ONE, PHI * PHI);
}
}