Type:
Class

When mathn is required, Fixnum's division and exponentiation are enhanced to return more precise values from mathematical expressions.

2/3*3  # => 0
require 'mathn'
2/3*3  # => 2

A Fixnum holds Integer values that can be represented in a native machine word (minus 1 bit). If any operation on a Fixnum exceeds this range, the value is automatically converted to a Bignum.

Fixnum objects have immediate value. This means that when they are assigned or passed as parameters, the actual object is passed, rather than a reference to that object. Assignment does not alias Fixnum objects. There is effectively only one Fixnum object instance for any given integer value, so, for example, you cannot add a singleton method to a Fixnum.

~

~fix â integer Instance Public methods One's complement: returns a number

2015-04-07 00:44:40
>

fix > real â true or false Instance Public methods Returns true

2015-04-06 23:06:38
-@

-fix â integer Instance Public methods Negates fix (which might

2015-04-06 22:38:25
fdiv

fix.fdiv(numeric) â float Instance Public methods Returns the floating point

2015-04-07 00:00:30
-

fix - numeric â numeric_result Instance Public methods Performs subtraction:

2015-04-06 22:31:55
<

fix Instance Public methods Returns true

2015-04-06 22:45:02
power!

power!(other) Instance Public methods Alias for:

2015-04-07 00:21:21
succ

fixnum.next â integerfixnum.succ â integer Instance Public methods Returns

2015-04-07 00:25:45
magnitude

fix.magnitude â integer Instance Public methods Returns the absolute value

2015-04-07 00:12:12
zero?

fix.zero? â true or false Instance Public methods Returns true

2015-04-07 00:37:56