My guess: printf will round off to get what you expected, while sprintf %d does an int() which simply truncates. If the value were actually 14719.999999999999997, then that would explain the difference.
Note that floating point binary can't hold 1/10 exactly any more than decimal can hold 1/3 exactly.
Try using %.15f on such a value and see closer too what's really stored.
In reply to Re: floating points and sprintf
by John M. Dlugosz
in thread floating points and sprintf
by kennethwlangley
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |