0

I use tr("%1").arg(2.00000, 0, 'f', 2); to format figures. it is formatted to "2.00", but '.00' is not what i want, i hope to cut it off.

so i tried .arg(2.00000, 0, 'g', 2);, and the '.00' is cut.

but in some other curcumstances 'g' mode uses 'e' mode and formats it like "2.5e+02"...

i hope the figure is just formatted in 'f' mode and could cut the '.00' tail if it has one. how to do that?

zhangxaochen
  • 32,744
  • 15
  • 77
  • 108
  • I'm confused, your question title is "...with fixed precision?" and that is exactly what you are getting. If you want fixed precision except in the case that all the mantissa digits are zero - you may have to write it yourself. – cmannett85 Nov 15 '12 at 09:23

1 Answers1

0

Recommend you to read here and here.

NG_
  • 6,895
  • 7
  • 45
  • 67