in reply to Using (s)printf()

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