digits after comma when passing double variable to function

Hello guys,

I have following problem, and I already searched in many different ones but couldn't find a solution.

Basically I have two double variables e.g. Coordinate x and y:

double x = 52.123456789;
double y = 8.123456789;

Now i pass these two variables to a function that expects two double values!

E.g.: Imagine there is a function Circle that expects two double varibles to draw a circle around the center of the coordinates

Circle(x,y);

The problem is, that somehow the coordinates are cut after 6 digits.
Something like that:
x = 52.1235;
y = 8.12346;

My question is not how to set the output to a certain amount of digits with std::cout.setprecision() and so on. I want to know if there is a possibility to fix the number of digits when you pass double variables to a function!?

Please help me with that!

Thanks and best regards, Matthias
The values aren't changed, they're passed as you've initialised them.

It's possible that you're not displaying them correctly, but that's just a display matter.
1
2
3
4
5
6
7
8
9
10
11
#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
        double n = 123.12345678901234567890;

        cout << setprecision(25) << n << endl;
}

123.1234567890123514644074
Topic archived. No new replies allowed.