class NumRu::UNumeric

Class of Numeric with Units.

Dependent on NumRu::Units and Rational, a standard library.

Class Methods

new(val, uni)

Constractor.

ARGUMENTS

[val, uni]

Same as new

from_date(date, units)

Convert a DateTime (or Date) to a UNUmeric

ARGUMENTS

Methods

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 +.

**(num)

Power.

abs

Absolute value. Other math functions are also avialable as instance methods.

to_datetime(eps_sec=0.0)

Convert a time UNumeric into a DateTime

ARGUMENTS

RETURN VALUE

EXCEPTION

strftime(fmt)

Text expression of the date and time of a time UNumeric. Implemented as

self.to_datetime(0.1).strftime(fmt)

ARGUMENTS

RETURN VALUE