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

  • SEARCH
  • Home
  • 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 3963320
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:12:05+00:00 2026-05-20T03:12:05+00:00

i have a file and two inputs are shown below: 34.800287000 0.077352000 i’m reading

  • 0

i have a file and two inputs are shown below:

34.800287000 0.077352000

i’m reading from a file(by getline then define stringstream) and saving it in my class variables which are both defined double. However
when i check my variables i see that:

34.8003 0.077352

EDIT: i’m using cout to check my variables.

why is that ?

thanks.

  • 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-05-20T03:12:05+00:00Added an answer on May 20, 2026 at 3:12 am

    The standard IO streams classes have a limit to their precision that can be customized at runtime. By default I believe it’s six places, which matches the output you’re getting above. If you want to increase the precision, you can use the setprecision stream manipulator:

    double myValue = /* ... */
    cout << setprecision(12) << myValue << endl; // Print with higher precision
    

    The setprecision manipulator is defined in <iomanip> and when used once will change the behavior of cout to print at higher precision for the rest of the program, which in your case may be helpful. Try this out and see if your numbers really are losing precision.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two .csv files containing correlation matrices exported from R. One file contains
Given I have two File objects I can think of the following implementation: public
Possible Duplicate: How to use include within a function? i have two file inc.php
I have a text file containing two or more types of lines. I would
I have two csv file ( ) I can get it to print out
I have two text file. file1.txt has: gedit google chrome git vim foo bar
I have two csv file. First File has date offerid clicks orders Second File
I have two quick questions: When do two file descriptors point to the same
I have a file in which each line contains two numbers. The problem is
I have a file named file with three lines: line one line two line

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.