Simple code for a beginner

+1 Yolanda Turnsplenty · November 14, 2015
How to writ a bool function Equals that takes 2 float parameters (x and y), and returns true if their difference is less than 0.00000001, and false otherwise?

Post a Reply

Replies

Oldest  Newest  Rating
0 Scott Walker · November 15, 2015
When the original guy deletes his post :-) :-)
No time for idiots on here :-)
0 Yolanda Turnsplenty · November 24, 2015
thank you so much!
0 Yolanda Turnsplenty · November 17, 2015
:) Thank You Very Much!!
0 Yolanda Turnsplenty · November 18, 2015
What do you think of this;

float Equals(float x, float y) {
       float diff = fabs(x-y);
       return (diff < 0.00000001);
}
0 Myron Ortiz · November 19, 2015
@Krootushas Gesu 

+1 on the "f" on the float.
0 Brandon Li · December 13, 2015
lemme see

float x;
float y;
float check; 

check = float x - float y

if(check<0.00000001 )
{
return true;
}

I think. If i got it wrong then yeah. I haven't been programming in a long time. About 1 year.
  • 1

C++

106,968 followers
About

Used in many types of software including music players, video games, and many large scale applications.

Links
Moderators
Bucky Roberts Administrator