Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
number format
#1
how can i change the variable double from "6.56166e-002" to "0.0656166"?

thanks
#2
Code:
Copy      Help
double d=6.56166e-002
str s

s=d
out s

s.format("%g" d)
out s

s.format("%.3g" d)
out s

s.format("%.3f" d)
out s

s.format("%e" d)
out s

s.format("%.3e" d)
out s

%e - with e
%f - without e
%g - with or without e, whichever is more compact
#3
works great!
thanks.


Forum Jump:


Users browsing this thread: 1 Guest(s)