Your statement and example under "Rounding Numbers with sprintf()" is incorrect and misleading. Using "%d" does NOT round a float as necessary, it merely truncates everything after the decimal. Thus, printf("%d", 3.99); # will print 3, not 4.
# To properly 'round a float as necessary': printf("%.0f", 3.49); # This will print 3 printf("%.0f", 3.51); # This will print 4
In reply to Re: Using (s)printf()
by Anonymous Monk
in thread Using (s)printf()
by reptile
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |