Class: Float

Inherits:
Object show all
Defined in:
vendor/bundler/ruby/2.5.0/bundler/gems/sxp.rb-ff0ae90d6303/lib/sxp/writer.rb

Overview

Extensions for Ruby's Float class.

Instance Method Summary collapse

Instance Method Details

#to_sxpString

Returns the SXP representation of this object.

Returns:



108
109
110
111
112
113
114
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/sxp.rb-ff0ae90d6303/lib/sxp/writer.rb', line 108

def to_sxp
  case
    when nan? then 'nan.'
    when infinite? then (infinite? > 0 ? '+inf.' : '-inf.')
    else to_s
  end
end