Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8740175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:05:06+00:00 2026-06-13T11:05:06+00:00

long double m; cout << enter double: ; cin >> m; cout << m

  • 0
long double m;
cout << "enter double: "; cin >> m;
cout << "m = " << m <<endl;

Input:

enter double: 1.546640625

Output:

m = 1.54664

I have to convert into a binary with point, and when I read numbers like 2.359375000

Output:

m = 2.35938

And it works, but I think the problem is the zero in 1.546640625

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:05:07+00:00Added an answer on June 13, 2026 at 11:05 am

    You have read the whole value of the double. The problem is with the cout. It by default rounds the value to 6 digits after the decimal point.

    To set the precision cout uses, use setprecision from <iomanip>:

    #include <iostream>
    #include <iomanip>
    
    using namespace std;
    
    int main() {
        long double d;
        cin >> d;
        cout << setprecision(10) << d << endl;
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class cl1: class c1 { long double * coords; ... }
Whats the best way to convert int's, long's, double's to strings and vice versa
I have used this : long double f =79228162514264337593543950336.0;//maximum ; 2 ^ 96 because
I want the user to enter a string, double and a long, but the
double fat = 0.2654654645486684646846865584656566554566556564654654899866223625564668186456564564664564; cout<<fat<<endl; results in: 0.265465 Should it be 7 charcters longer?
I have a long double constant that I am setting either as const or
i have a c function which returns a long double . i'd like to
I have a class in system-C with some data members as such: long double
i have a problem in calc of pi, when i put long double in
Using long double I get 18/19 = 0.947368421052631578... , and 947368421052631578 is the repeating

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.