Class InfinityClass
In: lib/facets/more/infinity.rb
Parent: Numeric

Infinity

A full featured Infinity class, supporting signed direction. Inifinty is a multiton based on direction The constant INFINITY is provided as the common case with direction=+1 (positive).

Usage

  NaN
  Inf
  PosInf
  NegInf

These four constants a built from two other basic constants:

  UNDEFINED
  INFINITY

In physical memory there are actually only three objects, namely three instances of InfinityClass, one for NaN, PosInf and NegInf, respectively.

Methods

+@   -@   <=>   ==   coerce   new   times   to_f   to_s  

Included Modules

Multiton

Classes and Modules

Class InfinityClass::Numeric

Constants

UNDEFINED = InfinityClass.instance(0)   Set constant to positive infinity.
INFINITY = InfinityClass.instance(1)
NaN = UNDEFINED
Inf = INFINITY
PosInf = +INFINITY
NegInf = -INFINITY

Attributes

direction  [R] 

Public Class methods

Public Instance methods

Noop.

Change direction of infinity.

Comparision where infinity is alway greatest and negative infinityalways least.

Equality. Note that NaN != NaN.

Coerce allows other numbers to be compared to infinity.

Gee, a real infinite loop!

Convert to the float version of infinity.

[Validate]