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 - numeric â numeric_result Instance Public methods Performs subtraction:

2015-04-06 22:31:55
power!

power!(other) Instance Public methods Alias for:

2015-04-07 00:21:21
inspect

inspect(p1 = v1) Instance Public methods Alias for:

2015-04-07 00:07:31
abs

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

2015-04-06 23:32:25
+

fix + numeric â numeric_result Instance Public methods Performs addition:

2015-04-06 22:29:47
div

fix.div(numeric) â integer Instance Public methods Performs integer division:

2015-04-06 23:43:19
even?

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

2015-04-06 23:53:50