Ruby/Справочник/Math: различия между версиями

Содержимое удалено Содержимое добавлено
Нет описания правки
Строка 40:
<tt>Math.atan2(y, x) =&gt; float</tt>
----
ComputesВычисляет theарктангенс arcзаданный tangent givenчислами <i>y</i> andи <i>x</i>. ReturnsВозвращает значения в диапазоне -PI..PI.
===Math::atanh===
----
<tt>Math.atanh(x) =&gt; float</tt>
----
Вычисляет значение обратной функции гиперболического тангенса числа <i>x</i>.
Computes the inverse hyperbolic tangent of <i>x</i>.
===Math::cos===
----
<tt>Math.cos(x) =&gt; float</tt>
----
Вычисляет косинус угла <i>x</i> (заданного в радианах). Возвращает значения в диапазоне -1..1.
Computes the cosine of <i>x</i> (expressed in radians). Returns -1..1.
===Math::cosh===
----
<tt>Math.cosh(x) =&gt; float</tt>
----
Вычисляет гиперболический косинус угла <i>x</i> (заданного в радианах).
Computes the hyperbolic cosine of <i>x</i> (expressed in radians).
===Math::erf===
----
<tt>Math.erf(x) =&gt; float</tt>
----
Вычисляет погрешность функции x.
Calculates the error function of x.
===Math::erfc===
----
<tt>Math.erfc(x) =&gt; float</tt>
----
Вычисляет дополнительную погрешность функции x.
Calculates the complementary error function of x.
===Math::exp===
----
<tt>Math.exp(x) =&gt; float</tt>
----
Возвращает e**x (экспоненту числа х).
Returns e**x.
===Math::frexp===
----
<tt>Math.frexp(numeric) =&gt; [ fraction, exponent ]</tt>
----
Представляет число <i>numeric</i> в виде приведенного дробного числа (типа [[Ruby/Справочник/Float|Float]]) и экспоненты (типа [[Ruby/Справочник/Fixnum|Fixnum]]). Возвращает массив из двух элементов, где первый элемент — дробное число, а второй — экспонента.
Returns a two-element array containing the normalized fraction (a <tt>Float</tt>) and exponent (a <tt>Fixnum</tt>) of <i>numeric</i>.
<code>fraction, exponent = Math.frexp(1234) #=&gt; [0.6025390625, 11]
fraction * 2**exponent #=> 1234.0</code>
Строка 82:
<tt>Math.hypot(x, y) =&gt; float</tt>
----
ReturnsВозвращает sqrt(x**2 + y**2), theто hypotenuseесть ofгипотенузу aпрямоугольного right-angledтреугольника triangleс with sidesкатетами <i>x</i> andи <i>y</i>.
<code>Math.hypot(3, 4) #=&gt; 5.0</code>
===Math::ldexp===
Строка 88:
<tt>Math.ldexp(flt, int) -&gt; float</tt>
----
ReturnsВозвращает theрезультат value ofвыражения <i>flt</i>*(2**<i>int</i>).
<code>fraction, exponent = Math.frexp(1234)
Math.ldexp(fraction, exponent) #=> 1234.0</code>
Строка 95:
<tt>Math.log(numeric) =&gt; float</tt>
----
ReturnsВозвращает theнатуральный naturalлогарифм logarithm ofчисла <i>numeric</i>.
===Math::log10===
----
<tt>Math.log10(numeric) =&gt; float</tt>
----
ReturnsВозвращает theдесятичный baseлогарифм 10 logarithm ofчисла <i>numeric</i>.
===Math::sin===
----
<tt>Math.sin(x) =&gt; float</tt>
----
ComputesВычисляет theсинус sine ofугла <i>x</i> (expressedзаданного inв radiansрадианах). Returns -1..1.
===Math::sinh===
----
<tt>Math.sinh(x) =&gt; float</tt>
----
Вычисляет гиперболический синус угла <i>x</i> (заданного в радианах).
Computes the hyperbolic sine of <i>x</i> (expressed in radians).
===Math::sqrt===
----
<tt>Math.sqrt(numeric) =&gt; float</tt>
----
Извлекает квадратный корень из неотрицательного числа <i>numeric</i>.
Returns the non-negative square root of <i>numeric</i>.
===Math::tan===
----
<tt>Math.tan(x) =&gt; float</tt>
----
Вычисляет тангенс угла <i>x</i> (заданного в радианах).
Returns the tangent of <i>x</i> (expressed in radians).
===Math::tanh===
----
<tt>Math.tanh() =&gt; float</tt>
----
Вычисляет гиперболический тангенс угла <i>x</i> (заданного в радианах).
Computes the hyperbolic tangent of <i>x</i> (expressed in radians).