blob: 1326831f6bc787960ad49a0bb33497719ec75039 [file] [log] [blame]
<!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="Generic trait for floating point numbers that works with `no_std`."><meta name="keywords" content="rust, rustlang, rust-lang, FloatCore"><title>FloatCore in num::traits::float - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" href="../../../normalize.css"><link rel="stylesheet" href="../../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" href="../../../ayu.css" disabled><link rel="stylesheet" href="../../../dark.css" disabled><link rel="stylesheet" href="../../../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../../../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../main.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../../favicon.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../../../num/index.html"><div class="logo-container"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../../num/index.html"><div class="logo-container"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">FloatCore</a></h2><div class="sidebar-elems"><section><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.classify">classify</a></li><li><a href="#tymethod.epsilon">epsilon</a></li><li><a href="#tymethod.infinity">infinity</a></li><li><a href="#tymethod.integer_decode">integer_decode</a></li><li><a href="#tymethod.max_value">max_value</a></li><li><a href="#tymethod.min_positive_value">min_positive_value</a></li><li><a href="#tymethod.min_value">min_value</a></li><li><a href="#tymethod.nan">nan</a></li><li><a href="#tymethod.neg_infinity">neg_infinity</a></li><li><a href="#tymethod.neg_zero">neg_zero</a></li><li><a href="#tymethod.to_degrees">to_degrees</a></li><li><a href="#tymethod.to_radians">to_radians</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.abs">abs</a></li><li><a href="#method.ceil">ceil</a></li><li><a href="#method.floor">floor</a></li><li><a href="#method.fract">fract</a></li><li><a href="#method.is_finite">is_finite</a></li><li><a href="#method.is_infinite">is_infinite</a></li><li><a href="#method.is_nan">is_nan</a></li><li><a href="#method.is_normal">is_normal</a></li><li><a href="#method.is_sign_negative">is_sign_negative</a></li><li><a href="#method.is_sign_positive">is_sign_positive</a></li><li><a href="#method.max">max</a></li><li><a href="#method.min">min</a></li><li><a href="#method.powi">powi</a></li><li><a href="#method.recip">recip</a></li><li><a href="#method.round">round</a></li><li><a href="#method.signum">signum</a></li><li><a href="#method.trunc">trunc</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-FloatCore-for-f32">f32</a></li><li><a href="#impl-FloatCore-for-f64">f64</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><h2><a href="index.html">In num::traits::float</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../wheel.svg"></a></div></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Trait <a href="../../index.html">num</a>::<wbr><a href="../index.html">traits</a>::<wbr><a href="index.html">float</a>::<wbr><a class="trait" href="#">FloatCore</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../../src/num_traits/float.rs.html#16">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="item-decl"><pre class="rust trait"><code>pub trait FloatCore: <a class="trait" href="../../trait.Num.html" title="trait num::Num">Num</a> + <a class="trait" href="../../trait.NumCast.html" title="trait num::NumCast">NumCast</a> + Neg&lt;Output = Self&gt; + PartialOrd&lt;Self&gt; + Copy {
<details class="rustdoc-toggle type-contents-toggle"><summary class="hideme"><span>Show 29 methods</span></summary> fn <a href="#tymethod.infinity" class="fnname">infinity</a>() -&gt; Self;
<span class="item-spacer"></span> fn <a href="#tymethod.neg_infinity" class="fnname">neg_infinity</a>() -&gt; Self;
<span class="item-spacer"></span> fn <a href="#tymethod.nan" class="fnname">nan</a>() -&gt; Self;
<span class="item-spacer"></span> fn <a href="#tymethod.neg_zero" class="fnname">neg_zero</a>() -&gt; Self;
<span class="item-spacer"></span> fn <a href="#tymethod.min_value" class="fnname">min_value</a>() -&gt; Self;
<span class="item-spacer"></span> fn <a href="#tymethod.min_positive_value" class="fnname">min_positive_value</a>() -&gt; Self;
<span class="item-spacer"></span> fn <a href="#tymethod.epsilon" class="fnname">epsilon</a>() -&gt; Self;
<span class="item-spacer"></span> fn <a href="#tymethod.max_value" class="fnname">max_value</a>() -&gt; Self;
<span class="item-spacer"></span> fn <a href="#tymethod.classify" class="fnname">classify</a>(self) -&gt; FpCategory;
<span class="item-spacer"></span> fn <a href="#tymethod.to_degrees" class="fnname">to_degrees</a>(self) -&gt; Self;
<span class="item-spacer"></span> fn <a href="#tymethod.to_radians" class="fnname">to_radians</a>(self) -&gt; Self;
<span class="item-spacer"></span> fn <a href="#tymethod.integer_decode" class="fnname">integer_decode</a>(self) -&gt; (u64, i16, i8);
fn <a href="#method.is_nan" class="fnname">is_nan</a>(self) -&gt; bool { ... }
<span class="item-spacer"></span> fn <a href="#method.is_infinite" class="fnname">is_infinite</a>(self) -&gt; bool { ... }
<span class="item-spacer"></span> fn <a href="#method.is_finite" class="fnname">is_finite</a>(self) -&gt; bool { ... }
<span class="item-spacer"></span> fn <a href="#method.is_normal" class="fnname">is_normal</a>(self) -&gt; bool { ... }
<span class="item-spacer"></span> fn <a href="#method.floor" class="fnname">floor</a>(self) -&gt; Self { ... }
<span class="item-spacer"></span> fn <a href="#method.ceil" class="fnname">ceil</a>(self) -&gt; Self { ... }
<span class="item-spacer"></span> fn <a href="#method.round" class="fnname">round</a>(self) -&gt; Self { ... }
<span class="item-spacer"></span> fn <a href="#method.trunc" class="fnname">trunc</a>(self) -&gt; Self { ... }
<span class="item-spacer"></span> fn <a href="#method.fract" class="fnname">fract</a>(self) -&gt; Self { ... }
<span class="item-spacer"></span> fn <a href="#method.abs" class="fnname">abs</a>(self) -&gt; Self { ... }
<span class="item-spacer"></span> fn <a href="#method.signum" class="fnname">signum</a>(self) -&gt; Self { ... }
<span class="item-spacer"></span> fn <a href="#method.is_sign_positive" class="fnname">is_sign_positive</a>(self) -&gt; bool { ... }
<span class="item-spacer"></span> fn <a href="#method.is_sign_negative" class="fnname">is_sign_negative</a>(self) -&gt; bool { ... }
<span class="item-spacer"></span> fn <a href="#method.min" class="fnname">min</a>(self, other: Self) -&gt; Self { ... }
<span class="item-spacer"></span> fn <a href="#method.max" class="fnname">max</a>(self, other: Self) -&gt; Self { ... }
<span class="item-spacer"></span> fn <a href="#method.recip" class="fnname">recip</a>(self) -&gt; Self { ... }
<span class="item-spacer"></span> fn <a href="#method.powi" class="fnname">powi</a>(self, exp: i32) -&gt; Self { ... }
</details>}</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><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></details><h2 id="required-methods" class="small-section-header">Required Methods<a href="#required-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.infinity" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#32">source</a><h4 class="code-header">fn <a href="#tymethod.infinity" class="fnname">infinity</a>() -&gt; Self</h4></section></summary><div class="docblock"><p>Returns positive infinity.</p>
<h5 id="examples"><a href="#examples">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">use </span>std::{f32, f64};
<span class="kw">fn </span>check&lt;T: FloatCore&gt;(x: T) {
<span class="macro">assert!</span>(T::infinity() == x);
}
check(f32::INFINITY);
check(f64::INFINITY);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.neg_infinity" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#49">source</a><h4 class="code-header">fn <a href="#tymethod.neg_infinity" class="fnname">neg_infinity</a>() -&gt; Self</h4></section></summary><div class="docblock"><p>Returns negative infinity.</p>
<h5 id="examples-1"><a href="#examples-1">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">use </span>std::{f32, f64};
<span class="kw">fn </span>check&lt;T: FloatCore&gt;(x: T) {
<span class="macro">assert!</span>(T::neg_infinity() == x);
}
check(f32::NEG_INFINITY);
check(f64::NEG_INFINITY);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.nan" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#66">source</a><h4 class="code-header">fn <a href="#tymethod.nan" class="fnname">nan</a>() -&gt; Self</h4></section></summary><div class="docblock"><p>Returns NaN.</p>
<h5 id="examples-2"><a href="#examples-2">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">fn </span>check&lt;T: FloatCore&gt;() {
<span class="kw">let </span>n = T::nan();
<span class="macro">assert!</span>(n != n);
}
check::&lt;f32&gt;();
check::&lt;f64&gt;();</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.neg_zero" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#85">source</a><h4 class="code-header">fn <a href="#tymethod.neg_zero" class="fnname">neg_zero</a>() -&gt; Self</h4></section></summary><div class="docblock"><p>Returns <code>-0.0</code>.</p>
<h5 id="examples-3"><a href="#examples-3">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">use </span>std::{f32, f64};
<span class="kw">fn </span>check&lt;T: FloatCore&gt;(n: T) {
<span class="kw">let </span>z = T::neg_zero();
<span class="macro">assert!</span>(z.is_zero());
<span class="macro">assert!</span>(T::one() / z == n);
}
check(f32::NEG_INFINITY);
check(f64::NEG_INFINITY);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.min_value" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#102">source</a><h4 class="code-header">fn <a href="#tymethod.min_value" class="fnname">min_value</a>() -&gt; Self</h4></section></summary><div class="docblock"><p>Returns the smallest finite value that this type can represent.</p>
<h5 id="examples-4"><a href="#examples-4">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">use </span>std::{f32, f64};
<span class="kw">fn </span>check&lt;T: FloatCore&gt;(x: T) {
<span class="macro">assert!</span>(T::min_value() == x);
}
check(f32::MIN);
check(f64::MIN);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.min_positive_value" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#119">source</a><h4 class="code-header">fn <a href="#tymethod.min_positive_value" class="fnname">min_positive_value</a>() -&gt; Self</h4></section></summary><div class="docblock"><p>Returns the smallest positive, normalized value that this type can represent.</p>
<h5 id="examples-5"><a href="#examples-5">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">use </span>std::{f32, f64};
<span class="kw">fn </span>check&lt;T: FloatCore&gt;(x: T) {
<span class="macro">assert!</span>(T::min_positive_value() == x);
}
check(f32::MIN_POSITIVE);
check(f64::MIN_POSITIVE);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.epsilon" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#136">source</a><h4 class="code-header">fn <a href="#tymethod.epsilon" class="fnname">epsilon</a>() -&gt; Self</h4></section></summary><div class="docblock"><p>Returns epsilon, a small positive value.</p>
<h5 id="examples-6"><a href="#examples-6">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">use </span>std::{f32, f64};
<span class="kw">fn </span>check&lt;T: FloatCore&gt;(x: T) {
<span class="macro">assert!</span>(T::epsilon() == x);
}
check(f32::EPSILON);
check(f64::EPSILON);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.max_value" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#153">source</a><h4 class="code-header">fn <a href="#tymethod.max_value" class="fnname">max_value</a>() -&gt; Self</h4></section></summary><div class="docblock"><p>Returns the largest finite value that this type can represent.</p>
<h5 id="examples-7"><a href="#examples-7">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">use </span>std::{f32, f64};
<span class="kw">fn </span>check&lt;T: FloatCore&gt;(x: T) {
<span class="macro">assert!</span>(T::max_value() == x);
}
check(f32::MAX);
check(f64::MAX);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.classify" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#269">source</a><h4 class="code-header">fn <a href="#tymethod.classify" class="fnname">classify</a>(self) -&gt; FpCategory</h4></section></summary><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>
<h5 id="examples-8"><a href="#examples-8">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">use </span>std::{f32, f64};
<span class="kw">use </span>std::num::FpCategory;
<span class="kw">fn </span>check&lt;T: FloatCore&gt;(x: T, c: FpCategory) {
<span class="macro">assert!</span>(x.classify() == c);
}
check(f32::INFINITY, FpCategory::Infinite);
check(f32::MAX, FpCategory::Normal);
check(f64::NAN, FpCategory::Nan);
check(f64::MIN_POSITIVE, FpCategory::Normal);
check(f64::MIN_POSITIVE / <span class="number">2.0</span>, FpCategory::Subnormal);
check(<span class="number">0.0f64</span>, FpCategory::Zero);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.to_degrees" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#704">source</a><h4 class="code-header">fn <a href="#tymethod.to_degrees" class="fnname">to_degrees</a>(self) -&gt; Self</h4></section></summary><div class="docblock"><p>Converts to degrees, assuming the number is in radians.</p>
<h5 id="examples-9"><a href="#examples-9">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">use </span>std::{f32, f64};
<span class="kw">fn </span>check&lt;T: FloatCore&gt;(rad: T, deg: T) {
<span class="macro">assert!</span>(rad.to_degrees() == deg);
}
check(<span class="number">0.0f32</span>, <span class="number">0.0</span>);
check(f32::consts::PI, <span class="number">180.0</span>);
check(f64::consts::FRAC_PI_4, <span class="number">45.0</span>);
check(f64::INFINITY, f64::INFINITY);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.to_radians" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#723">source</a><h4 class="code-header">fn <a href="#tymethod.to_radians" class="fnname">to_radians</a>(self) -&gt; Self</h4></section></summary><div class="docblock"><p>Converts to radians, assuming the number is in degrees.</p>
<h5 id="examples-10"><a href="#examples-10">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">use </span>std::{f32, f64};
<span class="kw">fn </span>check&lt;T: FloatCore&gt;(deg: T, rad: T) {
<span class="macro">assert!</span>(deg.to_radians() == rad);
}
check(<span class="number">0.0f32</span>, <span class="number">0.0</span>);
check(<span class="number">180.0</span>, f32::consts::PI);
check(<span class="number">45.0</span>, f64::consts::FRAC_PI_4);
check(f64::INFINITY, f64::INFINITY);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="tymethod.integer_decode" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#746">source</a><h4 class="code-header">fn <a href="#tymethod.integer_decode" class="fnname">integer_decode</a>(self) -&gt; (u64, i16, i8)</h4></section></summary><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>
<h5 id="examples-11"><a href="#examples-11">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">use </span>std::{f32, f64};
<span class="kw">fn </span>check&lt;T: FloatCore&gt;(x: T, m: u64, e: i16, s:i8) {
<span class="kw">let </span>(mantissa, exponent, sign) = x.integer_decode();
<span class="macro">assert_eq!</span>(mantissa, m);
<span class="macro">assert_eq!</span>(exponent, e);
<span class="macro">assert_eq!</span>(sign, s);
}
check(<span class="number">2.0f32</span>, <span class="number">1 </span>&lt;&lt; <span class="number">23</span>, -<span class="number">22</span>, <span class="number">1</span>);
check(-<span class="number">2.0f32</span>, <span class="number">1 </span>&lt;&lt; <span class="number">23</span>, -<span class="number">22</span>, -<span class="number">1</span>);
check(f32::INFINITY, <span class="number">1 </span>&lt;&lt; <span class="number">23</span>, <span class="number">105</span>, <span class="number">1</span>);
check(f64::NEG_INFINITY, <span class="number">1 </span>&lt;&lt; <span class="number">52</span>, <span class="number">972</span>, -<span class="number">1</span>);</code></pre></div>
</div></details></div><h2 id="provided-methods" class="small-section-header">Provided Methods<a href="#provided-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_nan" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#173">source</a><h4 class="code-header">fn <a href="#method.is_nan" class="fnname">is_nan</a>(self) -&gt; bool</h4></section></summary><div class="docblock"><p>Returns <code>true</code> if the number is NaN.</p>
<h5 id="examples-12"><a href="#examples-12">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">use </span>std::{f32, f64};
<span class="kw">fn </span>check&lt;T: FloatCore&gt;(x: T, p: bool) {
<span class="macro">assert!</span>(x.is_nan() == p);
}
check(f32::NAN, <span class="bool-val">true</span>);
check(f32::INFINITY, <span class="bool-val">false</span>);
check(f64::NAN, <span class="bool-val">true</span>);
check(<span class="number">0.0f64</span>, <span class="bool-val">false</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_infinite" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#197">source</a><h4 class="code-header">fn <a href="#method.is_infinite" class="fnname">is_infinite</a>(self) -&gt; bool</h4></section></summary><div class="docblock"><p>Returns <code>true</code> if the number is infinite.</p>
<h5 id="examples-13"><a href="#examples-13">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">use </span>std::{f32, f64};
<span class="kw">fn </span>check&lt;T: FloatCore&gt;(x: T, p: bool) {
<span class="macro">assert!</span>(x.is_infinite() == p);
}
check(f32::INFINITY, <span class="bool-val">true</span>);
check(f32::NEG_INFINITY, <span class="bool-val">true</span>);
check(f32::NAN, <span class="bool-val">false</span>);
check(f64::INFINITY, <span class="bool-val">true</span>);
check(f64::NEG_INFINITY, <span class="bool-val">true</span>);
check(<span class="number">0.0f64</span>, <span class="bool-val">false</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_finite" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#220">source</a><h4 class="code-header">fn <a href="#method.is_finite" class="fnname">is_finite</a>(self) -&gt; bool</h4></section></summary><div class="docblock"><p>Returns <code>true</code> if the number is neither infinite or NaN.</p>
<h5 id="examples-14"><a href="#examples-14">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">use </span>std::{f32, f64};
<span class="kw">fn </span>check&lt;T: FloatCore&gt;(x: T, p: bool) {
<span class="macro">assert!</span>(x.is_finite() == p);
}
check(f32::INFINITY, <span class="bool-val">false</span>);
check(f32::MAX, <span class="bool-val">true</span>);
check(f64::NEG_INFINITY, <span class="bool-val">false</span>);
check(f64::MIN_POSITIVE, <span class="bool-val">true</span>);
check(f64::NAN, <span class="bool-val">false</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_normal" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#243">source</a><h4 class="code-header">fn <a href="#method.is_normal" class="fnname">is_normal</a>(self) -&gt; bool</h4></section></summary><div class="docblock"><p>Returns <code>true</code> if the number is neither zero, infinite, subnormal or NaN.</p>
<h5 id="examples-15"><a href="#examples-15">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">use </span>std::{f32, f64};
<span class="kw">fn </span>check&lt;T: FloatCore&gt;(x: T, p: bool) {
<span class="macro">assert!</span>(x.is_normal() == p);
}
check(f32::INFINITY, <span class="bool-val">false</span>);
check(f32::MAX, <span class="bool-val">true</span>);
check(f64::NEG_INFINITY, <span class="bool-val">false</span>);
check(f64::MIN_POSITIVE, <span class="bool-val">true</span>);
check(<span class="number">0.0f64</span>, <span class="bool-val">false</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.floor" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#294">source</a><h4 class="code-header">fn <a href="#method.floor" class="fnname">floor</a>(self) -&gt; Self</h4></section></summary><div class="docblock"><p>Returns the largest integer less than or equal to a number.</p>
<h5 id="examples-16"><a href="#examples-16">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">use </span>std::{f32, f64};
<span class="kw">fn </span>check&lt;T: FloatCore&gt;(x: T, y: T) {
<span class="macro">assert!</span>(x.floor() == y);
}
check(f32::INFINITY, f32::INFINITY);
check(<span class="number">0.9f32</span>, <span class="number">0.0</span>);
check(<span class="number">1.0f32</span>, <span class="number">1.0</span>);
check(<span class="number">1.1f32</span>, <span class="number">1.0</span>);
check(-<span class="number">0.0f64</span>, <span class="number">0.0</span>);
check(-<span class="number">0.9f64</span>, -<span class="number">1.0</span>);
check(-<span class="number">1.0f64</span>, -<span class="number">1.0</span>);
check(-<span class="number">1.1f64</span>, -<span class="number">2.0</span>);
check(f64::MIN, f64::MIN);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.ceil" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#328">source</a><h4 class="code-header">fn <a href="#method.ceil" class="fnname">ceil</a>(self) -&gt; Self</h4></section></summary><div class="docblock"><p>Returns the smallest integer greater than or equal to a number.</p>
<h5 id="examples-17"><a href="#examples-17">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">use </span>std::{f32, f64};
<span class="kw">fn </span>check&lt;T: FloatCore&gt;(x: T, y: T) {
<span class="macro">assert!</span>(x.ceil() == y);
}
check(f32::INFINITY, f32::INFINITY);
check(<span class="number">0.9f32</span>, <span class="number">1.0</span>);
check(<span class="number">1.0f32</span>, <span class="number">1.0</span>);
check(<span class="number">1.1f32</span>, <span class="number">2.0</span>);
check(-<span class="number">0.0f64</span>, <span class="number">0.0</span>);
check(-<span class="number">0.9f64</span>, -<span class="number">0.0</span>);
check(-<span class="number">1.0f64</span>, -<span class="number">1.0</span>);
check(-<span class="number">1.1f64</span>, -<span class="number">1.0</span>);
check(f64::MIN, f64::MIN);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.round" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#361">source</a><h4 class="code-header">fn <a href="#method.round" class="fnname">round</a>(self) -&gt; Self</h4></section></summary><div class="docblock"><p>Returns the nearest integer to a number. Round half-way cases away from <code>0.0</code>.</p>
<h5 id="examples-18"><a href="#examples-18">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">use </span>std::{f32, f64};
<span class="kw">fn </span>check&lt;T: FloatCore&gt;(x: T, y: T) {
<span class="macro">assert!</span>(x.round() == y);
}
check(f32::INFINITY, f32::INFINITY);
check(<span class="number">0.4f32</span>, <span class="number">0.0</span>);
check(<span class="number">0.5f32</span>, <span class="number">1.0</span>);
check(<span class="number">0.6f32</span>, <span class="number">1.0</span>);
check(-<span class="number">0.4f64</span>, <span class="number">0.0</span>);
check(-<span class="number">0.5f64</span>, -<span class="number">1.0</span>);
check(-<span class="number">0.6f64</span>, -<span class="number">1.0</span>);
check(f64::MIN, f64::MIN);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.trunc" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#405">source</a><h4 class="code-header">fn <a href="#method.trunc" class="fnname">trunc</a>(self) -&gt; Self</h4></section></summary><div class="docblock"><p>Return the integer part of a number.</p>
<h5 id="examples-19"><a href="#examples-19">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">use </span>std::{f32, f64};
<span class="kw">fn </span>check&lt;T: FloatCore&gt;(x: T, y: T) {
<span class="macro">assert!</span>(x.trunc() == y);
}
check(f32::INFINITY, f32::INFINITY);
check(<span class="number">0.9f32</span>, <span class="number">0.0</span>);
check(<span class="number">1.0f32</span>, <span class="number">1.0</span>);
check(<span class="number">1.1f32</span>, <span class="number">1.0</span>);
check(-<span class="number">0.0f64</span>, <span class="number">0.0</span>);
check(-<span class="number">0.9f64</span>, -<span class="number">0.0</span>);
check(-<span class="number">1.0f64</span>, -<span class="number">1.0</span>);
check(-<span class="number">1.1f64</span>, -<span class="number">1.0</span>);
check(f64::MIN, f64::MIN);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.fract" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#437">source</a><h4 class="code-header">fn <a href="#method.fract" class="fnname">fract</a>(self) -&gt; Self</h4></section></summary><div class="docblock"><p>Returns the fractional part of a number.</p>
<h5 id="examples-20"><a href="#examples-20">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">use </span>std::{f32, f64};
<span class="kw">fn </span>check&lt;T: FloatCore&gt;(x: T, y: T) {
<span class="macro">assert!</span>(x.fract() == y);
}
check(f32::MAX, <span class="number">0.0</span>);
check(<span class="number">0.75f32</span>, <span class="number">0.75</span>);
check(<span class="number">1.0f32</span>, <span class="number">0.0</span>);
check(<span class="number">1.25f32</span>, <span class="number">0.25</span>);
check(-<span class="number">0.0f64</span>, <span class="number">0.0</span>);
check(-<span class="number">0.75f64</span>, -<span class="number">0.75</span>);
check(-<span class="number">1.0f64</span>, <span class="number">0.0</span>);
check(-<span class="number">1.25f64</span>, -<span class="number">0.25</span>);
check(f64::MIN, <span class="number">0.0</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.abs" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#466">source</a><h4 class="code-header">fn <a href="#method.abs" class="fnname">abs</a>(self) -&gt; Self</h4></section></summary><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>
<h5 id="examples-21"><a href="#examples-21">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">use </span>std::{f32, f64};
<span class="kw">fn </span>check&lt;T: FloatCore&gt;(x: T, y: T) {
<span class="macro">assert!</span>(x.abs() == y);
}
check(f32::INFINITY, f32::INFINITY);
check(<span class="number">1.0f32</span>, <span class="number">1.0</span>);
check(<span class="number">0.0f64</span>, <span class="number">0.0</span>);
check(-<span class="number">0.0f64</span>, <span class="number">0.0</span>);
check(-<span class="number">1.0f64</span>, <span class="number">1.0</span>);
check(f64::MIN, f64::MAX);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.signum" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#500">source</a><h4 class="code-header">fn <a href="#method.signum" class="fnname">signum</a>(self) -&gt; Self</h4></section></summary><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>
<h5 id="examples-22"><a href="#examples-22">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">use </span>std::{f32, f64};
<span class="kw">fn </span>check&lt;T: FloatCore&gt;(x: T, y: T) {
<span class="macro">assert!</span>(x.signum() == y);
}
check(f32::INFINITY, <span class="number">1.0</span>);
check(<span class="number">3.0f32</span>, <span class="number">1.0</span>);
check(<span class="number">0.0f32</span>, <span class="number">1.0</span>);
check(-<span class="number">0.0f64</span>, -<span class="number">1.0</span>);
check(-<span class="number">3.0f64</span>, -<span class="number">1.0</span>);
check(f64::MIN, -<span class="number">1.0</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_sign_positive" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#533">source</a><h4 class="code-header">fn <a href="#method.is_sign_positive" class="fnname">is_sign_positive</a>(self) -&gt; bool</h4></section></summary><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>
<h5 id="examples-23"><a href="#examples-23">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">use </span>std::{f32, f64};
<span class="kw">fn </span>check&lt;T: FloatCore&gt;(x: T, p: bool) {
<span class="macro">assert!</span>(x.is_sign_positive() == p);
}
check(f32::INFINITY, <span class="bool-val">true</span>);
check(f32::MAX, <span class="bool-val">true</span>);
check(<span class="number">0.0f32</span>, <span class="bool-val">true</span>);
check(-<span class="number">0.0f64</span>, <span class="bool-val">false</span>);
check(f64::NEG_INFINITY, <span class="bool-val">false</span>);
check(f64::MIN_POSITIVE, <span class="bool-val">true</span>);
check(-f64::NAN, <span class="bool-val">false</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_sign_negative" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#560">source</a><h4 class="code-header">fn <a href="#method.is_sign_negative" class="fnname">is_sign_negative</a>(self) -&gt; bool</h4></section></summary><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>
<h5 id="examples-24"><a href="#examples-24">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">use </span>std::{f32, f64};
<span class="kw">fn </span>check&lt;T: FloatCore&gt;(x: T, p: bool) {
<span class="macro">assert!</span>(x.is_sign_negative() == p);
}
check(f32::INFINITY, <span class="bool-val">false</span>);
check(f32::MAX, <span class="bool-val">false</span>);
check(<span class="number">0.0f32</span>, <span class="bool-val">false</span>);
check(-<span class="number">0.0f64</span>, <span class="bool-val">true</span>);
check(f64::NEG_INFINITY, <span class="bool-val">true</span>);
check(f64::MIN_POSITIVE, <span class="bool-val">false</span>);
check(f64::NAN, <span class="bool-val">false</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.min" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#585">source</a><h4 class="code-header">fn <a href="#method.min" class="fnname">min</a>(self, other: Self) -&gt; Self</h4></section></summary><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>
<h5 id="examples-25"><a href="#examples-25">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">use </span>std::{f32, f64};
<span class="kw">fn </span>check&lt;T: FloatCore&gt;(x: T, y: T, min: T) {
<span class="macro">assert!</span>(x.min(y) == min);
}
check(<span class="number">1.0f32</span>, <span class="number">2.0</span>, <span class="number">1.0</span>);
check(f32::NAN, <span class="number">2.0</span>, <span class="number">2.0</span>);
check(<span class="number">1.0f64</span>, -<span class="number">2.0</span>, -<span class="number">2.0</span>);
check(<span class="number">1.0f64</span>, f64::NAN, <span class="number">1.0</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.max" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#619">source</a><h4 class="code-header">fn <a href="#method.max" class="fnname">max</a>(self, other: Self) -&gt; Self</h4></section></summary><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>
<h5 id="examples-26"><a href="#examples-26">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">use </span>std::{f32, f64};
<span class="kw">fn </span>check&lt;T: FloatCore&gt;(x: T, y: T, max: T) {
<span class="macro">assert!</span>(x.max(y) == max);
}
check(<span class="number">1.0f32</span>, <span class="number">2.0</span>, <span class="number">2.0</span>);
check(<span class="number">1.0f32</span>, f32::NAN, <span class="number">1.0</span>);
check(-<span class="number">1.0f64</span>, <span class="number">2.0</span>, <span class="number">2.0</span>);
check(-<span class="number">1.0f64</span>, f64::NAN, -<span class="number">1.0</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.recip" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#652">source</a><h4 class="code-header">fn <a href="#method.recip" class="fnname">recip</a>(self) -&gt; Self</h4></section></summary><div class="docblock"><p>Returns the reciprocal (multiplicative inverse) of the number.</p>
<h5 id="examples-27"><a href="#examples-27">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">use </span>std::{f32, f64};
<span class="kw">fn </span>check&lt;T: FloatCore&gt;(x: T, y: T) {
<span class="macro">assert!</span>(x.recip() == y);
<span class="macro">assert!</span>(y.recip() == x);
}
check(f32::INFINITY, <span class="number">0.0</span>);
check(<span class="number">2.0f32</span>, <span class="number">0.5</span>);
check(-<span class="number">0.25f64</span>, -<span class="number">4.0</span>);
check(-<span class="number">0.0f64</span>, f64::NEG_INFINITY);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.powi" class="method has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#676">source</a><h4 class="code-header">fn <a href="#method.powi" class="fnname">powi</a>(self, exp: i32) -&gt; Self</h4></section></summary><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>
<h5 id="examples-28"><a href="#examples-28">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>num_traits::float::FloatCore;
<span class="kw">fn </span>check&lt;T: FloatCore&gt;(x: T, exp: i32, powi: T) {
<span class="macro">assert!</span>(x.powi(exp) == powi);
}
check(<span class="number">9.0f32</span>, <span class="number">2</span>, <span class="number">81.0</span>);
check(<span class="number">1.0f32</span>, -<span class="number">2</span>, <span class="number">1.0</span>);
check(<span class="number">10.0f64</span>, <span class="number">20</span>, <span class="number">1e20</span>);
check(<span class="number">4.0f64</span>, -<span class="number">2</span>, <span class="number">0.0625</span>);
check(-<span class="number">1.0f64</span>, std::i32::MIN, <span class="number">1.0</span>);</code></pre></div>
</div></details></div><h2 id="foreign-impls" class="small-section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor"></a></h2><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-FloatCore-for-f32" class="impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#749">source</a><a href="#impl-FloatCore-for-f32" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.FloatCore.html" title="trait num::traits::float::FloatCore">FloatCore</a> for f32</h3></section></summary><div class="impl-items"><section id="method.infinity" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#750-759">source</a><a href="#method.infinity" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.infinity" class="fnname">infinity</a>() -&gt; f32</h4></section><section id="method.neg_infinity" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#750-759">source</a><a href="#method.neg_infinity" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.neg_infinity" class="fnname">neg_infinity</a>() -&gt; f32</h4></section><section id="method.nan" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#750-759">source</a><a href="#method.nan" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.nan" class="fnname">nan</a>() -&gt; f32</h4></section><section id="method.neg_zero" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#750-759">source</a><a href="#method.neg_zero" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.neg_zero" class="fnname">neg_zero</a>() -&gt; f32</h4></section><section id="method.min_value" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#750-759">source</a><a href="#method.min_value" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.min_value" class="fnname">min_value</a>() -&gt; f32</h4></section><section id="method.min_positive_value" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#750-759">source</a><a href="#method.min_positive_value" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.min_positive_value" class="fnname">min_positive_value</a>() -&gt; f32</h4></section><section id="method.epsilon" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#750-759">source</a><a href="#method.epsilon" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.epsilon" class="fnname">epsilon</a>() -&gt; f32</h4></section><section id="method.max_value" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#750-759">source</a><a href="#method.max_value" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.max_value" class="fnname">max_value</a>() -&gt; f32</h4></section><section id="method.integer_decode" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#762">source</a><a href="#method.integer_decode" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.integer_decode" class="fnname">integer_decode</a>(self) -&gt; (u64, i16, i8)</h4></section><section id="method.is_nan-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#810-831">source</a><a href="#method.is_nan-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.is_nan" class="fnname">is_nan</a>(self) -&gt; bool</h4></section><section id="method.is_infinite-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#810-831">source</a><a href="#method.is_infinite-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.is_infinite" class="fnname">is_infinite</a>(self) -&gt; bool</h4></section><section id="method.is_finite-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#810-831">source</a><a href="#method.is_finite-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.is_finite" class="fnname">is_finite</a>(self) -&gt; bool</h4></section><section id="method.is_normal-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#810-831">source</a><a href="#method.is_normal-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.is_normal" class="fnname">is_normal</a>(self) -&gt; bool</h4></section><section id="method.classify" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#810-831">source</a><a href="#method.classify" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.classify" class="fnname">classify</a>(self) -&gt; FpCategory</h4></section><section id="method.floor-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#810-831">source</a><a href="#method.floor-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.floor" class="fnname">floor</a>(self) -&gt; f32</h4></section><section id="method.ceil-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#810-831">source</a><a href="#method.ceil-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.ceil" class="fnname">ceil</a>(self) -&gt; f32</h4></section><section id="method.round-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#810-831">source</a><a href="#method.round-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.round" class="fnname">round</a>(self) -&gt; f32</h4></section><section id="method.trunc-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#810-831">source</a><a href="#method.trunc-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.trunc" class="fnname">trunc</a>(self) -&gt; f32</h4></section><section id="method.fract-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#810-831">source</a><a href="#method.fract-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.fract" class="fnname">fract</a>(self) -&gt; f32</h4></section><section id="method.abs-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#810-831">source</a><a href="#method.abs-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.abs" class="fnname">abs</a>(self) -&gt; f32</h4></section><section id="method.signum-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#810-831">source</a><a href="#method.signum-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.signum" class="fnname">signum</a>(self) -&gt; f32</h4></section><section id="method.is_sign_positive-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#810-831">source</a><a href="#method.is_sign_positive-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.is_sign_positive" class="fnname">is_sign_positive</a>(self) -&gt; bool</h4></section><section id="method.is_sign_negative-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#810-831">source</a><a href="#method.is_sign_negative-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.is_sign_negative" class="fnname">is_sign_negative</a>(self) -&gt; bool</h4></section><section id="method.min-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#810-831">source</a><a href="#method.min-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.min" class="fnname">min</a>(self, other: f32) -&gt; f32</h4></section><section id="method.max-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#810-831">source</a><a href="#method.max-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.max" class="fnname">max</a>(self, other: f32) -&gt; f32</h4></section><section id="method.recip-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#810-831">source</a><a href="#method.recip-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.recip" class="fnname">recip</a>(self) -&gt; f32</h4></section><section id="method.powi-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#810-831">source</a><a href="#method.powi-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.powi" class="fnname">powi</a>(self, n: i32) -&gt; f32</h4></section><section id="method.to_degrees" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#810-831">source</a><a href="#method.to_degrees" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.to_degrees" class="fnname">to_degrees</a>(self) -&gt; f32</h4></section><section id="method.to_radians" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#810-831">source</a><a href="#method.to_radians" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.to_radians" class="fnname">to_radians</a>(self) -&gt; f32</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-FloatCore-for-f64" class="impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#851">source</a><a href="#impl-FloatCore-for-f64" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.FloatCore.html" title="trait num::traits::float::FloatCore">FloatCore</a> for f64</h3></section></summary><div class="impl-items"><section id="method.infinity-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#852-861">source</a><a href="#method.infinity-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.infinity" class="fnname">infinity</a>() -&gt; f64</h4></section><section id="method.neg_infinity-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#852-861">source</a><a href="#method.neg_infinity-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.neg_infinity" class="fnname">neg_infinity</a>() -&gt; f64</h4></section><section id="method.nan-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#852-861">source</a><a href="#method.nan-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.nan" class="fnname">nan</a>() -&gt; f64</h4></section><section id="method.neg_zero-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#852-861">source</a><a href="#method.neg_zero-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.neg_zero" class="fnname">neg_zero</a>() -&gt; f64</h4></section><section id="method.min_value-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#852-861">source</a><a href="#method.min_value-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.min_value" class="fnname">min_value</a>() -&gt; f64</h4></section><section id="method.min_positive_value-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#852-861">source</a><a href="#method.min_positive_value-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.min_positive_value" class="fnname">min_positive_value</a>() -&gt; f64</h4></section><section id="method.epsilon-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#852-861">source</a><a href="#method.epsilon-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.epsilon" class="fnname">epsilon</a>() -&gt; f64</h4></section><section id="method.max_value-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#852-861">source</a><a href="#method.max_value-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.max_value" class="fnname">max_value</a>() -&gt; f64</h4></section><section id="method.integer_decode-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#864">source</a><a href="#method.integer_decode-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.integer_decode" class="fnname">integer_decode</a>(self) -&gt; (u64, i16, i8)</h4></section><section id="method.is_nan-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#913-934">source</a><a href="#method.is_nan-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.is_nan" class="fnname">is_nan</a>(self) -&gt; bool</h4></section><section id="method.is_infinite-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#913-934">source</a><a href="#method.is_infinite-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.is_infinite" class="fnname">is_infinite</a>(self) -&gt; bool</h4></section><section id="method.is_finite-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#913-934">source</a><a href="#method.is_finite-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.is_finite" class="fnname">is_finite</a>(self) -&gt; bool</h4></section><section id="method.is_normal-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#913-934">source</a><a href="#method.is_normal-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.is_normal" class="fnname">is_normal</a>(self) -&gt; bool</h4></section><section id="method.classify-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#913-934">source</a><a href="#method.classify-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.classify" class="fnname">classify</a>(self) -&gt; FpCategory</h4></section><section id="method.floor-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#913-934">source</a><a href="#method.floor-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.floor" class="fnname">floor</a>(self) -&gt; f64</h4></section><section id="method.ceil-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#913-934">source</a><a href="#method.ceil-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.ceil" class="fnname">ceil</a>(self) -&gt; f64</h4></section><section id="method.round-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#913-934">source</a><a href="#method.round-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.round" class="fnname">round</a>(self) -&gt; f64</h4></section><section id="method.trunc-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#913-934">source</a><a href="#method.trunc-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.trunc" class="fnname">trunc</a>(self) -&gt; f64</h4></section><section id="method.fract-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#913-934">source</a><a href="#method.fract-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.fract" class="fnname">fract</a>(self) -&gt; f64</h4></section><section id="method.abs-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#913-934">source</a><a href="#method.abs-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.abs" class="fnname">abs</a>(self) -&gt; f64</h4></section><section id="method.signum-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#913-934">source</a><a href="#method.signum-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.signum" class="fnname">signum</a>(self) -&gt; f64</h4></section><section id="method.is_sign_positive-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#913-934">source</a><a href="#method.is_sign_positive-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.is_sign_positive" class="fnname">is_sign_positive</a>(self) -&gt; bool</h4></section><section id="method.is_sign_negative-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#913-934">source</a><a href="#method.is_sign_negative-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.is_sign_negative" class="fnname">is_sign_negative</a>(self) -&gt; bool</h4></section><section id="method.min-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#913-934">source</a><a href="#method.min-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.min" class="fnname">min</a>(self, other: f64) -&gt; f64</h4></section><section id="method.max-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#913-934">source</a><a href="#method.max-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.max" class="fnname">max</a>(self, other: f64) -&gt; f64</h4></section><section id="method.recip-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#913-934">source</a><a href="#method.recip-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.recip" class="fnname">recip</a>(self) -&gt; f64</h4></section><section id="method.powi-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#913-934">source</a><a href="#method.powi-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.powi" class="fnname">powi</a>(self, n: i32) -&gt; f64</h4></section><section id="method.to_degrees-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#913-934">source</a><a href="#method.to_degrees-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.to_degrees" class="fnname">to_degrees</a>(self) -&gt; f64</h4></section><section id="method.to_radians-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../../src/num_traits/float.rs.html#913-934">source</a><a href="#method.to_radians-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.to_radians" class="fnname">to_radians</a>(self) -&gt; f64</h4></section></div></details><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div id="implementors-list"></div><script src="../../../implementors/num_traits/float/trait.FloatCore.js" data-ignore-extern-crates="core" async></script></section></div></main><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="num" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html>