My function "autoscales", so it would output "4.56u". But, I could see the value in having a mode where it could fix the scale to always output "u", or whatever the user specifies. Here is a sample of what my function does (left column is input, right is output):
1234 --> 1.23k
50000 --> 50k
5000 --> 5k
500 --> 500
0.012 --> 12m
0.00055555 --> 555u
5e-5 --> 50u
5E-5 --> 50u
5.0e-05 --> 50u
-193.7 --> -193
-5 --> -5
-0.7895 --> -789m
555555555555555555 --> 5.56e+17
0.000000000000000777 --> 7.77e-16
9876543 --> 9.87M
Obviously, this is only used for very coarse estimates. It does not handle rounding or precision correctly. |