parse-util: add format string macro for outputting permyriad
Let's define a set of macros for making output of permyriad values easy. They are printed in pure ASCII, i.e. without the permille/permyriad suffix, using just percent and two places after the dot.
This commit is contained in:
@@ -59,3 +59,6 @@ static inline int UINT32_SCALE_TO_PERMYRIAD(uint32_t scale) {
|
||||
|
||||
return (int) u;
|
||||
}
|
||||
|
||||
#define PERMYRIAD_AS_PERCENT_FORMAT_STR "%i.%02i%%"
|
||||
#define PERMYRIAD_AS_PERCENT_FORMAT_VAL(x) ((x)/100), ((x)%100)
|
||||
|
||||
Reference in New Issue
Block a user