pub fn with_precision(x: &DBig, precision: usize) -> DBigExpand description
Return x rebound to the requested decimal precision.
This delegates to dashu_float::FBig::with_precision, which returns
an dashu_base::Approximation indicating whether the rebind was
exact (the new precision was at least the old digit count) or
inexact (digits were rounded off). This helper discards that
distinction and returns the rounded value directly. Use the raw
dashu-float API if you need the inexact-flag.
precision == 0 is unlimited precision in dashu-float’s
vocabulary, which is also passed through unchanged.
§Examples
use std::str::FromStr;
use oxinum_float::{precision::with_precision, DBig};
let a = DBig::from_str("1.234").expect("parse 1.234");
let a100 = with_precision(&a, 100);
assert_eq!(a100.precision(), 100);