Method: XPath::XPathNumber#to_str

Defined in:
lib/xml/xpath.rb

#to_strObject



690
691
692
693
694
695
696
697
698
699
700
701
702
# File 'lib/xml/xpath.rb', line 690

def to_str
  if @value.nan? then
    'NaN'
  elsif @value.infinite? then
    if @value < 0 then
      '-Infinity'
    else
      'Infinity'
    end
  else
    sprintf("%.100f", @value).gsub(/\.?0+\z/, '')    # enough?
  end
end