Precision
is a Mix-in
for concrete numerical classes
with precision.
Here, `precision' means the fineness of approximation of a real number,
so, this module should not be included into non-subset of real,
e.g. abstract numerical, complex, matrix.
induced_from(number)
Creates an ojbect which is converted from number
.
Since it raise TypeError in default, redefine before uses.
Note that a use of prec
in a redefinition
may causes an infinite loop.
prec(klass)
Converts self
into a object of klass.
In default, prec
invokes
klass.induced_from(self)
and returns its value. So, if klass.induced_from
doesn't correspond to the class of self, it is neccessary to redefine
this prec
.
prec_i
Returns an integer converted from self
.
It is equivalent to
prec(Integer)
.
prec_f
Returns a floating-point number converted from self
.
It is equivalent to
prec(Float)
.