instance method
Float#abs
() -> ::Float
float.abs → float
numeric.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/numeric.rb, line 373
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