Class: Float

Inherits:
Object show all
Defined in:
lib/sxp/writer.rb

Overview

Extensions for Ruby's Float class.

Instance Method Summary (collapse)

Instance Method Details

- (String) to_sxp

Returns the SXP representation of this object.

Returns:



92
93
94
95
96
97
98
# File 'lib/sxp/writer.rb', line 92

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