|
|
|
|
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `libm` crate."><meta name="keywords" content="rust, rustlang, rust-lang, libm"><title>libm - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../libm/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><p class='location'>Crate libm</p><div class="sidebar-elems"><a id='all-types' href='all.html'><p>See all libm's items</p></a><div class="block items"><ul><li><a href="#traits">Traits</a></li><li><a href="#functions">Functions</a></li></ul></div><p class='location'></p><script>window.sidebarCurrent = {name: 'libm', ty: 'mod', relpath: '../'};</script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>−</span>]</a></span><a class='srclink' href='../src/libm/lib.rs.html#1-642' title='goto source code'>[src]</a></span><span class='in-band'>Crate <a class="mod" href=''>libm</a></span></h1><div class='docblock'><p>libm in pure Rust</p>
|
|
|
|
|
<h1 id="usage" class="section-header"><a href="#usage">Usage</a></h1>
|
|
|
|
|
<p>You can use this crate in two ways:</p>
|
|
|
|
|
<ul>
|
|
|
|
|
<li>
|
|
|
|
|
<p>By directly using its free functions, e.g. <code>libm::powf</code>.</p>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<p>By importing the <code>F32Ext</code> and / or <code>F64Ext</code> extension traits to add methods like <code>powf</code> to the
|
|
|
|
|
<code>f32</code> and <code>f64</code> types. Then you'll be able to invoke math functions as methods, e.g. <code>x.sqrt()</code>.</p>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div><h2 id='traits' class='section-header'><a href="#traits">Traits</a></h2>
|
|
|
|
|
<table><tr class='module-item'><td><a class="trait" href="trait.F32Ext.html" title='libm::F32Ext trait'>F32Ext</a></td><td class='docblock-short'><p>Math support for <code>f32</code></p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="trait" href="trait.F64Ext.html" title='libm::F64Ext trait'>F64Ext</a></td><td class='docblock-short'><p>Math support for <code>f64</code></p>
|
|
|
|
|
</td></tr></table><h2 id='functions' class='section-header'><a href="#functions">Functions</a></h2>
|
|
|
|
|
<table><tr class='module-item'><td><a class="fn" href="fn.acos.html" title='libm::acos fn'>acos</a></td><td class='docblock-short'><p>Arccosine (f64)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.acosf.html" title='libm::acosf fn'>acosf</a></td><td class='docblock-short'><p>Arccosine (f32)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.acosh.html" title='libm::acosh fn'>acosh</a></td><td class='docblock-short'><p>Inverse hyperbolic cosine (f64)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.acoshf.html" title='libm::acoshf fn'>acoshf</a></td><td class='docblock-short'><p>Inverse hyperbolic cosine (f32)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.asin.html" title='libm::asin fn'>asin</a></td><td class='docblock-short'><p>Arcsine (f64)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.asinf.html" title='libm::asinf fn'>asinf</a></td><td class='docblock-short'><p>Arcsine (f32)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.asinh.html" title='libm::asinh fn'>asinh</a></td><td class='docblock-short'><p>Inverse hyperbolic sine (f64)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.asinhf.html" title='libm::asinhf fn'>asinhf</a></td><td class='docblock-short'><p>Inverse hyperbolic sine (f32)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.atan.html" title='libm::atan fn'>atan</a></td><td class='docblock-short'><p>Arctangent (f64)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.atan2.html" title='libm::atan2 fn'>atan2</a></td><td class='docblock-short'><p>Arctangent of y/x (f64)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.atan2f.html" title='libm::atan2f fn'>atan2f</a></td><td class='docblock-short'><p>Arctangent of y/x (f32)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.atanf.html" title='libm::atanf fn'>atanf</a></td><td class='docblock-short'><p>Arctangent (f32)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.atanh.html" title='libm::atanh fn'>atanh</a></td><td class='docblock-short'><p>Inverse hyperbolic tangent (f64)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.atanhf.html" title='libm::atanhf fn'>atanhf</a></td><td class='docblock-short'><p>Inverse hyperbolic tangent (f32)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.cbrt.html" title='libm::cbrt fn'>cbrt</a></td><td class='docblock-short'><p>Computes the cube root of the argument.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.cbrtf.html" title='libm::cbrtf fn'>cbrtf</a></td><td class='docblock-short'><p>Cube root (f32)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.ceil.html" title='libm::ceil fn'>ceil</a></td><td class='docblock-short'><p>Ceil (f64)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.ceilf.html" title='libm::ceilf fn'>ceilf</a></td><td class='docblock-short'><p>Ceil (f32)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.copysign.html" title='libm::copysign fn'>copysign</a></td><td class='docblock-short'><p>Sign of Y, magnitude of X (f64)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.copysignf.html" title='libm::copysignf fn'>copysignf</a></td><td class='docblock-short'><p>Sign of Y, magnitude of X (f32)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.cos.html" title='libm::cos fn'>cos</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.cosf.html" title='libm::cosf fn'>cosf</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.cosh.html" title='libm::cosh fn'>cosh</a></td><td class='docblock-short'><p>Hyperbolic cosine (f64)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.coshf.html" title='libm::coshf fn'>coshf</a></td><td class='docblock-short'><p>Hyperbolic cosine (f64)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.erf.html" title='libm::erf fn'>erf</a></td><td class='docblock-short'><p>Error function (f64)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.erfc.html" title='libm::erfc fn'>erfc</a></td><td class='docblock-short'><p>Error function (f64)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.erfcf.html" title='libm::erfcf fn'>erfcf</a></td><td class='docblock-short'><p>Error function (f32)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.erff.html" title='libm::erff fn'>erff</a></td><td class='docblock-short'><p>Error function (f32)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.exp.html" title='libm::exp fn'>exp</a></td><td class='docblock-short'><p>Exponential, base <em>e</em> (f64)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.exp2.html" title='libm::exp2 fn'>exp2</a></td><td class='docblock-short'><p>Exponential, base 2 (f64)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.exp2f.html" title='libm::exp2f fn'>exp2f</a></td><td class='docblock-short'><p>Exponential, base 2 (f32)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.exp10.html" title='libm::exp10 fn'>exp10</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.exp10f.html" title='libm::exp10f fn'>exp10f</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.expf.html" title='libm::expf fn'>expf</a></td><td class='docblock-short'><p>Exponential, base <em>e</em> (f32)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.expm1.html" title='libm::expm1 fn'>expm1</a></td><td class='docblock-short'><p>Exponential, base <em>e</em>, of x-1 (f64)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.expm1f.html" title='libm::expm1f fn'>expm1f</a></td><td class='docblock-short'><p>Exponential, base <em>e</em>, of x-1 (f32)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.fabs.html" title='libm::fabs fn'>fabs</a></td><td class='docblock-short'><p>Absolute value (magnitude) (f64)
|
|
|
|
|
Calculates the absolute value (magnitude) of the argument <code>x</code>,
|
|
|
|
|
by direct manipulation of the bit representation of <code>x</code>.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.fabsf.html" title='libm::fabsf fn'>fabsf</a></td><td class='docblock-short'><p>Absolute value (magnitude) (f32)
|
|
|
|
|
Calculates the absolute value (magnitude) of the argument <code>x</code>,
|
|
|
|
|
by direct manipulation of the bit representation of <code>x</code>.</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.fdim.html" title='libm::fdim fn'>fdim</a></td><td class='docblock-short'><p>Positive difference (f64)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.fdimf.html" title='libm::fdimf fn'>fdimf</a></td><td class='docblock-short'><p>Positive difference (f32)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.floor.html" title='libm::floor fn'>floor</a></td><td class='docblock-short'><p>Floor (f64)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.floorf.html" title='libm::floorf fn'>floorf</a></td><td class='docblock-short'><p>Floor (f64)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.fma.html" title='libm::fma fn'>fma</a></td><td class='docblock-short'><p>Floating multiply add (f64)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.fmaf.html" title='libm::fmaf fn'>fmaf</a></td><td class='docblock-short'><p>Floating multiply add (f32)</p>
|
|
|
|
|
</td></tr><tr class='module-item'><td><a class="fn" href="fn.fmax.html" title='libm::fmax fn'>fmax</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.fmaxf.html" title='libm::fmaxf fn'>fmaxf</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.fmin.html" title='libm::fmin fn'>fmin</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.fminf.html" title='libm::fminf fn'>fminf</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.fmod.html" title='libm::fmod fn'>fmod</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.fmodf.html" title='libm::fmodf fn'>fmodf</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.frexp.html" title='libm::frexp fn'>frexp</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.frexpf.html" title='libm::frexpf fn'>frexpf</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.hypot.html" title='libm::hypot fn'>hypot</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.hypotf.html" title='libm::hypotf fn'>hypotf</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.ilogb.html" title='libm::ilogb fn'>ilogb</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.ilogbf.html" title='libm::ilogbf fn'>ilogbf</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.j0.html" title='libm::j0 fn'>j0</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.j0f.html" title='libm::j0f fn'>j0f</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.j1.html" title='libm::j1 fn'>j1</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.j1f.html" title='libm::j1f fn'>j1f</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.jn.html" title='libm::jn fn'>jn</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.jnf.html" title='libm::jnf fn'>jnf</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.ldexp.html" title='libm::ldexp fn'>ldexp</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.ldexpf.html" title='libm::ldexpf fn'>ldexpf</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.lgamma.html" title='libm::lgamma fn'>lgamma</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.lgamma_r.html" title='libm::lgamma_r fn'>lgamma_r</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.lgammaf.html" title='libm::lgammaf fn'>lgammaf</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.lgammaf_r.html" title='libm::lgammaf_r fn'>lgammaf_r</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.log.html" title='libm::log fn'>log</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.log1p.html" title='libm::log1p fn'>log1p</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.log1pf.html" title='libm::log1pf fn'>log1pf</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.log2.html" title='libm::log2 fn'>log2</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.log2f.html" title='libm::log2f fn'>log2f</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.log10.html" title='libm::log10 fn'>log10</a></td><td class='docblock-short'></t
|