Skip to main content

pi

Function pi 

Source
pub fn pi(prec: u32) -> OxiNumResult<BigFloat>
Expand description

Return π at prec bits of precision.

§Errors

Propagates any arithmetic error from the internal Chudnovsky computation (in practice, only a sqrt-of-negative error which should never occur).

§Examples

use oxinum_float::native::{pi, BigFloat, RoundingMode};
let p = pi(64).expect("pi");
assert!((p.to_f64() - std::f64::consts::PI).abs() < 1e-14);