I can't change expectations. It is to convert a byte count into a human 
readable byte count ( with kB, MB, ... units). 

I found out that I can produce the expected result by using math.Round. See 
here https://play.golang.org/p/UorDwbKlLj5

For my use case, I ended up converting "manually" the integer into a .1f 
float by using an array. The resulting code is 12 time faster than the one 
using the printf and float64 operations. It also need only one allocation 
to convert the byte array into a string. 

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/425dd75e-7d58-44cd-9e99-b197b81c078e%40googlegroups.com.

Reply via email to