Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Float#abs
float.abs → float
numeric.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.3.0/numeric.rb, line 325
def abs
Primitive.attr! :leaf
Primitive.cexpr! 'rb_float_abs(self)'
end
Returns the absolute value of self:
Example
(-34.56).abs # => 34.56 -34.56.abs # => 34.56 34.56.abs # => 34.56