Show fractal in relative_sequence_number if present

This commit is contained in:
bytedream 2023-10-15 23:34:22 +02:00
parent 685c79d673
commit d0fe7f54f6
3 changed files with 20 additions and 6 deletions

View file

@ -192,3 +192,13 @@ pub fn parse_resolution(mut resolution: String) -> Result<Resolution> {
bail!("Could not find resolution")
}
}
/// Dirty implementation of [`f32::fract`] with more accuracy.
pub fn fract(input: f32) -> f32 {
if input.fract() == 0.0 {
return 0.0;
}
format!("0.{}", input.to_string().split('.').last().unwrap())
.parse::<f32>()
.unwrap()
}