pub fn fmt_number(value: f32) -> StringExpand description
Spell a real the way the content-stream and object writers do.
Never scientific notation, never a leading zero before the point, NaN and
both zeros render as "0", and the infinities render as the finite
extremes (PDF has no syntax for either).
use pdfrum_object::fmt_number;
assert_eq!(fmt_number(0.0), "0");
assert_eq!(fmt_number(-0.0), "0");
assert_eq!(fmt_number(-7.5), "-7.5");
assert_eq!(fmt_number(0.5), ".5");
assert_eq!(fmt_number(f32::NAN), "0");
assert_eq!(fmt_number(f32::MAX), fmt_number(f32::INFINITY));