Ruby 4.0 リファレンスマニュアル

instance method Float#negative?

negative? -> boolRuby 2.3.0 から[permalink][rdoc][edit]

self が負の数なら true を、そうでないなら false を返します。

p -0.1.negative? # => true
p 0.0.negative?  # => false
p 0.1.negative?  # => false

# 負の無限大も負
p (-Float::INFINITY).negative? # => true

p -0.0.negative? # => false
# 負とはみなされないことに注意

[SEE_ALSO] Float#positive?