1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
<?xml version="1.0" ?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>lib/numru/misc/emath.rb</title>
</head>
<body>
<h1><a name="label:0" id="label:0">module NumRu::Misc::EMath</a></h1><!-- RDLabel: "module NumRu::Misc::EMath" -->
<p>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).</p>
<p>Therefore, if included, its function (module method) is used as:</p>
<pre>cos( obj )</pre>
<p>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).</p>
<p>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.</p>
</body>
</html>
|