swf: Show scaled value in `swf::FixedN`'s `Debug` implementations
This commit is contained in:
parent
379bed891f
commit
233478a273
|
@ -19,7 +19,7 @@ macro_rules! define_fixed {
|
||||||
into_float($($into_type:path),*)
|
into_float($($into_type:path),*)
|
||||||
) => {
|
) => {
|
||||||
/// A signed fixed-point value with $frac_bits bits.
|
/// A signed fixed-point value with $frac_bits bits.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
||||||
pub struct $type_name($underlying_type);
|
pub struct $type_name($underlying_type);
|
||||||
|
|
||||||
/// A signed fixed-point type.
|
/// A signed fixed-point type.
|
||||||
|
@ -185,7 +185,13 @@ macro_rules! define_fixed {
|
||||||
|
|
||||||
impl std::fmt::Display for $type_name {
|
impl std::fmt::Display for $type_name {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||||
write!(f, "{}", self.to_f64())
|
std::fmt::Display::fmt(&self.to_f64(), f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl std::fmt::Debug for $type_name {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||||
|
std::fmt::Debug::fmt(&self.to_f64(), f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue