Method: XPath::XPathNumber#round
- Defined in:
- lib/xml/xpath.rb
#round ⇒ Object
777 778 779 780 781 782 783 784 785 786 787 788 789 |
# File 'lib/xml/xpath.rb', line 777 def round f = @value unless f.nan? or f.infinite? then if f >= 0.0 then @value = f.round.to_f elsif f - f.truncate >= -0.5 then @value = f.ceil.to_f else @value = f.floor.to_f end end self end |