1use super::*;
2use core::fmt;
3
4pub fn to_decimal_scratch(x_bits: u64) -> StackReq {
5 _ = x_bits;
6 StackReq::EMPTY
7}
8
9pub fn to_decimal(f: &mut dyn fmt::Write, x: &BigFloat, stack: &mut PodStack) -> fmt::Result {
10 _ = stack;
11 write!(f, "{}", convert::to_f64(x, Round::ToNearest).0)
12}
13
14impl fmt::Display for BigFloat {
15 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
16 to_decimal(
17 f,
18 self,
19 PodStack::new(&mut dyn_stack::PodBuffer::new(to_decimal_scratch(self.precision_bits()))),
20 )
21 }
22}
23
24impl<const N: usize> fmt::Display for SmallFloat<N> {
25 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
26 (**self).fmt(f)
27 }
28}