An exact, unlimited representation of a decimal number

Mimics
Inactive cells
Active cells
Specs
Inactive cells (details)
kind = "Number Decimal"
Active cells (details)
*(multiplier)

returns the product of this number and the argument. if the argument is a rational, the receiver will be converted into a form suitable for multiplying against a decimal, and then multiplied. if the argument is neither a Rational nor a Decimal, it tries to call asDecimal, and if that fails it signals a condition.

**(exponent)

returns this number to the power of the argument (which has to be an integer)

+(addend)

returns the sum of this number and the argument. if the argument is a rational, it will be converted into a form suitable for addition against a decimal, and then added. if the argument is neither a Rational nor a Decimal, it tries to call asDecimal, and if that fails it signals a condition.

-(subtrahend)

returns the difference between this number and the argument. if the argument is a rational, it will be converted into a form suitable for subtracting against a decimal, and then subtracted. if the argument is neither a Rational nor a Decimal, it tries to call asDecimal, and if that fails it signals a condition.

/(divisor)

returns the quotient of this number and the argument.

<=>(other)

compares this number against the argument, returning -1, 0 or 1 based on which one is larger. if the argument is a rational, it will be converted into a form suitable for comparing against a decimal, and then compared. if the argument is neither a Rational nor a Decimal, it tries to call asDecimal, and if that doesn't work it returns nil.

==(other)

compares this number against the argument, true if this number is the same, otherwise false

===(other)

nil

method(other, 
  if(self same?(
      0.0), 
    Reflector other:mimics?(cell(:other), 
      0.0), 
    bind(rescue(Condition Error, fn(c, false)), 
      self ==(
        other))))
asText()

Returns a text representation of the object

hash()

returns a hash for the decimal number

inspect()

Returns a text inspection of the object

notice()

Returns a brief text inspection of the object

sqrt()

returns the square root of the receiver. this should return the same result as calling ** with 0.5