Next: , Previous: Number-shortcuts and iterators, Up: Number


1.119.13 Number: testing

closeTo: num
Answer whether the receiver can be considered sufficiently close to num (this is done by checking equality if num is not a number, and by checking with 0.01% tolerance if num is a number).


even
Returns true if self is divisible by 2


isFinite
Answer whether the receiver represents a finite quantity. Most numeric classes are for finite quantities, so the default is to answer true rather than calling #subclassResponsibility.


isInfinite
Answer whether the receiver represents an infinite quantity. Most numeric classes are for finite quantities, so the default is to answer false rather than calling #subclassResponsibility.


isNaN
Answer whether the receiver is a Not-A-Number. Most numeric classes don't handle nans, so the default is to answer false rather than calling #subclassResponsibility.


isNumber
Answer `true'.


isRational
Answer whether the receiver is rational - false by default


negative
Answer whether the receiver is < 0


odd
Returns true if self is not divisible by 2


positive
Answer whether the receiver is >= 0


sign
Returns the sign of the receiver.


strictlyPositive
Answer whether the receiver is > 0