| | |
double data type
![]() |
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 business c++ c/c++ char class classes code coding commentinghelp compile console conversion count decide delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error faq file forms fstream function functions game givemetehcodez graph gui hash homeworkhelp homeworkhelper iamthwee ifpug ifstream infinite input int integer java lib linkedlist linker loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem proficiency program programming project python random read recursion reference rpg string strings temperature template templates test text text-file tree url variable vector video win32 windows winsock word wordfrequency wxwidgets






