Class: KDL::Value::Float
- Inherits:
-
KDL::Value
- Object
- KDL::Value
- KDL::Value::Float
- Defined in:
- lib/kdl/value.rb
Constant Summary
Constants inherited from KDL::Value
Instance Attribute Summary
Attributes inherited from KDL::Value
Instance Method Summary collapse
Methods inherited from KDL::Value
#as_type, from, #initialize, #to_s
Constructor Details
This class inherits a constructor from KDL::Value
Instance Method Details
#==(other) ⇒ Object
45 46 47 |
# File 'lib/kdl/value.rb', line 45 def ==(other) other.is_a?(Float) && value == other.value end |
#stringify_value ⇒ Object
49 50 51 52 53 54 55 56 57 |
# File 'lib/kdl/value.rb', line 49 def stringify_value return super.upcase unless value.is_a?(BigDecimal) sign, digits, _, exponent = value.split s = sign.negative? ? '-' : '' s += "#{digits[0]}.#{digits[1..-1]}" s += "E#{exponent.negative? ? '' : '+'}#{exponent - 1}" s end |