You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have no idea if this project is still alive or not. But i found mistake in the 64bit print function. Following code produces incorrect output for certain numbers. Eg. -1000000019516.
I have no idea if this project is still alive or not. But i found mistake in the 64bit print function. Following code produces incorrect output for certain numbers. Eg. -1000000019516.
int64_t sec, secx, frac, frach, fracx, fracl;
char str[128];
sec = abs(x / 1000000000000); // hopefully avoid double negative sign. Thanks, Curt!
secx = sec * 1000000000000;
frac = abs(x - secx);
// break fractional part of seconds into two 6 digit numbers
frach = frac / 1000000;
fracx = frach * 1000000;
fracl = frac - fracx;
I suggest to rewrite the calculations as following:
sec = ABS(x / 1000000000000);
frac = ABS(x % 1000000000000);
// break fractional part of seconds into two 6 digit numbers
frach = frac / 1000000;
fracl = frac % 1000000;
I have tested this on both native 64bit machine and 32bit mcu.
The text was updated successfully, but these errors were encountered: