With the following example, only 2 bins were drawn instead of specified 3.
library(palmerpenguins)
library(ggplot2)
ggplot(penguins, aes(x= body_mass_g)) +
geom_histogram(bins=3)

However, by addtionally specifying the center, number of bins is correct.
ggplot(penguins, aes(x= body_mass_g)) +
geom_histogram(bins= 3, center = 2700)

Without specification of the center, this mistake happens exactly if $min \times(2\times bins + 1) = 3\times max$, where $min$ and $max$ is the minimum and maximum of the variable, respectively. This equation is equivalent to the situation where shift = 1 in the internal function bin_breaks_width
.