greta-dev / greta-dev/greta

Make `greta::round` use tensorflow digits arg instead of warning

Open
#532 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
607
Forks
67
Avg merge
3d 8h
Merged PRs (30d)
1

Description

See https://forum.greta-stats.org/t/rounding-error-stan-model-in-greta/324/6 from @goldingn

- something like:

```r
tf_round <- function(x, digits) {
# round the digits to nearest integer, to match R's round behaviour
digits <- tf$round(digits)
# convert to a factor of 10
factor <- fl(10) ^ digit
# scale, round to integer, unscale
tf$round(x * factor) / factor
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.