Quote:
Originally Posted by EthanMiller
I changed the code on the NXT to be -.5 instead of -1/2 and it works fine now - Why is that?
|
1 is an integer. 2 is an integer. When C sees "1/2", it does an integer division and produces an integer result. The integer result of 1/2 is 0.
I assume
writeDebugStreamLine() uses the same format strings as the C standard library?
%d specifies an
int. If you give it a
double (a floating point value), the number will be interpreted (and printed) incorrectly. Use
%f instead.