I wrote simple program (it's simple version of me last home work) and i dont understand why it dont show ERROR when X=2 and where line with X=3 disapears.
Is it posible to limit real number to format 12345.67 (2 digitals after point ) ?
P.s. why 2-2=2,2*10^-16 instead of 0
Well, for one thing:
You're error-checking for t = x-C != 0, but dividing by C-x. Deduction is not commutative. You did it right the second time around.
Floating point math is imperfect. However, for most applications, it is more than precise enough. The output can simply be confusing. Just keep in mind that when dealing with deductions and comparing the result to zero, you might want to compare to an insignificantly small number instead. I use: #define zero 0.000001
Change it according to your own precision requirements.