chickadee » fmt » num/si

(num/si <n> [<base> <suffix>])procedure

Abbreviates <n> with an SI suffix as in the -h or --si option to many GNU commands. The base defaults to 1024, using suffix names like Ki, Mi, Gi, etc. Other bases (e.g. the standard 1000) have the suffixes k, M, G, etc.

The <suffix> argument is appended only if an abbreviation is used.

(fmt #f (num/si 608))

=> "608"

(fmt #f (num/si 3986))

=> "3.9Ki"

(fmt #f (num/si 3986 1000 "B"))

=> "4kB"