Class of Numeric with Units.
Dependent on NumRu::Units and Rational, a standard library.
new(val, uni)
Constractor.
ARGUMENTS
val
RETURN VALUE
units
RETURN VALUE
inspect
RETURN VALUE
to_s
aliasesed to inspect.
to_f
RETURN VALUE
to_i
RETURN VALUE
convert(to_units)
Convert to to_units.
RETURN VALUE
EXCEPTION
convert2
Same as convert, but returns self if the units are incompatible (Warned).
EXCEPTION
WARING MADE
Warning is made to $stderr if the following condition is satisfied.
coerce(other)
As you know. Can handle Numeric, Array, NArray. NOTE: VArray and GPhys know UNumeric.
*(other)
Multiplication. Knows Numeric, UNumeric, VArray, and GPhys. The units are multipled too. (if other is Numeric, it is assumed to be non-dimension)
RETURN VALUE
/(other)
Division. See *.
+(other)
Addition. Knows Numeric, UNumeric, VArray, and GPhys. The return value will have the units of self.
SPECIAL REMARK!
If other has units within a factor and/or offset of difference, It is CONVERTED before addition (by using convert2)!
RETURN VALUE
WARING MADE
Warning is made to $stderr if the following condition is satisfied.
-(other)
Subtraction. See +.