Take the following piece of code:
library(dplyr)
x <- c(8.98)
t <- tibble(x)
t %>%
mutate(y = map_dbl(1:1, ~ slice(t,.x) %>% pull(.,x) %>% sqrt())) %>%
mutate(across(2,round,3))
Its output is:
# A tibble: 1 × 2
x y
<dbl> <dbl>
1 8.98 3.00
However, the code round(sqrt(8.98),3)
produces 2.997
, while, in the tibble, the result is 3.00
.
Should not both results be exactly the same? Is this a bug or something we should be expecting?