Expand description

Formats a list of arbitrary fractional numbers (either string or f32/f64) so that they are correctly aligned when printed line by line. It also removes unnecessary zeroes. This means that it rather returns “7” instead of “7.000000”.

Example Input

"-42"
"0.3214"
"1000"
"-1000.2"
"2.00000"

Example Output

"  -42     "
"    0.3214"
" 1000     "
"-1000.2   "
"    2     "

Enums

The precision of decimal places for fmt_align_fractions.
Abstraction over floating point types f32 and f64.

Functions

Aligns a number of formatted fraction numbers. Valid strings are for example 1, 3.14, and -42. Aligns all with additional padding on the left so that all of them can be printed line by line in an aligned way. This means that in every line the tens digits will be aligned, the once places will be aligned, the decimal place will be aligned etc. (TODO are these the proper english terms?)
Convenient wrapper around fmt_align_fraction_strings that takes a slice of floating point values, formats them all with a maximum precision and returns a list of aligned, formatted strings.