I found some weird things in my code while playing a few of numbers.
Here is the code I am working on.
#include<iostream>
using namespace std;
int main()
{
double f1,f2;
cout << "Enter the floating number" << endl;
cin >> f1;
f2 = 0.00255;
return 0;
}
Adding a breakpoint before return
, I checked the value of f1
and f2
.
Then, I found a difference between f1
and f2
, even though they must be identical.
Below is what I compared in the debugging mode.
Q1. Why are those values different?
The difference is so marginal that they seem identical as 0.00255 but sometimes that small difference could be important in mathematical application.
Q2. How can I make them identical as 0.0025500000000000002?