mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
parent
97cf290063
commit
fad7908a5d
Notes:
git
2021-02-09 13:30:07 +09:00
Merged-By: k0kubun <takashikkbn@gmail.com>
3 changed files with 30 additions and 30 deletions
22
numeric.rb
22
numeric.rb
|
@ -204,4 +204,26 @@ class Float
|
|||
Primitive.attr! 'inline'
|
||||
Primitive.cexpr! 'FLOAT_ZERO_P(self) ? Qtrue : Qfalse'
|
||||
end
|
||||
|
||||
#
|
||||
# call-seq:
|
||||
# float.positive? -> true or false
|
||||
#
|
||||
# Returns +true+ if +float+ is greater than 0.
|
||||
#
|
||||
def positive?
|
||||
Primitive.attr! 'inline'
|
||||
Primitive.cexpr! 'RFLOAT_VALUE(self) > 0.0 ? Qtrue : Qfalse'
|
||||
end
|
||||
|
||||
#
|
||||
# call-seq:
|
||||
# float.negative? -> true or false
|
||||
#
|
||||
# Returns +true+ if +float+ is less than 0.
|
||||
#
|
||||
def negative?
|
||||
Primitive.attr! 'inline'
|
||||
Primitive.cexpr! 'RFLOAT_VALUE(self) < 0.0 ? Qtrue : Qfalse'
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue