r.round(number) → number
number.round() → number
Rounds the given value to the nearest whole integer.
For example, values of 1.0 up to but not including 1.5 will return 1.0, similar to floor; values of 1.5 up to 2.0 will return 2.0, similar to ceil.
Example: Round 12.345 to the nearest integer.
r.round(12.345).run(conn);
// Result:
12.0
The round
command can also be chained after an expression.
Example: Round -12.345 to the nearest integer.
r.expr(-12.345).round().run(conn);
// Result:
-12.0
Example: Return Iron Man’s weight, rounded to the nearest integer.
r.table("superheroes").get("ironman").g("weight").round().run(conn);
Couldn't find what you were looking for?
Contribute: edit this page or open an issue