| | |
double data type
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
The 5 digits before have nothing to do with it. When your system is rounding to tenths then xxxx.47.. is rounded to xxxx.5 just as xxxxxx.79.. is rounded to xxxxxx+1.
Read also : http://en.wikipedia.org/wiki/Rounding
Read also : http://en.wikipedia.org/wiki/Rounding
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Make love, no war. Cave ab homine unius libri.
Danny
It's simply default precision of stream output. Don't worry, double type always keeps ~16 significant digits...
Use setprecision manipulator from <iomanip> to set another output precision:
Try this and see what happens...
Use setprecision manipulator from <iomanip> to set another output precision:
C++ Syntax (Toggle Plain Text)
#include <iomanip> double x = ......; ... for (int n = 0; n < 17; ++n) cout << setprecision(n) << x << endl;
Last edited by ArkM; Nov 9th, 2008 at 3:52 pm.
![]() |
Similar Threads
- C++: problam with data type(int,float,double) (C++)
- Range of a double integer in C++ (C++)
- Combined data type arrays. (C++)
- C double data type emulation library (C)
- why is double data type giving an garbage value (Java)
- Help With Data-type Declaration Symbols (Pascal and Delphi)
- C++ Data Types (C++)
- Data Abstraction (Computer Science)
Other Threads in the C++ Forum
- Previous Thread: Clock tick
- Next Thread: Problem with constructor
| Thread Tools | Search this Thread |
api array based binary bitmap c++ c/c++ calculator char char* class classes code coding compile console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news node number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings temperature template templates test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






