4 module Puppet::Parser::Functions
5 newfunction(:round, :type => :rvalue, :doc => <<-DOC
7 Rounds a number to the nearest integer
10 the rounded value as integer
14 ```round(2.9)``` returns ```3```
16 ```round(2.4)``` returns ```2```
18 > *Note:* from Puppet 6.0.0, the compatible function with the same name in Puppet core
19 will be used instead of this function.
23 raise Puppet::ParseError, "round(): Wrong number of arguments given #{args.size} for 1" if args.size != 1
24 raise Puppet::ParseError, "round(): Expected a Numeric, got #{args[0].class}" unless args[0].is_a? Numeric