-2

I have a problem with the length of the returning value of the function, When I calculate stuff it gives me varibles with different length, thats why I cant sum them and compare.

For example: the function calculates the length of the line AC it gives 4.24264 the line AC consists of two other lines AB and BC which are AB = 0.942809 and BC=3.29983 when you sum AB and BC it equals of 4.242639 but the same function gives 4.24264, so C++ does not say that they are equal, so how do I change that?

EDIT: function returns double and all of the variables are double

edtheprogrammerguy
  • 5,957
  • 6
  • 28
  • 47
eLbor
  • 45
  • 9

1 Answers1

4

Looks like you're dealing with float / double comparison. This might help.

Community
  • 1
  • 1
mbmc
  • 5,024
  • 5
  • 25
  • 53