I am a first semester C programming student with pretty much no experience but a good head for logic...anyway here is my confusion:
I am reading K.N. Kings "C Programming" Second Edition. Anyways on page 55 he discusses Implementation-Defined Behavior and has this to say:
"Some CPUs yield -1 when -9 is divided by 7, while others produce -2; the C89 standard simply reflects this fact of life." K.N. King
Now in standard arithmetic -9 / 7 = -1.2857142857142857142857142857143
When rounding, as I would assume the CPU would be doing in this instance, assuming that -9 and 7 are stored in integers how could anyone program a CPU to make this -2?
If it is not rounding but rather truncating from what I understand happens it would simply be -1. I have some other math related questions that just simply do not make any sense to me whatsoever yet but I will wait until I thoroughly understand this one.
Thanks for your time,
Bill
p.s. As I understand it in C99 this would always come out to -1 being that the decimal is truncated if you are not using floats or better. This makes sense to me....