mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 02:17:58 +00:00
add numerator and denominator to Rational128 Debug impl and increase precision of float representation (#12914)
This commit is contained in:
@@ -94,14 +94,14 @@ pub struct Rational128(u128, u128);
|
||||
#[cfg(feature = "std")]
|
||||
impl sp_std::fmt::Debug for Rational128 {
|
||||
fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result {
|
||||
write!(f, "Rational128({:.4})", self.0 as f32 / self.1 as f32)
|
||||
write!(f, "Rational128({} / {} ≈ {:.8})", self.0, self.1, self.0 as f64 / self.1 as f64)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
impl sp_std::fmt::Debug for Rational128 {
|
||||
fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result {
|
||||
write!(f, "Rational128(..)")
|
||||
write!(f, "Rational128({} / {})", self.0, self.1)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user