Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Coding - Comparison test gone wrong?
#1
I'm sure I just made a silly mistake somewhere, I just don't know where. Observe the highlighted piece of code:

 screenshot

 excerpted for your convenience
 sample output of the program

It doesn't do much, take an initial x value, do stuff with it, decrement by deltaX until it hits limit, abort.

The problem is, x > limit returns true when x = limit (as in this example, x = limit = 0.7)

Code:
fprintf("x = %.1f, limit = %.1f, x > limit : %d\n", (x), limit, (x>limit));
Code:
x = 0.7, limit = 0.7, x > limit : 1
Reply


Messages In This Thread
Coding - Comparison test gone wrong? - by Kalovale - 2011-11-29, 04:06 PM
Coding - Comparison test gone wrong? - by Nikkey - 2011-11-29, 05:40 PM
Coding - Comparison test gone wrong? - by sicnarf - 2011-11-29, 08:12 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)