mentat/num_traits/float/trait.FloatCore.html
2018-08-22 17:04:13 +00:00

694 lines
No EOL
91 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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 `FloatCore` trait in crate `num_traits`.">
<meta name="keywords" content="rust, rustlang, rust-lang, FloatCore">
<title>num_traits::float::FloatCore - 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="../../main.css" id="themeStyle">
<script src="../../storage.js"></script>
</head>
<body class="rustdoc trait">
<!--[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">&#9776;</div>
<p class='location'>Trait FloatCore</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.infinity">infinity</a><a href="#tymethod.neg_infinity">neg_infinity</a><a href="#tymethod.nan">nan</a><a href="#tymethod.neg_zero">neg_zero</a><a href="#tymethod.min_value">min_value</a><a href="#tymethod.min_positive_value">min_positive_value</a><a href="#tymethod.epsilon">epsilon</a><a href="#tymethod.max_value">max_value</a><a href="#tymethod.classify">classify</a><a href="#tymethod.to_degrees">to_degrees</a><a href="#tymethod.to_radians">to_radians</a><a href="#tymethod.integer_decode">integer_decode</a></div><a class="sidebar-title" href="#provided-methods">Provided Methods</a><div class="sidebar-links"><a href="#method.is_nan">is_nan</a><a href="#method.is_infinite">is_infinite</a><a href="#method.is_finite">is_finite</a><a href="#method.is_normal">is_normal</a><a href="#method.floor">floor</a><a href="#method.ceil">ceil</a><a href="#method.round">round</a><a href="#method.trunc">trunc</a><a href="#method.fract">fract</a><a href="#method.abs">abs</a><a href="#method.signum">signum</a><a href="#method.is_sign_positive">is_sign_positive</a><a href="#method.is_sign_negative">is_sign_negative</a><a href="#method.min">min</a><a href="#method.max">max</a><a href="#method.recip">recip</a><a href="#method.powi">powi</a></div><a class="sidebar-title" href="#foreign-impls">Implementations on Foreign Types</a><div class="sidebar-links"><a href="#impl-FloatCore">f32</a><a href="#impl-FloatCore">f64</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class='location'><a href='../index.html'>num_traits</a>::<wbr><a href='index.html'>float</a></p><script>window.sidebarCurrent = {name: 'FloatCore', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></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">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press S to search, ? for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content">
<h1 class='fqn'><span class='in-band'>Trait <a href='../index.html'>num_traits</a>::<wbr><a href='index.html'>float</a>::<wbr><a class="trait" href=''>FloatCore</a></span><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'>&#x2212;</span>]
</a>
</span><a class='srclink' href='../../src/num_traits/float.rs.html#13-736' title='goto source code'>[src]</a></span></h1>
<pre class='rust trait'>pub trait FloatCore: <a class="trait" href="../../num_traits/trait.Num.html" title="trait num_traits::Num">Num</a> + <a class="trait" href="../../num_traits/cast/trait.NumCast.html" title="trait num_traits::cast::NumCast">NumCast</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/arith/trait.Neg.html" title="trait core::ops::arith::Neg">Neg</a>&lt;Output = Self&gt; + <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a> {
fn <a href='#tymethod.infinity' class='fnname'>infinity</a>() -&gt; Self;
<div class='item-spacer'></div> fn <a href='#tymethod.neg_infinity' class='fnname'>neg_infinity</a>() -&gt; Self;
<div class='item-spacer'></div> fn <a href='#tymethod.nan' class='fnname'>nan</a>() -&gt; Self;
<div class='item-spacer'></div> fn <a href='#tymethod.neg_zero' class='fnname'>neg_zero</a>() -&gt; Self;
<div class='item-spacer'></div> fn <a href='#tymethod.min_value' class='fnname'>min_value</a>() -&gt; Self;
<div class='item-spacer'></div> fn <a href='#tymethod.min_positive_value' class='fnname'>min_positive_value</a>() -&gt; Self;
<div class='item-spacer'></div> fn <a href='#tymethod.epsilon' class='fnname'>epsilon</a>() -&gt; Self;
<div class='item-spacer'></div> fn <a href='#tymethod.max_value' class='fnname'>max_value</a>() -&gt; Self;
<div class='item-spacer'></div> fn <a href='#tymethod.classify' class='fnname'>classify</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/num/enum.FpCategory.html" title="enum core::num::FpCategory">FpCategory</a>;
<div class='item-spacer'></div> fn <a href='#tymethod.to_degrees' class='fnname'>to_degrees</a>(self) -&gt; Self;
<div class='item-spacer'></div> fn <a href='#tymethod.to_radians' class='fnname'>to_radians</a>(self) -&gt; Self;
<div class='item-spacer'></div> fn <a href='#tymethod.integer_decode' class='fnname'>integer_decode</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>;
fn <a href='#method.is_nan' class='fnname'>is_nan</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> { ... }
<div class='item-spacer'></div> fn <a href='#method.is_infinite' class='fnname'>is_infinite</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> { ... }
<div class='item-spacer'></div> fn <a href='#method.is_finite' class='fnname'>is_finite</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> { ... }
<div class='item-spacer'></div> fn <a href='#method.is_normal' class='fnname'>is_normal</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> { ... }
<div class='item-spacer'></div> fn <a href='#method.floor' class='fnname'>floor</a>(self) -&gt; Self { ... }
<div class='item-spacer'></div> fn <a href='#method.ceil' class='fnname'>ceil</a>(self) -&gt; Self { ... }
<div class='item-spacer'></div> fn <a href='#method.round' class='fnname'>round</a>(self) -&gt; Self { ... }
<div class='item-spacer'></div> fn <a href='#method.trunc' class='fnname'>trunc</a>(self) -&gt; Self { ... }
<div class='item-spacer'></div> fn <a href='#method.fract' class='fnname'>fract</a>(self) -&gt; Self { ... }
<div class='item-spacer'></div> fn <a href='#method.abs' class='fnname'>abs</a>(self) -&gt; Self { ... }
<div class='item-spacer'></div> fn <a href='#method.signum' class='fnname'>signum</a>(self) -&gt; Self { ... }
<div class='item-spacer'></div> fn <a href='#method.is_sign_positive' class='fnname'>is_sign_positive</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> { ... }
<div class='item-spacer'></div> fn <a href='#method.is_sign_negative' class='fnname'>is_sign_negative</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> { ... }
<div class='item-spacer'></div> fn <a href='#method.min' class='fnname'>min</a>(self, other: Self) -&gt; Self { ... }
<div class='item-spacer'></div> fn <a href='#method.max' class='fnname'>max</a>(self, other: Self) -&gt; Self { ... }
<div class='item-spacer'></div> fn <a href='#method.recip' class='fnname'>recip</a>(self) -&gt; Self { ... }
<div class='item-spacer'></div> fn <a href='#method.powi' class='fnname'>powi</a>(self, exp: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>) -&gt; Self { ... }
}</pre><div class='docblock'><p>Generic trait for floating point numbers that works with <code>no_std</code>.</p>
<p>This trait implements a subset of the <code>Float</code> trait.</p>
</div>
<h2 id='required-methods' class='small-section-header'>
Required Methods<a href='#required-methods' class='anchor'></a>
</h2>
<div class='methods'>
<h3 id='tymethod.infinity' class='method'><span id='infinity.v' class='invisible'><code>fn <a href='#tymethod.infinity' class='fnname'>infinity</a>() -&gt; Self</code></span></h3><div class='docblock'><p>Returns positive infinity.</p>
<h1 id="examples" class="section-header"><a href="#examples">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">f32</span>, <span class="ident">f64</span>};
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>(<span class="ident">x</span>: <span class="ident">T</span>) {
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">T</span>::<span class="ident">infinity</span>() <span class="op">==</span> <span class="ident">x</span>);
}
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">INFINITY</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">INFINITY</span>);</pre>
</div><h3 id='tymethod.neg_infinity' class='method'><span id='neg_infinity.v' class='invisible'><code>fn <a href='#tymethod.neg_infinity' class='fnname'>neg_infinity</a>() -&gt; Self</code></span></h3><div class='docblock'><p>Returns negative infinity.</p>
<h1 id="examples-1" class="section-header"><a href="#examples-1">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">f32</span>, <span class="ident">f64</span>};
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>(<span class="ident">x</span>: <span class="ident">T</span>) {
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">T</span>::<span class="ident">neg_infinity</span>() <span class="op">==</span> <span class="ident">x</span>);
}
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">NEG_INFINITY</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">NEG_INFINITY</span>);</pre>
</div><h3 id='tymethod.nan' class='method'><span id='nan.v' class='invisible'><code>fn <a href='#tymethod.nan' class='fnname'>nan</a>() -&gt; Self</code></span></h3><div class='docblock'><p>Returns NaN.</p>
<h1 id="examples-2" class="section-header"><a href="#examples-2">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>() {
<span class="kw">let</span> <span class="ident">n</span> <span class="op">=</span> <span class="ident">T</span>::<span class="ident">nan</span>();
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">n</span> <span class="op">!=</span> <span class="ident">n</span>);
}
<span class="ident">check</span>::<span class="op">&lt;</span><span class="ident">f32</span><span class="op">&gt;</span>();
<span class="ident">check</span>::<span class="op">&lt;</span><span class="ident">f64</span><span class="op">&gt;</span>();</pre>
</div><h3 id='tymethod.neg_zero' class='method'><span id='neg_zero.v' class='invisible'><code>fn <a href='#tymethod.neg_zero' class='fnname'>neg_zero</a>() -&gt; Self</code></span></h3><div class='docblock'><p>Returns <code>-0.0</code>.</p>
<h1 id="examples-3" class="section-header"><a href="#examples-3">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">f32</span>, <span class="ident">f64</span>};
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>(<span class="ident">n</span>: <span class="ident">T</span>) {
<span class="kw">let</span> <span class="ident">z</span> <span class="op">=</span> <span class="ident">T</span>::<span class="ident">neg_zero</span>();
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">z</span>.<span class="ident">is_zero</span>());
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">T</span>::<span class="ident">one</span>() <span class="op">/</span> <span class="ident">z</span> <span class="op">==</span> <span class="ident">n</span>);
}
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">NEG_INFINITY</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">NEG_INFINITY</span>);</pre>
</div><h3 id='tymethod.min_value' class='method'><span id='min_value.v' class='invisible'><code>fn <a href='#tymethod.min_value' class='fnname'>min_value</a>() -&gt; Self</code></span></h3><div class='docblock'><p>Returns the smallest finite value that this type can represent.</p>
<h1 id="examples-4" class="section-header"><a href="#examples-4">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">f32</span>, <span class="ident">f64</span>};
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>(<span class="ident">x</span>: <span class="ident">T</span>) {
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">T</span>::<span class="ident">min_value</span>() <span class="op">==</span> <span class="ident">x</span>);
}
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">MIN</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">MIN</span>);</pre>
</div><h3 id='tymethod.min_positive_value' class='method'><span id='min_positive_value.v' class='invisible'><code>fn <a href='#tymethod.min_positive_value' class='fnname'>min_positive_value</a>() -&gt; Self</code></span></h3><div class='docblock'><p>Returns the smallest positive, normalized value that this type can represent.</p>
<h1 id="examples-5" class="section-header"><a href="#examples-5">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">f32</span>, <span class="ident">f64</span>};
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>(<span class="ident">x</span>: <span class="ident">T</span>) {
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">T</span>::<span class="ident">min_positive_value</span>() <span class="op">==</span> <span class="ident">x</span>);
}
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">MIN_POSITIVE</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">MIN_POSITIVE</span>);</pre>
</div><h3 id='tymethod.epsilon' class='method'><span id='epsilon.v' class='invisible'><code>fn <a href='#tymethod.epsilon' class='fnname'>epsilon</a>() -&gt; Self</code></span></h3><div class='docblock'><p>Returns epsilon, a small positive value.</p>
<h1 id="examples-6" class="section-header"><a href="#examples-6">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">f32</span>, <span class="ident">f64</span>};
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>(<span class="ident">x</span>: <span class="ident">T</span>) {
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">T</span>::<span class="ident">epsilon</span>() <span class="op">==</span> <span class="ident">x</span>);
}
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">EPSILON</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">EPSILON</span>);</pre>
</div><h3 id='tymethod.max_value' class='method'><span id='max_value.v' class='invisible'><code>fn <a href='#tymethod.max_value' class='fnname'>max_value</a>() -&gt; Self</code></span></h3><div class='docblock'><p>Returns the largest finite value that this type can represent.</p>
<h1 id="examples-7" class="section-header"><a href="#examples-7">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">f32</span>, <span class="ident">f64</span>};
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>(<span class="ident">x</span>: <span class="ident">T</span>) {
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">T</span>::<span class="ident">max_value</span>() <span class="op">==</span> <span class="ident">x</span>);
}
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">MAX</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">MAX</span>);</pre>
</div><h3 id='tymethod.classify' class='method'><span id='classify.v' class='invisible'><code>fn <a href='#tymethod.classify' class='fnname'>classify</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/num/enum.FpCategory.html" title="enum core::num::FpCategory">FpCategory</a></code></span></h3><div class='docblock'><p>Returns the floating point category of the number. If only one property
is going to be tested, it is generally faster to use the specific
predicate instead.</p>
<h1 id="examples-8" class="section-header"><a href="#examples-8">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">f32</span>, <span class="ident">f64</span>};
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">num</span>::<span class="ident">FpCategory</span>;
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>(<span class="ident">x</span>: <span class="ident">T</span>, <span class="ident">c</span>: <span class="ident">FpCategory</span>) {
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">x</span>.<span class="ident">classify</span>() <span class="op">==</span> <span class="ident">c</span>);
}
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">INFINITY</span>, <span class="ident">FpCategory</span>::<span class="ident">Infinite</span>);
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">MAX</span>, <span class="ident">FpCategory</span>::<span class="ident">Normal</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">NAN</span>, <span class="ident">FpCategory</span>::<span class="ident">Nan</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">MIN_POSITIVE</span>, <span class="ident">FpCategory</span>::<span class="ident">Normal</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">MIN_POSITIVE</span> <span class="op">/</span> <span class="number">2.0</span>, <span class="ident">FpCategory</span>::<span class="ident">Subnormal</span>);
<span class="ident">check</span>(<span class="number">0.0f64</span>, <span class="ident">FpCategory</span>::<span class="ident">Zero</span>);</pre>
</div><h3 id='tymethod.to_degrees' class='method'><span id='to_degrees.v' class='invisible'><code>fn <a href='#tymethod.to_degrees' class='fnname'>to_degrees</a>(self) -&gt; Self</code></span></h3><div class='docblock'><p>Converts to degrees, assuming the number is in radians.</p>
<h1 id="examples-9" class="section-header"><a href="#examples-9">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">f32</span>, <span class="ident">f64</span>};
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>(<span class="ident">rad</span>: <span class="ident">T</span>, <span class="ident">deg</span>: <span class="ident">T</span>) {
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">rad</span>.<span class="ident">to_degrees</span>() <span class="op">==</span> <span class="ident">deg</span>);
}
<span class="ident">check</span>(<span class="number">0.0f32</span>, <span class="number">0.0</span>);
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">consts</span>::<span class="ident">PI</span>, <span class="number">180.0</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">consts</span>::<span class="ident">FRAC_PI_4</span>, <span class="number">45.0</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">INFINITY</span>, <span class="ident">f64</span>::<span class="ident">INFINITY</span>);</pre>
</div><h3 id='tymethod.to_radians' class='method'><span id='to_radians.v' class='invisible'><code>fn <a href='#tymethod.to_radians' class='fnname'>to_radians</a>(self) -&gt; Self</code></span></h3><div class='docblock'><p>Converts to radians, assuming the number is in degrees.</p>
<h1 id="examples-10" class="section-header"><a href="#examples-10">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">f32</span>, <span class="ident">f64</span>};
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>(<span class="ident">deg</span>: <span class="ident">T</span>, <span class="ident">rad</span>: <span class="ident">T</span>) {
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">deg</span>.<span class="ident">to_radians</span>() <span class="op">==</span> <span class="ident">rad</span>);
}
<span class="ident">check</span>(<span class="number">0.0f32</span>, <span class="number">0.0</span>);
<span class="ident">check</span>(<span class="number">180.0</span>, <span class="ident">f32</span>::<span class="ident">consts</span>::<span class="ident">PI</span>);
<span class="ident">check</span>(<span class="number">45.0</span>, <span class="ident">f64</span>::<span class="ident">consts</span>::<span class="ident">FRAC_PI_4</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">INFINITY</span>, <span class="ident">f64</span>::<span class="ident">INFINITY</span>);</pre>
</div><h3 id='tymethod.integer_decode' class='method'><span id='integer_decode.v' class='invisible'><code>fn <a href='#tymethod.integer_decode' class='fnname'>integer_decode</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span></h3><div class='docblock'><p>Returns the mantissa, base 2 exponent, and sign as integers, respectively.
The original number can be recovered by <code>sign * mantissa * 2 ^ exponent</code>.</p>
<h1 id="examples-11" class="section-header"><a href="#examples-11">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">f32</span>, <span class="ident">f64</span>};
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>(<span class="ident">x</span>: <span class="ident">T</span>, <span class="ident">m</span>: <span class="ident">u64</span>, <span class="ident">e</span>: <span class="ident">i16</span>, <span class="ident">s</span>:<span class="ident">i8</span>) {
<span class="kw">let</span> (<span class="ident">mantissa</span>, <span class="ident">exponent</span>, <span class="ident">sign</span>) <span class="op">=</span> <span class="ident">x</span>.<span class="ident">integer_decode</span>();
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">mantissa</span>, <span class="ident">m</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">exponent</span>, <span class="ident">e</span>);
<span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">sign</span>, <span class="ident">s</span>);
}
<span class="ident">check</span>(<span class="number">2.0f32</span>, <span class="number">1</span> <span class="op">&lt;&lt;</span> <span class="number">23</span>, <span class="op">-</span><span class="number">22</span>, <span class="number">1</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">2.0f32</span>, <span class="number">1</span> <span class="op">&lt;&lt;</span> <span class="number">23</span>, <span class="op">-</span><span class="number">22</span>, <span class="op">-</span><span class="number">1</span>);
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">INFINITY</span>, <span class="number">1</span> <span class="op">&lt;&lt;</span> <span class="number">23</span>, <span class="number">105</span>, <span class="number">1</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">NEG_INFINITY</span>, <span class="number">1</span> <span class="op">&lt;&lt;</span> <span class="number">52</span>, <span class="number">972</span>, <span class="op">-</span><span class="number">1</span>);</pre>
</div></div>
<h2 id='provided-methods' class='small-section-header'>
Provided Methods<a href='#provided-methods' class='anchor'></a>
</h2>
<div class='methods'>
<h3 id='method.is_nan' class='method'><span id='is_nan.v' class='invisible'><code>fn <a href='#method.is_nan' class='fnname'>is_nan</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span></h3><div class='docblock'><p>Returns <code>true</code> if the number is NaN.</p>
<h1 id="examples-12" class="section-header"><a href="#examples-12">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">f32</span>, <span class="ident">f64</span>};
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>(<span class="ident">x</span>: <span class="ident">T</span>, <span class="ident">p</span>: <span class="ident">bool</span>) {
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">x</span>.<span class="ident">is_nan</span>() <span class="op">==</span> <span class="ident">p</span>);
}
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">NAN</span>, <span class="bool-val">true</span>);
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">INFINITY</span>, <span class="bool-val">false</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">NAN</span>, <span class="bool-val">true</span>);
<span class="ident">check</span>(<span class="number">0.0f64</span>, <span class="bool-val">false</span>);</pre>
</div><h3 id='method.is_infinite' class='method'><span id='is_infinite.v' class='invisible'><code>fn <a href='#method.is_infinite' class='fnname'>is_infinite</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span></h3><div class='docblock'><p>Returns <code>true</code> if the number is infinite.</p>
<h1 id="examples-13" class="section-header"><a href="#examples-13">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">f32</span>, <span class="ident">f64</span>};
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>(<span class="ident">x</span>: <span class="ident">T</span>, <span class="ident">p</span>: <span class="ident">bool</span>) {
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">x</span>.<span class="ident">is_infinite</span>() <span class="op">==</span> <span class="ident">p</span>);
}
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">INFINITY</span>, <span class="bool-val">true</span>);
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">NEG_INFINITY</span>, <span class="bool-val">true</span>);
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">NAN</span>, <span class="bool-val">false</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">INFINITY</span>, <span class="bool-val">true</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">NEG_INFINITY</span>, <span class="bool-val">true</span>);
<span class="ident">check</span>(<span class="number">0.0f64</span>, <span class="bool-val">false</span>);</pre>
</div><h3 id='method.is_finite' class='method'><span id='is_finite.v' class='invisible'><code>fn <a href='#method.is_finite' class='fnname'>is_finite</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span></h3><div class='docblock'><p>Returns <code>true</code> if the number is neither infinite or NaN.</p>
<h1 id="examples-14" class="section-header"><a href="#examples-14">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">f32</span>, <span class="ident">f64</span>};
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>(<span class="ident">x</span>: <span class="ident">T</span>, <span class="ident">p</span>: <span class="ident">bool</span>) {
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">x</span>.<span class="ident">is_finite</span>() <span class="op">==</span> <span class="ident">p</span>);
}
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">INFINITY</span>, <span class="bool-val">false</span>);
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">MAX</span>, <span class="bool-val">true</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">NEG_INFINITY</span>, <span class="bool-val">false</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">MIN_POSITIVE</span>, <span class="bool-val">true</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">NAN</span>, <span class="bool-val">false</span>);</pre>
</div><h3 id='method.is_normal' class='method'><span id='is_normal.v' class='invisible'><code>fn <a href='#method.is_normal' class='fnname'>is_normal</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span></h3><div class='docblock'><p>Returns <code>true</code> if the number is neither zero, infinite, subnormal or NaN.</p>
<h1 id="examples-15" class="section-header"><a href="#examples-15">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">f32</span>, <span class="ident">f64</span>};
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>(<span class="ident">x</span>: <span class="ident">T</span>, <span class="ident">p</span>: <span class="ident">bool</span>) {
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">x</span>.<span class="ident">is_normal</span>() <span class="op">==</span> <span class="ident">p</span>);
}
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">INFINITY</span>, <span class="bool-val">false</span>);
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">MAX</span>, <span class="bool-val">true</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">NEG_INFINITY</span>, <span class="bool-val">false</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">MIN_POSITIVE</span>, <span class="bool-val">true</span>);
<span class="ident">check</span>(<span class="number">0.0f64</span>, <span class="bool-val">false</span>);</pre>
</div><h3 id='method.floor' class='method'><span id='floor.v' class='invisible'><code>fn <a href='#method.floor' class='fnname'>floor</a>(self) -&gt; Self</code></span></h3><div class='docblock'><p>Returns the largest integer less than or equal to a number.</p>
<h1 id="examples-16" class="section-header"><a href="#examples-16">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">f32</span>, <span class="ident">f64</span>};
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>(<span class="ident">x</span>: <span class="ident">T</span>, <span class="ident">y</span>: <span class="ident">T</span>) {
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">x</span>.<span class="ident">floor</span>() <span class="op">==</span> <span class="ident">y</span>);
}
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">INFINITY</span>, <span class="ident">f32</span>::<span class="ident">INFINITY</span>);
<span class="ident">check</span>(<span class="number">0.9f32</span>, <span class="number">0.0</span>);
<span class="ident">check</span>(<span class="number">1.0f32</span>, <span class="number">1.0</span>);
<span class="ident">check</span>(<span class="number">1.1f32</span>, <span class="number">1.0</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">0.0f64</span>, <span class="number">0.0</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">0.9f64</span>, <span class="op">-</span><span class="number">1.0</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">1.0f64</span>, <span class="op">-</span><span class="number">1.0</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">1.1f64</span>, <span class="op">-</span><span class="number">2.0</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">MIN</span>, <span class="ident">f64</span>::<span class="ident">MIN</span>);</pre>
</div><h3 id='method.ceil' class='method'><span id='ceil.v' class='invisible'><code>fn <a href='#method.ceil' class='fnname'>ceil</a>(self) -&gt; Self</code></span></h3><div class='docblock'><p>Returns the smallest integer greater than or equal to a number.</p>
<h1 id="examples-17" class="section-header"><a href="#examples-17">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">f32</span>, <span class="ident">f64</span>};
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>(<span class="ident">x</span>: <span class="ident">T</span>, <span class="ident">y</span>: <span class="ident">T</span>) {
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">x</span>.<span class="ident">ceil</span>() <span class="op">==</span> <span class="ident">y</span>);
}
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">INFINITY</span>, <span class="ident">f32</span>::<span class="ident">INFINITY</span>);
<span class="ident">check</span>(<span class="number">0.9f32</span>, <span class="number">1.0</span>);
<span class="ident">check</span>(<span class="number">1.0f32</span>, <span class="number">1.0</span>);
<span class="ident">check</span>(<span class="number">1.1f32</span>, <span class="number">2.0</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">0.0f64</span>, <span class="number">0.0</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">0.9f64</span>, <span class="op">-</span><span class="number">0.0</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">1.0f64</span>, <span class="op">-</span><span class="number">1.0</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">1.1f64</span>, <span class="op">-</span><span class="number">1.0</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">MIN</span>, <span class="ident">f64</span>::<span class="ident">MIN</span>);</pre>
</div><h3 id='method.round' class='method'><span id='round.v' class='invisible'><code>fn <a href='#method.round' class='fnname'>round</a>(self) -&gt; Self</code></span></h3><div class='docblock'><p>Returns the nearest integer to a number. Round half-way cases away from <code>0.0</code>.</p>
<h1 id="examples-18" class="section-header"><a href="#examples-18">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">f32</span>, <span class="ident">f64</span>};
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>(<span class="ident">x</span>: <span class="ident">T</span>, <span class="ident">y</span>: <span class="ident">T</span>) {
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">x</span>.<span class="ident">round</span>() <span class="op">==</span> <span class="ident">y</span>);
}
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">INFINITY</span>, <span class="ident">f32</span>::<span class="ident">INFINITY</span>);
<span class="ident">check</span>(<span class="number">0.4f32</span>, <span class="number">0.0</span>);
<span class="ident">check</span>(<span class="number">0.5f32</span>, <span class="number">1.0</span>);
<span class="ident">check</span>(<span class="number">0.6f32</span>, <span class="number">1.0</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">0.4f64</span>, <span class="number">0.0</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">0.5f64</span>, <span class="op">-</span><span class="number">1.0</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">0.6f64</span>, <span class="op">-</span><span class="number">1.0</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">MIN</span>, <span class="ident">f64</span>::<span class="ident">MIN</span>);</pre>
</div><h3 id='method.trunc' class='method'><span id='trunc.v' class='invisible'><code>fn <a href='#method.trunc' class='fnname'>trunc</a>(self) -&gt; Self</code></span></h3><div class='docblock'><p>Return the integer part of a number.</p>
<h1 id="examples-19" class="section-header"><a href="#examples-19">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">f32</span>, <span class="ident">f64</span>};
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>(<span class="ident">x</span>: <span class="ident">T</span>, <span class="ident">y</span>: <span class="ident">T</span>) {
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">x</span>.<span class="ident">trunc</span>() <span class="op">==</span> <span class="ident">y</span>);
}
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">INFINITY</span>, <span class="ident">f32</span>::<span class="ident">INFINITY</span>);
<span class="ident">check</span>(<span class="number">0.9f32</span>, <span class="number">0.0</span>);
<span class="ident">check</span>(<span class="number">1.0f32</span>, <span class="number">1.0</span>);
<span class="ident">check</span>(<span class="number">1.1f32</span>, <span class="number">1.0</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">0.0f64</span>, <span class="number">0.0</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">0.9f64</span>, <span class="op">-</span><span class="number">0.0</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">1.0f64</span>, <span class="op">-</span><span class="number">1.0</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">1.1f64</span>, <span class="op">-</span><span class="number">1.0</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">MIN</span>, <span class="ident">f64</span>::<span class="ident">MIN</span>);</pre>
</div><h3 id='method.fract' class='method'><span id='fract.v' class='invisible'><code>fn <a href='#method.fract' class='fnname'>fract</a>(self) -&gt; Self</code></span></h3><div class='docblock'><p>Returns the fractional part of a number.</p>
<h1 id="examples-20" class="section-header"><a href="#examples-20">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">f32</span>, <span class="ident">f64</span>};
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>(<span class="ident">x</span>: <span class="ident">T</span>, <span class="ident">y</span>: <span class="ident">T</span>) {
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">x</span>.<span class="ident">fract</span>() <span class="op">==</span> <span class="ident">y</span>);
}
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">MAX</span>, <span class="number">0.0</span>);
<span class="ident">check</span>(<span class="number">0.75f32</span>, <span class="number">0.75</span>);
<span class="ident">check</span>(<span class="number">1.0f32</span>, <span class="number">0.0</span>);
<span class="ident">check</span>(<span class="number">1.25f32</span>, <span class="number">0.25</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">0.0f64</span>, <span class="number">0.0</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">0.75f64</span>, <span class="op">-</span><span class="number">0.75</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">1.0f64</span>, <span class="number">0.0</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">1.25f64</span>, <span class="op">-</span><span class="number">0.25</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">MIN</span>, <span class="number">0.0</span>);</pre>
</div><h3 id='method.abs' class='method'><span id='abs.v' class='invisible'><code>fn <a href='#method.abs' class='fnname'>abs</a>(self) -&gt; Self</code></span></h3><div class='docblock'><p>Computes the absolute value of <code>self</code>. Returns <code>FloatCore::nan()</code> if the
number is <code>FloatCore::nan()</code>.</p>
<h1 id="examples-21" class="section-header"><a href="#examples-21">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">f32</span>, <span class="ident">f64</span>};
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>(<span class="ident">x</span>: <span class="ident">T</span>, <span class="ident">y</span>: <span class="ident">T</span>) {
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">x</span>.<span class="ident">abs</span>() <span class="op">==</span> <span class="ident">y</span>);
}
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">INFINITY</span>, <span class="ident">f32</span>::<span class="ident">INFINITY</span>);
<span class="ident">check</span>(<span class="number">1.0f32</span>, <span class="number">1.0</span>);
<span class="ident">check</span>(<span class="number">0.0f64</span>, <span class="number">0.0</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">0.0f64</span>, <span class="number">0.0</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">1.0f64</span>, <span class="number">1.0</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">MIN</span>, <span class="ident">f64</span>::<span class="ident">MAX</span>);</pre>
</div><h3 id='method.signum' class='method'><span id='signum.v' class='invisible'><code>fn <a href='#method.signum' class='fnname'>signum</a>(self) -&gt; Self</code></span></h3><div class='docblock'><p>Returns a number that represents the sign of <code>self</code>.</p>
<ul>
<li><code>1.0</code> if the number is positive, <code>+0.0</code> or <code>FloatCore::infinity()</code></li>
<li><code>-1.0</code> if the number is negative, <code>-0.0</code> or <code>FloatCore::neg_infinity()</code></li>
<li><code>FloatCore::nan()</code> if the number is <code>FloatCore::nan()</code></li>
</ul>
<h1 id="examples-22" class="section-header"><a href="#examples-22">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">f32</span>, <span class="ident">f64</span>};
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>(<span class="ident">x</span>: <span class="ident">T</span>, <span class="ident">y</span>: <span class="ident">T</span>) {
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">x</span>.<span class="ident">signum</span>() <span class="op">==</span> <span class="ident">y</span>);
}
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">INFINITY</span>, <span class="number">1.0</span>);
<span class="ident">check</span>(<span class="number">3.0f32</span>, <span class="number">1.0</span>);
<span class="ident">check</span>(<span class="number">0.0f32</span>, <span class="number">1.0</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">0.0f64</span>, <span class="op">-</span><span class="number">1.0</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">3.0f64</span>, <span class="op">-</span><span class="number">1.0</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">MIN</span>, <span class="op">-</span><span class="number">1.0</span>);</pre>
</div><h3 id='method.is_sign_positive' class='method'><span id='is_sign_positive.v' class='invisible'><code>fn <a href='#method.is_sign_positive' class='fnname'>is_sign_positive</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span></h3><div class='docblock'><p>Returns <code>true</code> if <code>self</code> is positive, including <code>+0.0</code> and
<code>FloatCore::infinity()</code>, and since Rust 1.20 also
<code>FloatCore::nan()</code>.</p>
<h1 id="examples-23" class="section-header"><a href="#examples-23">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">f32</span>, <span class="ident">f64</span>};
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>(<span class="ident">x</span>: <span class="ident">T</span>, <span class="ident">p</span>: <span class="ident">bool</span>) {
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">x</span>.<span class="ident">is_sign_positive</span>() <span class="op">==</span> <span class="ident">p</span>);
}
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">INFINITY</span>, <span class="bool-val">true</span>);
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">MAX</span>, <span class="bool-val">true</span>);
<span class="ident">check</span>(<span class="number">0.0f32</span>, <span class="bool-val">true</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">0.0f64</span>, <span class="bool-val">false</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">NEG_INFINITY</span>, <span class="bool-val">false</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">MIN_POSITIVE</span>, <span class="bool-val">true</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="ident">f64</span>::<span class="ident">NAN</span>, <span class="bool-val">false</span>);</pre>
</div><h3 id='method.is_sign_negative' class='method'><span id='is_sign_negative.v' class='invisible'><code>fn <a href='#method.is_sign_negative' class='fnname'>is_sign_negative</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span></h3><div class='docblock'><p>Returns <code>true</code> if <code>self</code> is negative, including <code>-0.0</code> and
<code>FloatCore::neg_infinity()</code>, and since Rust 1.20 also
<code>-FloatCore::nan()</code>.</p>
<h1 id="examples-24" class="section-header"><a href="#examples-24">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">f32</span>, <span class="ident">f64</span>};
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>(<span class="ident">x</span>: <span class="ident">T</span>, <span class="ident">p</span>: <span class="ident">bool</span>) {
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">x</span>.<span class="ident">is_sign_negative</span>() <span class="op">==</span> <span class="ident">p</span>);
}
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">INFINITY</span>, <span class="bool-val">false</span>);
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">MAX</span>, <span class="bool-val">false</span>);
<span class="ident">check</span>(<span class="number">0.0f32</span>, <span class="bool-val">false</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">0.0f64</span>, <span class="bool-val">true</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">NEG_INFINITY</span>, <span class="bool-val">true</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">MIN_POSITIVE</span>, <span class="bool-val">false</span>);
<span class="ident">check</span>(<span class="ident">f64</span>::<span class="ident">NAN</span>, <span class="bool-val">false</span>);</pre>
</div><h3 id='method.min' class='method'><span id='min.v' class='invisible'><code>fn <a href='#method.min' class='fnname'>min</a>(self, other: Self) -&gt; Self</code></span></h3><div class='docblock'><p>Returns the minimum of the two numbers.</p>
<p>If one of the arguments is NaN, then the other argument is returned.</p>
<h1 id="examples-25" class="section-header"><a href="#examples-25">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">f32</span>, <span class="ident">f64</span>};
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>(<span class="ident">x</span>: <span class="ident">T</span>, <span class="ident">y</span>: <span class="ident">T</span>, <span class="ident">min</span>: <span class="ident">T</span>) {
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">x</span>.<span class="ident">min</span>(<span class="ident">y</span>) <span class="op">==</span> <span class="ident">min</span>);
}
<span class="ident">check</span>(<span class="number">1.0f32</span>, <span class="number">2.0</span>, <span class="number">1.0</span>);
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">NAN</span>, <span class="number">2.0</span>, <span class="number">2.0</span>);
<span class="ident">check</span>(<span class="number">1.0f64</span>, <span class="op">-</span><span class="number">2.0</span>, <span class="op">-</span><span class="number">2.0</span>);
<span class="ident">check</span>(<span class="number">1.0f64</span>, <span class="ident">f64</span>::<span class="ident">NAN</span>, <span class="number">1.0</span>);</pre>
</div><h3 id='method.max' class='method'><span id='max.v' class='invisible'><code>fn <a href='#method.max' class='fnname'>max</a>(self, other: Self) -&gt; Self</code></span></h3><div class='docblock'><p>Returns the maximum of the two numbers.</p>
<p>If one of the arguments is NaN, then the other argument is returned.</p>
<h1 id="examples-26" class="section-header"><a href="#examples-26">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">f32</span>, <span class="ident">f64</span>};
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>(<span class="ident">x</span>: <span class="ident">T</span>, <span class="ident">y</span>: <span class="ident">T</span>, <span class="ident">min</span>: <span class="ident">T</span>) {
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">x</span>.<span class="ident">max</span>(<span class="ident">y</span>) <span class="op">==</span> <span class="ident">min</span>);
}
<span class="ident">check</span>(<span class="number">1.0f32</span>, <span class="number">2.0</span>, <span class="number">2.0</span>);
<span class="ident">check</span>(<span class="number">1.0f32</span>, <span class="ident">f32</span>::<span class="ident">NAN</span>, <span class="number">1.0</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">1.0f64</span>, <span class="number">2.0</span>, <span class="number">2.0</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">1.0f64</span>, <span class="ident">f64</span>::<span class="ident">NAN</span>, <span class="op">-</span><span class="number">1.0</span>);</pre>
</div><h3 id='method.recip' class='method'><span id='recip.v' class='invisible'><code>fn <a href='#method.recip' class='fnname'>recip</a>(self) -&gt; Self</code></span></h3><div class='docblock'><p>Returns the reciprocal (multiplicative inverse) of the number.</p>
<h1 id="examples-27" class="section-header"><a href="#examples-27">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">f32</span>, <span class="ident">f64</span>};
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>(<span class="ident">x</span>: <span class="ident">T</span>, <span class="ident">y</span>: <span class="ident">T</span>) {
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">x</span>.<span class="ident">recip</span>() <span class="op">==</span> <span class="ident">y</span>);
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">y</span>.<span class="ident">recip</span>() <span class="op">==</span> <span class="ident">x</span>);
}
<span class="ident">check</span>(<span class="ident">f32</span>::<span class="ident">INFINITY</span>, <span class="number">0.0</span>);
<span class="ident">check</span>(<span class="number">2.0f32</span>, <span class="number">0.5</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">0.25f64</span>, <span class="op">-</span><span class="number">4.0</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">0.0f64</span>, <span class="ident">f64</span>::<span class="ident">NEG_INFINITY</span>);</pre>
</div><h3 id='method.powi' class='method'><span id='powi.v' class='invisible'><code>fn <a href='#method.powi' class='fnname'>powi</a>(self, exp: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>) -&gt; Self</code></span></h3><div class='docblock'><p>Raise a number to an integer power.</p>
<p>Using this function is generally faster than using <code>powf</code></p>
<h1 id="examples-28" class="section-header"><a href="#examples-28">Examples</a></h1>
<pre class="rust rust-example-rendered">
<span class="kw">use</span> <span class="ident">num_traits</span>::<span class="ident">float</span>::<span class="ident">FloatCore</span>;
<span class="kw">fn</span> <span class="ident">check</span><span class="op">&lt;</span><span class="ident">T</span>: <span class="ident">FloatCore</span><span class="op">&gt;</span>(<span class="ident">x</span>: <span class="ident">T</span>, <span class="ident">exp</span>: <span class="ident">i32</span>, <span class="ident">powi</span>: <span class="ident">T</span>) {
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">x</span>.<span class="ident">powi</span>(<span class="ident">exp</span>) <span class="op">==</span> <span class="ident">powi</span>);
}
<span class="ident">check</span>(<span class="number">9.0f32</span>, <span class="number">2</span>, <span class="number">81.0</span>);
<span class="ident">check</span>(<span class="number">1.0f32</span>, <span class="op">-</span><span class="number">2</span>, <span class="number">1.0</span>);
<span class="ident">check</span>(<span class="number">10.0f64</span>, <span class="number">20</span>, <span class="number">1e20</span>);
<span class="ident">check</span>(<span class="number">4.0f64</span>, <span class="op">-</span><span class="number">2</span>, <span class="number">0.0625</span>);
<span class="ident">check</span>(<span class="op">-</span><span class="number">1.0f64</span>, <span class="ident">std</span>::<span class="ident">i32</span>::<span class="ident">MIN</span>, <span class="number">1.0</span>);</pre>
</div></div>
<h2 id='foreign-impls' class='small-section-header'>
Implementations on Foreign Types<a href='#foreign-impls' class='anchor'></a>
</h2>
<h3 id='impl-FloatCore' class='impl'><span class='in-band'><code>impl <a class="trait" href="../../num_traits/float/trait.FloatCore.html" title="trait num_traits::float::FloatCore">FloatCore</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a></code><a href='#impl-FloatCore' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/float.rs.html#738-808' title='goto source code'>[src]</a></span></h3>
<span class='docblock autohide'><div class='impl-items'><h4 id='method.infinity' class="method"><span id='infinity.v-1' class='invisible'><code>fn <a href='#method.infinity' class='fnname'>infinity</a>() -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#33-35' title='goto source code'>[src]</a></span></h4>
<h4 id='method.neg_infinity' class="method"><span id='neg_infinity.v-1' class='invisible'><code>fn <a href='#method.neg_infinity' class='fnname'>neg_infinity</a>() -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#33-35' title='goto source code'>[src]</a></span></h4>
<h4 id='method.nan' class="method"><span id='nan.v-1' class='invisible'><code>fn <a href='#method.nan' class='fnname'>nan</a>() -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#33-35' title='goto source code'>[src]</a></span></h4>
<h4 id='method.neg_zero' class="method"><span id='neg_zero.v-1' class='invisible'><code>fn <a href='#method.neg_zero' class='fnname'>neg_zero</a>() -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#33-35' title='goto source code'>[src]</a></span></h4>
<h4 id='method.min_value' class="method"><span id='min_value.v-1' class='invisible'><code>fn <a href='#method.min_value' class='fnname'>min_value</a>() -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#33-35' title='goto source code'>[src]</a></span></h4>
<h4 id='method.min_positive_value' class="method"><span id='min_positive_value.v-1' class='invisible'><code>fn <a href='#method.min_positive_value' class='fnname'>min_positive_value</a>() -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#33-35' title='goto source code'>[src]</a></span></h4>
<h4 id='method.epsilon' class="method"><span id='epsilon.v-1' class='invisible'><code>fn <a href='#method.epsilon' class='fnname'>epsilon</a>() -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#33-35' title='goto source code'>[src]</a></span></h4>
<h4 id='method.max_value' class="method"><span id='max_value.v-1' class='invisible'><code>fn <a href='#method.max_value' class='fnname'>max_value</a>() -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#33-35' title='goto source code'>[src]</a></span></h4>
<h4 id='method.integer_decode' class="method"><span id='integer_decode.v-1' class='invisible'><code>fn <a href='#method.integer_decode' class='fnname'>integer_decode</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/float.rs.html#751-753' title='goto source code'>[src]</a></span></h4>
<h4 id='method.is_nan-1' class="method"><span id='is_nan.v-1' class='invisible'><code>fn <a href='#method.is_nan' class='fnname'>is_nan</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.is_infinite-1' class="method"><span id='is_infinite.v-1' class='invisible'><code>fn <a href='#method.is_infinite' class='fnname'>is_infinite</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.is_finite-1' class="method"><span id='is_finite.v-1' class='invisible'><code>fn <a href='#method.is_finite' class='fnname'>is_finite</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.is_normal-1' class="method"><span id='is_normal.v-1' class='invisible'><code>fn <a href='#method.is_normal' class='fnname'>is_normal</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.classify' class="method"><span id='classify.v-1' class='invisible'><code>fn <a href='#method.classify' class='fnname'>classify</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/num/enum.FpCategory.html" title="enum core::num::FpCategory">FpCategory</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.floor-1' class="method"><span id='floor.v-1' class='invisible'><code>fn <a href='#method.floor' class='fnname'>floor</a>(self) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.ceil-1' class="method"><span id='ceil.v-1' class='invisible'><code>fn <a href='#method.ceil' class='fnname'>ceil</a>(self) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.round-1' class="method"><span id='round.v-1' class='invisible'><code>fn <a href='#method.round' class='fnname'>round</a>(self) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.trunc-1' class="method"><span id='trunc.v-1' class='invisible'><code>fn <a href='#method.trunc' class='fnname'>trunc</a>(self) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.fract-1' class="method"><span id='fract.v-1' class='invisible'><code>fn <a href='#method.fract' class='fnname'>fract</a>(self) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.abs-1' class="method"><span id='abs.v-1' class='invisible'><code>fn <a href='#method.abs' class='fnname'>abs</a>(self) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.signum-1' class="method"><span id='signum.v-1' class='invisible'><code>fn <a href='#method.signum' class='fnname'>signum</a>(self) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.is_sign_positive-1' class="method"><span id='is_sign_positive.v-1' class='invisible'><code>fn <a href='#method.is_sign_positive' class='fnname'>is_sign_positive</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.is_sign_negative-1' class="method"><span id='is_sign_negative.v-1' class='invisible'><code>fn <a href='#method.is_sign_negative' class='fnname'>is_sign_negative</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.min-1' class="method"><span id='min.v-1' class='invisible'><code>fn <a href='#method.min' class='fnname'>min</a>(self, other: Self) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.max-1' class="method"><span id='max.v-1' class='invisible'><code>fn <a href='#method.max' class='fnname'>max</a>(self, other: Self) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.recip-1' class="method"><span id='recip.v-1' class='invisible'><code>fn <a href='#method.recip' class='fnname'>recip</a>(self) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.powi-1' class="method"><span id='powi.v-1' class='invisible'><code>fn <a href='#method.powi' class='fnname'>powi</a>(self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.to_degrees' class="method"><span id='to_degrees.v-1' class='invisible'><code>fn <a href='#method.to_degrees' class='fnname'>to_degrees</a>(self) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.to_radians' class="method"><span id='to_radians.v-1' class='invisible'><code>fn <a href='#method.to_radians' class='fnname'>to_radians</a>(self) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
</div></span><h3 id='impl-FloatCore-1' class='impl'><span class='in-band'><code>impl <a class="trait" href="../../num_traits/float/trait.FloatCore.html" title="trait num_traits::float::FloatCore">FloatCore</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a></code><a href='#impl-FloatCore-1' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/float.rs.html#810-881' title='goto source code'>[src]</a></span></h3>
<span class='docblock autohide'><div class='impl-items'><h4 id='method.infinity-1' class="method"><span id='infinity.v-2' class='invisible'><code>fn <a href='#method.infinity' class='fnname'>infinity</a>() -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#33-35' title='goto source code'>[src]</a></span></h4>
<h4 id='method.neg_infinity-1' class="method"><span id='neg_infinity.v-2' class='invisible'><code>fn <a href='#method.neg_infinity' class='fnname'>neg_infinity</a>() -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#33-35' title='goto source code'>[src]</a></span></h4>
<h4 id='method.nan-1' class="method"><span id='nan.v-2' class='invisible'><code>fn <a href='#method.nan' class='fnname'>nan</a>() -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#33-35' title='goto source code'>[src]</a></span></h4>
<h4 id='method.neg_zero-1' class="method"><span id='neg_zero.v-2' class='invisible'><code>fn <a href='#method.neg_zero' class='fnname'>neg_zero</a>() -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#33-35' title='goto source code'>[src]</a></span></h4>
<h4 id='method.min_value-1' class="method"><span id='min_value.v-2' class='invisible'><code>fn <a href='#method.min_value' class='fnname'>min_value</a>() -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#33-35' title='goto source code'>[src]</a></span></h4>
<h4 id='method.min_positive_value-1' class="method"><span id='min_positive_value.v-2' class='invisible'><code>fn <a href='#method.min_positive_value' class='fnname'>min_positive_value</a>() -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#33-35' title='goto source code'>[src]</a></span></h4>
<h4 id='method.epsilon-1' class="method"><span id='epsilon.v-2' class='invisible'><code>fn <a href='#method.epsilon' class='fnname'>epsilon</a>() -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#33-35' title='goto source code'>[src]</a></span></h4>
<h4 id='method.max_value-1' class="method"><span id='max_value.v-2' class='invisible'><code>fn <a href='#method.max_value' class='fnname'>max_value</a>() -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#33-35' title='goto source code'>[src]</a></span></h4>
<h4 id='method.integer_decode-1' class="method"><span id='integer_decode.v-2' class='invisible'><code>fn <a href='#method.integer_decode' class='fnname'>integer_decode</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/float.rs.html#823-825' title='goto source code'>[src]</a></span></h4>
<h4 id='method.is_nan-2' class="method"><span id='is_nan.v-2' class='invisible'><code>fn <a href='#method.is_nan' class='fnname'>is_nan</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.is_infinite-2' class="method"><span id='is_infinite.v-2' class='invisible'><code>fn <a href='#method.is_infinite' class='fnname'>is_infinite</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.is_finite-2' class="method"><span id='is_finite.v-2' class='invisible'><code>fn <a href='#method.is_finite' class='fnname'>is_finite</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.is_normal-2' class="method"><span id='is_normal.v-2' class='invisible'><code>fn <a href='#method.is_normal' class='fnname'>is_normal</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.classify-1' class="method"><span id='classify.v-2' class='invisible'><code>fn <a href='#method.classify' class='fnname'>classify</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/num/enum.FpCategory.html" title="enum core::num::FpCategory">FpCategory</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.floor-2' class="method"><span id='floor.v-2' class='invisible'><code>fn <a href='#method.floor' class='fnname'>floor</a>(self) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.ceil-2' class="method"><span id='ceil.v-2' class='invisible'><code>fn <a href='#method.ceil' class='fnname'>ceil</a>(self) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.round-2' class="method"><span id='round.v-2' class='invisible'><code>fn <a href='#method.round' class='fnname'>round</a>(self) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.trunc-2' class="method"><span id='trunc.v-2' class='invisible'><code>fn <a href='#method.trunc' class='fnname'>trunc</a>(self) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.fract-2' class="method"><span id='fract.v-2' class='invisible'><code>fn <a href='#method.fract' class='fnname'>fract</a>(self) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.abs-2' class="method"><span id='abs.v-2' class='invisible'><code>fn <a href='#method.abs' class='fnname'>abs</a>(self) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.signum-2' class="method"><span id='signum.v-2' class='invisible'><code>fn <a href='#method.signum' class='fnname'>signum</a>(self) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.is_sign_positive-2' class="method"><span id='is_sign_positive.v-2' class='invisible'><code>fn <a href='#method.is_sign_positive' class='fnname'>is_sign_positive</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.is_sign_negative-2' class="method"><span id='is_sign_negative.v-2' class='invisible'><code>fn <a href='#method.is_sign_negative' class='fnname'>is_sign_negative</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.min-2' class="method"><span id='min.v-2' class='invisible'><code>fn <a href='#method.min' class='fnname'>min</a>(self, other: Self) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.max-2' class="method"><span id='max.v-2' class='invisible'><code>fn <a href='#method.max' class='fnname'>max</a>(self, other: Self) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.recip-2' class="method"><span id='recip.v-2' class='invisible'><code>fn <a href='#method.recip' class='fnname'>recip</a>(self) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.powi-2' class="method"><span id='powi.v-2' class='invisible'><code>fn <a href='#method.powi' class='fnname'>powi</a>(self, n: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.to_degrees-1' class="method"><span id='to_degrees.v-2' class='invisible'><code>fn <a href='#method.to_degrees' class='fnname'>to_degrees</a>(self) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
<h4 id='method.to_radians-1' class="method"><span id='to_radians.v-2' class='invisible'><code>fn <a href='#method.to_radians' class='fnname'>to_radians</a>(self) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/num_traits/macros.rs.html#9-11' title='goto source code'>[src]</a></span></h4>
</div></span>
<h2 id='implementors' class='small-section-header'>
Implementors<a href='#implementors' class='anchor'></a>
</h2>
<ul class='item-list' id='implementors-list'>
</ul><script type="text/javascript" async
src="../../implementors/num_traits/float/trait.FloatCore.js">
</script></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt><kbd>?</kbd></dt>
<dd>Show this help dialog</dd>
<dt><kbd>S</kbd></dt>
<dd>Focus the search field</dd>
<dt><kbd></kbd></dt>
<dd>Move up in search results</dd>
<dt><kbd></kbd></dt>
<dd>Move down in search results</dd>
<dt><kbd></kbd></dt>
<dd>Switch tab</dd>
<dt><kbd>&#9166;</kbd></dt>
<dd>Go to active search result</dd>
<dt><kbd>+</kbd></dt>
<dd>Expand all sections</dd>
<dt><kbd>-</kbd></dt>
<dd>Collapse all sections</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code> or <code>* -> vec</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../../";
window.currentCrate = "num_traits";
</script>
<script src="../../main.js"></script>
<script defer src="../../search-index.js"></script>
</body>
</html>