From 39ea2c0bc49d812f41dcbbed6635e25607f80970 Mon Sep 17 00:00:00 2001 From: Nick Walker Date: Tue, 28 Mar 2017 13:16:26 -0700 Subject: Add a round function to complement ceiling and floor --- functions/round.pp | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 functions/round.pp (limited to 'functions/round.pp') 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 ) + } +} -- cgit v1.2.3