module NumRu::Misc::EMath

To be included instead of the Math predefined module (or NMath in NArray). Unlike Math and NMath, EMath handles unknown classes by calling its native instance method (assuming the same name).

Therefore, if included, its function (module method) is used as:

cos( obj )

and so on. If obj is not of a supported class, EMath calls, obj.cos in this case. (If cos is not a method of obj, then an exception is raised.) Supported classes are Numeric (by Math) and NArray (by NMath). EMath stands for "good Math" (for obvious reason for a Japanese).

Note: as for atan2(a,b), a.atan2(b) will be called if a or b is not supported. This is the case for all functions that take two or more arguments.