summaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
authorNick Walker <nick.walker@puppetlabs.com>2017-03-28 13:16:26 -0700
committerNick Walker <nick.walker@puppetlabs.com>2017-07-18 14:50:17 -0700
commit39ea2c0bc49d812f41dcbbed6635e25607f80970 (patch)
tree0da0fc6f1116f665569aa63724e72f5c65b2d725 /functions
parent596878a7bc1fd4a64da89c5c760accb3e8178ec1 (diff)
Add a round function to complement ceiling and floor
Diffstat (limited to 'functions')
-rw-r--r--functions/round.pp9
1 files changed, 9 insertions, 0 deletions
diff --git a/functions/round.pp b/functions/round.pp
new file mode 100644
index 0000000..6bad92d
--- /dev/null
+++ b/functions/round.pp
@@ -0,0 +1,9 @@
+function stdlib::round(
+ Numeric $input,
+) {
+ if $input >= 0 {
+ Integer( $input + 0.5 )
+ } else {
+ Integer( $input - 0.5 )
+ }
+}