0

Hi everyone,

Please check my code below and tell me that why double stores number upto 3 decimal places ?

#include <iostream>

using namespace std;

int main()
{
    double dNo;
    dNo = 363.430965;

    cout<<"double no : " <<dNo <<endl;
    //cout only outputs dNo value upto 
    //3 decimal places

    return 0;
}

Actually i working on assignment in which i need to get number upto different decimal places say 3, 4 etc. But in above case it only store that number upto 3 decimal places and also rounds it off.

How can i store decimal number upto 5, 6 or greater decimal places in double ???

Kindly give me the solution and explain this issue in detail. Thanks !

Regards

Edited by new_developer

2
Contributors
3
Replies
18
Views
2 Years
Discussion Span
Last Post by rproffitt
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.