#not getting the whole value of double

19 messages · Page 1 of 1 (latest)

fair kite
#

why am i not getting the whole value of double?, can someone explain

#include<bits/stdc++.h>
using namespace std;

int main()
{

    double d;
    cin >> d;
    cout << d;

} ```
 
input : 
```14049.30493```
 
output : 
```14049.3```
barren tokenBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For more information use !howto ask.

cunning gorge
#

cout<<std::setprecision(15)<<std::fixed<<d<<"\n"

#

also, there will be rounding errors when you use double for these values

#

@fair kite

ornate plover
cunning gorge
#

yes, that should be the limit of double

ornate plover
#

oh right

cunning gorge
ornate plover
#

double is like 16 bits after decimal and 48 bits on the left side right?

#

oh thanks.

#

Actually I was confused.

hard hemlock
#

or

#
cout<<fixed<<setprecision(whatever_number_you_want)<<double_value; ```
fair kite
#

!solved

barren tokenBOT
#

Thank you and let us know if you have any more questions!

#

[SOLVED] not getting the whole value of double

fair kite
#

Thankyou @hard hemlock @ornate plover