Class: Maxima::Float
Constant Summary collapse
- ZERO =
Float.new(0).freeze
Instance Attribute Summary collapse
-
#real ⇒ Object
Returns the value of attribute real.
Attributes inherited from Unit
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #derivative(v: nil) ⇒ Object
- #imaginary? ⇒ Boolean
-
#initialize(real = nil, **options) ⇒ Float
constructor
A new instance of Float.
- #real? ⇒ Boolean
- #to_f ⇒ Object
Methods inherited from Unit
#==, #===, #at, #gnu_plot_options, #gnu_plot_text, #gnu_plot_w, #inspect, #negative?, parse, parse_float, #positive?, #simplified, #through_maxima, #to_gnu_plot, #to_maxima_input, #to_pdf, #to_s, #with_plot_title, #zero?
Constructor Details
#initialize(real = nil, **options) ⇒ Float
Returns a new instance of Float.
12 13 14 15 16 |
# File 'lib/maxima/float.rb', line 12 def initialize(real = nil, **) [:maxima_output] ||= real&.to_s super(**) @real = (real || @maxima_output).to_f end |
Instance Attribute Details
#real ⇒ Object
Returns the value of attribute real.
10 11 12 |
# File 'lib/maxima/float.rb', line 10 def real @real end |
Instance Method Details
#<=>(other) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/maxima/float.rb', line 18 def <=>(other) case other when ::Float, Float @real <=> other.to_f else -1 end end |
#derivative(v: nil) ⇒ Object
39 40 41 |
# File 'lib/maxima/float.rb', line 39 def derivative(v: nil) ZERO end |
#to_f ⇒ Object
27 28 29 |
# File 'lib/maxima/float.rb', line 27 def to_f @real end |