448,799 Members | 1,362 Online
Need help? Post your question and get tips & solutions from a community of 448,799 IT Pros & Developers. It's quick & easy.

# Output the whole value of a double

 P: n/a I have a program that outputs the following to the screen (through visual c++) 9999999999, which is stored in a double. I would like to keep the number the way it is, but every time I output it (after converting it to a cstring), it becomes 1e+010. I've tried many different formatting ways, including stringstream formatting, sprintf(buffer, "%25.0fl", temp) - temp is the double, sprintf(buffer, "%25f", temp), etc. I am using the double number in a calculator I've been working on (CString converted to chars for parsing, double result converted to string, string converted to cstring for messagebox update), and I've been unable to determine whether or not my many conversions were making this a problem (unless I'm missing something, the conversions do not change the display of the double - it's already like that). Can someone help me output the whole number 9999999999 (and others), and not the abbreviated 1e+010 form? Thanks for your help. Mar 9 '06 #1

 P: n/a bs********@isp.com wrote: I have a program that outputs the following to the screen (through visual c++) 9999999999, which is stored in a double. I would like to keep the number the way it is, but every time I output it (after converting it to a cstring), it becomes 1e+010. I've tried many different formatting ways, including stringstream formatting, sprintf(buffer, "%25.0fl", temp) - temp is the double, sprintf(buffer, "%25f", temp), etc. I am using the double number in a calculator I've been working on (CString converted to chars for parsing, double result converted to string, string converted to cstring for messagebox update), and I've been unable to determine whether or not my many conversions were making this a problem (unless I'm missing something, the conversions do not change the display of the double - it's already like that). Can someone help me output the whole number 9999999999 (and others), and not the abbreviated 1e+010 form? Thanks for your help. #include #include #include #include using namespace std; int main() { double nines = 9999999999; cout << fixed << setprecision(0) << nines << endl; } V -- Please remove capital As from my address when replying by mail Mar 9 '06 #2

### This discussion thread is closed

Replies have been disabled for this discussion.