New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rounding (round/floor/ceil) template functions #3883

Closed
jetwash opened this Issue Sep 13, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@jetwash

jetwash commented Sep 13, 2017

Title is pretty self-explanatory.

int can be used instead of floor, but it's a bit of a hack… if you add round/ceil IMHO you may as well add floor, too.

Until this is resolved I plan to work around the lack of ceil with cond (lt (int $x) $x) (int (add $x 1)) (int $x). Round could be emulated in a similar fashion (untested) cond (lt $x ((int $x) + 0.5)) (int $x) (add (int $x) 1).

@bep bep added the Enhancement label Sep 13, 2017

@bep bep added this to the v0.28 milestone Sep 13, 2017

@bep bep modified the milestones: v0.28, v0.29 Sep 21, 2017

moorereason added a commit to moorereason/hugo that referenced this issue Sep 24, 2017

tpl: Add math.Ceil, Floor, and Round
Ceil and Floor are frontends for the stdlib math functions. The Round
implementation is essentially the same thing except that the Go stdlib
doesn't include a Round implementation in a stable release yet.  I've
included the Round function slated for Go 1.10.

Fixes #3883

@bep bep closed this in #3901 Sep 24, 2017

bep added a commit that referenced this issue Sep 24, 2017

tpl: Add math.Ceil, Floor, and Round
Ceil and Floor are frontends for the stdlib math functions. The Round
implementation is essentially the same thing except that the Go stdlib
doesn't include a Round implementation in a stable release yet.  I've
included the Round function slated for Go 1.10.

Fixes #3883
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment