File: ref_m_math.html

package info (click to toggle)
rubybook 0.2.1-1
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k, lenny, squeeze, wheezy
  • size: 4,248 kB
  • ctags: 1,042
  • sloc: xml: 60,486; makefile: 25
file content (143 lines) | stat: -rw-r--r-- 7,468 bytes parent folder | download | duplicates (3)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<html><title>Programming Ruby: The Pragmatic Programmer's Guide</title><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><STYLE TYPE="text/css"><!--
       BODY    { margin-left: 1in;
                 width: 6in;
                 font-family: helvetica, arial, sans-serif;
               }
       H1      { color: #000080;
                 font-family: helvetica, arial, sans-serif;
                 font-size: 22pt;
                 margin-left: 0in
               }
       H2      { color: #000080;  font: bold x-large helvetica, sans-serif;
                 margin-left: 0in }
       H3      { color: #000080;  font: bold   large helvetica, sans-serif; }
       H4      { color: #000080;  font: italic large helvetica, sans-serif; }
       .ruby   { background: #fff0f0 }
       .header { color: white }
       .subheader { color: #ffdddd }
       .sidebar   { width: 6in }
       span.sans { font-family: helvetica, arial, sans-serif }
       -->
   </STYLE><table bgcolor="#a03030" cellpadding="3" border="0" cellspacing="0"><tr><td colspan="3"><table bgcolor="#902020" cellpadding="20"><tr><td><h1 class="header">Programming Ruby</h1><h3 class="subheader">The Pragmatic Programmer's Guide</h3></td></tr></table></td></tr><tr><td width="33%" align="left"><a class="subheader" href="ref_m_marshal.html">Previous &lt;</a></td><td width="33%" align="center" valign="middle"><a class="subheader" href="builtins.html">Contents ^</a><br></td><td width="33%" align="right"><a class="subheader" href="ref_m_objectspace.html">Next ></a><br></td></tr></table></head><body bgcolor="white">
<!--
    Copyright (c) 2001 by Addison Wesley Longman.  This
    material may be distributed only subject to the terms and
    conditions set forth in the Open Publication License, v1.0 or
    later (the latest version is presently available at
    http://www.opencontent.org/openpub/).
-->
<table><tr><td height="20"><img src="dot.gif" width="1" height="20"></td></tr></table><table border="0" width="100%" bgcolor="660066" cellpadding="10"><tr><td valign="center"><font color="white" size="7">module Math</font></td></tr></table><p></p><H3>Index:</H3><a href="#atan2">atan2</a> <a href="#cos">cos</a> <a href="#exp">exp</a> <a href="#frexp">frexp</a> <a href="#ldexp">ldexp</a> <a href="#log">log</a> <a href="#log10">log10</a> <a href="#sin">sin</a> <a href="#sqrt">sqrt</a> <a href="#tan">tan</a> <p></p><hr>
<P></P>
  The <code>Math</code> module contains module functions for basic
  trigonometric and transcendental functions.    
<P></P>
  <table border="0" width="100%" cellpadding="10"><tr><td valign="center" colspan="3" bgcolor="990066"><font color="white" size="6">
         constants
       </font></td></tr></table><table border="2" cellpadding="5">
<tr>
  <td valign="top">
  <tr>
       <td><a name="E"><code>E</code></a></td>
       <td>2.718281828</td>
       <td>Value of e (base of natural
    logarithms)</td>
     </tr>
<P></P>
  <tr>
       <td><a name="PI"><code>PI</code></a></td>
       <td>3.141592654</td>
       <td>Value of PI</td>
     </tr>
</td>
</tr>
</table><p></p>
<P></P>
  <table border="0" width="100%" cellpadding="10"><tr><td valign="center" colspan="2" bgcolor="990066"><font color="white" size="6">class methods
       </font></td></tr><tr><td valign="center" bgcolor="#ff9999"><font size="4"><a name="atan2"><b>atan2</b></a></font></td><td bgcolor="#ffaaaa">
        Math.atan2( <i>y, x</i> )
        -> <i>aFloat</i>
      </td></tr><td></td><td>
<P></P>
      Computes the arc tangent given <i>y</i> and <i>x</i>. Returns -PI..PI.
<P></P>
      </td><tr><td valign="center" bgcolor="#ff9999"><font size="4"><a name="cos"><b>cos</b></a></font></td><td bgcolor="#ffaaaa">
        Math.cos( <i>aNumeric</i> )
        -> <i>aFloat</i>
      </td></tr><td></td><td>
<P></P>
      Computes the cosine of <i>aNumeric</i> (expressed 
      in radians).
      Returns -1..1.
<P></P>
      </td><tr><td valign="center" bgcolor="#ff9999"><font size="4"><a name="exp"><b>exp</b></a></font></td><td bgcolor="#ffaaaa">
        Math.exp( <i>aNumeric</i> )
        -> <i>aFloat</i>
      </td></tr><td></td><td>
<P></P>
      Returns e raised to the power of <i>aNumeric</i>.
<P></P>
      </td><tr><td valign="center" bgcolor="#ff9999"><font size="4"><a name="frexp"><b>frexp</b></a></font></td><td bgcolor="#ffaaaa">
        Math.frexp( <i>aNumeric</i> )
        -> <i>anArray</i>
      </td></tr><td></td><td>
<P></P>
      Returns a two-element array ([<i>aFloat, aFixnum</i>]) containing
      the normalized fraction and exponent of <i>aNumeric</i>.
<P></P>
      </td><tr><td valign="center" bgcolor="#ff9999"><font size="4"><a name="ldexp"><b>ldexp</b></a></font></td><td bgcolor="#ffaaaa">
        Math.ldexp( <i>aFloat</i>, <i>anInteger</i> )
        -> <i>aFloat</i>
      </td></tr><td></td><td>
<P></P>
      Returns the value of <i>aFloat</i> *2<sup><i>anInteger</i></sup>.
<P></P>
      </td><tr><td valign="center" bgcolor="#ff9999"><font size="4"><a name="log"><b>log</b></a></font></td><td bgcolor="#ffaaaa">
        Math.log( <i>aNumeric</i> )
        -> <i>aFloat</i>
      </td></tr><td></td><td>
<P></P>
      Returns the natural logarithm of <i>aNumeric</i>.
<P></P>
      </td><tr><td valign="center" bgcolor="#ff9999"><font size="4"><a name="log10"><b>log10</b></a></font></td><td bgcolor="#ffaaaa">
        Math.log10( <i>aNumeric</i> )
        -> <i>aFloat</i>
      </td></tr><td></td><td>
<P></P>
      Returns the base 10 logarithm of <i>aNumeric</i>.
<P></P>
      </td><tr><td valign="center" bgcolor="#ff9999"><font size="4"><a name="sin"><b>sin</b></a></font></td><td bgcolor="#ffaaaa">
        Math.sin( <i>aNumeric</i> )
        -> <i>aFloat</i>
      </td></tr><td></td><td>
<P></P>
      Computes the sine of <i>aNumeric</i> (expressed in 
      radians). Returns -1..1.
<P></P>
      </td><tr><td valign="center" bgcolor="#ff9999"><font size="4"><a name="sqrt"><b>sqrt</b></a></font></td><td bgcolor="#ffaaaa">
        Math.sqrt( <i>aNumeric</i> )
        -> <i>aFloat</i>
      </td></tr><td></td><td>
<P></P>
      Returns the non-negative square root of <i>aNumeric</i>.
      Raises <code>ArgError</code> if <i>aNumeric</i> is less than zero.
<P></P>
      </td><tr><td valign="center" bgcolor="#ff9999"><font size="4"><a name="tan"><b>tan</b></a></font></td><td bgcolor="#ffaaaa">
        Math.tan( <i>aNumeric</i> )
        -> <i>aFloat</i>
      </td></tr><td></td><td>
<P></P>
      Returns the tangent of <i>aNumeric</i> (expressed in radians).
<P></P>
      </td></table>
<P></P>

<p></p><hr><table bgcolor="#a03030" cellpadding="10" border="0" cellspacing="0"><tr><td width="33%" align="left"><a class="subheader" href="ref_m_marshal.html">Previous &lt;</a></td><td width="33%" align="center" valign="middle"><a class="subheader" href="builtins.html">Contents ^</a><br></td><td width="33%" align="right"><a class="subheader" href="ref_m_objectspace.html">Next ></a><br></td></tr></table><p></p><font size="-1">Extracted from the book "Programming Ruby -
     The Pragmatic Programmer's Guide"</font><br><font size="-3">
      Copyright
      &#169;
      2000 Addison Wesley Longman, Inc. Released under the terms of the
      <a href="http://www.opencontent.org/openpub/">Open Publication License</a> V1.0.
        <br>
      This reference is available for
        <a href="http://www.pragmaticprogrammer.com/ruby/downloads/book.html">download</a>.
   </font></body></html>