Recent AVR-LibC FAQ submission of mine:
Why is my AVR baud rate wrong?
Some AVR datasheets give the following formula for calculating baud rates:
(F_CPU/(UART_BAUD_RATE*16L)-1)
Unfortunately that formula does not work with all combinations of clock speeds and baud rates due to integer truncation during the division operator.
When doing integer division it is usually better to round to the nearest integer, rather than to the lowest. To do this add 0.5 (i.e. half the value of the denominator) to the numerator before the division, resulting in the formula:
((F_CPU + UART_BAUD_RATE * 8L) / (UART_BAUD_RATE * 16L) - 1)