Below is my example code.
Code: Select all
uint64_t tempVal = 315989888600;
chprintf(chp1, "\t tempVal : %d %03d\r\n", (tempVal / 1000), (tempVal % 1000));
uint64_t tempVal2 = tempVal % 1000;
chprintf(chp1, "\t tempVal2: %03d\r\n", tempVal2);
And I got console log like below
Code: Select all
tempVal : 315989888 000
tempVal2: 600
I was expecting
tempVal : 315989888 600
but, got
tempVal : 315989888 000
What am I doing wrong?