0
float f = 735.64;    
int i = (int)f;    
float f2 = f - i;    
cout<<f2<<endl;    

The value outputted by f2 is simply not 0.64 but something like 0.6400015 I just want to have the value in f2 as either 0.64 or 0.640000.. so could I do it without using any inbuilt functions as such?

Thanks.

bitbyter
  • 801
  • 1
  • 8
  • 17

1 Answers1

1

you have to understand that there is an error in each number used in a computer, if you find the value of that error and subtracted from the solution, then you will get the actual values. I advise you to study all about "relative error" and "absolute error" these concepts are related to numerical mathematics

Ernesto Alfonso
  • 650
  • 10
  • 30