blob: 1d5fecf43e2e48a4197e3346797fd81737fada3e [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="Provides methods to compute an integer’s square root, cube root, and arbitrary `n`th root."><meta name="keywords" content="rust, rustlang, rust-lang, Roots"><title>Roots in num::integer - 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="#">Roots</a></h2><div class="sidebar-elems"><section><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.nth_root">nth_root</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.cbrt">cbrt</a></li><li><a href="#method.sqrt">sqrt</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-Roots-for-i128">i128</a></li><li><a href="#impl-Roots-for-i16">i16</a></li><li><a href="#impl-Roots-for-i32">i32</a></li><li><a href="#impl-Roots-for-i64">i64</a></li><li><a href="#impl-Roots-for-i8">i8</a></li><li><a href="#impl-Roots-for-isize">isize</a></li><li><a href="#impl-Roots-for-u128">u128</a></li><li><a href="#impl-Roots-for-u16">u16</a></li><li><a href="#impl-Roots-for-u32">u32</a></li><li><a href="#impl-Roots-for-u64">u64</a></li><li><a href="#impl-Roots-for-u8">u8</a></li><li><a href="#impl-Roots-for-usize">usize</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><h2><a href="index.html">In num::integer</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">integer</a>::<wbr><a class="trait" href="#">Roots</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_integer/roots.rs.html#9">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 Roots: <a class="trait" href="../trait.Integer.html" title="trait num::Integer">Integer</a> {
fn <a href="#tymethod.nth_root" class="fnname">nth_root</a>(&amp;self, n: u32) -&gt; Self;
fn <a href="#method.sqrt" class="fnname">sqrt</a>(&amp;self) -&gt; Self { ... }
<span class="item-spacer"></span> fn <a href="#method.cbrt" class="fnname">cbrt</a>(&amp;self) -&gt; Self { ... }
}</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Provides methods to compute an integer’s square root, cube root,
and arbitrary <code>n</code>th root.</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.nth_root" class="method has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#55">source</a><h4 class="code-header">fn <a href="#tymethod.nth_root" class="fnname">nth_root</a>(&amp;self, n: u32) -&gt; Self</h4></section></summary><div class="docblock"><p>Returns the truncated principal <code>n</code>th root of an integer
<code>if x &gt;= 0 { ⌊ⁿ√x⌋ } else { ⌈ⁿ√x⌉ }</code></p>
<p>This is solving for <code>r</code> in <code>rⁿ = x</code>, rounding toward zero.
If <code>x</code> is positive, the result will satisfy <code>rⁿ ≤ x &lt; (r+1)ⁿ</code>.
If <code>x</code> is negative and <code>n</code> is odd, then <code>(r-1)ⁿ &lt; x ≤ rⁿ</code>.</p>
<h5 id="panics"><a href="#panics">Panics</a></h5>
<p>Panics if <code>n</code> is zero:</p>
<div class="example-wrap should_panic"><div class='tooltip'></div><pre class="rust rust-example-rendered"><code><span class="macro">println!</span>(<span class="string">&quot;can&#39;t compute ⁰√x : {}&quot;</span>, <span class="number">123</span>.nth_root(<span class="number">0</span>));</code></pre></div>
<p>or if <code>n</code> is even and <code>self</code> is negative:</p>
<div class="example-wrap should_panic"><div class='tooltip'></div><pre class="rust rust-example-rendered"><code><span class="macro">println!</span>(<span class="string">&quot;no imaginary numbers... {}&quot;</span>, (-<span class="number">1</span>).nth_root(<span class="number">10</span>));</code></pre></div>
<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_integer::Roots;
<span class="kw">let </span>x: i32 = <span class="number">12345</span>;
<span class="macro">assert_eq!</span>(x.nth_root(<span class="number">1</span>), x);
<span class="macro">assert_eq!</span>(x.nth_root(<span class="number">2</span>), x.sqrt());
<span class="macro">assert_eq!</span>(x.nth_root(<span class="number">3</span>), x.cbrt());
<span class="macro">assert_eq!</span>(x.nth_root(<span class="number">4</span>), <span class="number">10</span>);
<span class="macro">assert_eq!</span>(x.nth_root(<span class="number">13</span>), <span class="number">2</span>);
<span class="macro">assert_eq!</span>(x.nth_root(<span class="number">14</span>), <span class="number">1</span>);
<span class="macro">assert_eq!</span>(x.nth_root(std::u32::MAX), <span class="number">1</span>);
<span class="macro">assert_eq!</span>(std::i32::MAX.nth_root(<span class="number">30</span>), <span class="number">2</span>);
<span class="macro">assert_eq!</span>(std::i32::MAX.nth_root(<span class="number">31</span>), <span class="number">1</span>);
<span class="macro">assert_eq!</span>(std::i32::MIN.nth_root(<span class="number">31</span>), -<span class="number">2</span>);
<span class="macro">assert_eq!</span>((std::i32::MIN + <span class="number">1</span>).nth_root(<span class="number">31</span>), -<span class="number">1</span>);
<span class="macro">assert_eq!</span>(std::u32::MAX.nth_root(<span class="number">31</span>), <span class="number">2</span>);
<span class="macro">assert_eq!</span>(std::u32::MAX.nth_root(<span class="number">32</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.sqrt" class="method has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#82">source</a><h4 class="code-header">fn <a href="#method.sqrt" class="fnname">sqrt</a>(&amp;self) -&gt; Self</h4></section></summary><div class="docblock"><p>Returns the truncated principal square root of an integer – <code>⌊√x⌋</code></p>
<p>This is solving for <code>r</code> in <code>r² = x</code>, rounding toward zero.
The result will satisfy <code>r² ≤ x &lt; (r+1)²</code>.</p>
<h5 id="panics-1"><a href="#panics-1">Panics</a></h5>
<p>Panics if <code>self</code> is less than zero:</p>
<div class="example-wrap should_panic"><div class='tooltip'></div><pre class="rust rust-example-rendered"><code><span class="macro">println!</span>(<span class="string">&quot;no imaginary numbers... {}&quot;</span>, (-<span class="number">1</span>).sqrt());</code></pre></div>
<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_integer::Roots;
<span class="kw">let </span>x: i32 = <span class="number">12345</span>;
<span class="macro">assert_eq!</span>((x * x).sqrt(), x);
<span class="macro">assert_eq!</span>((x * x + <span class="number">1</span>).sqrt(), x);
<span class="macro">assert_eq!</span>((x * x - <span class="number">1</span>).sqrt(), x - <span class="number">1</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.cbrt" class="method has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#108">source</a><h4 class="code-header">fn <a href="#method.cbrt" class="fnname">cbrt</a>(&amp;self) -&gt; Self</h4></section></summary><div class="docblock"><p>Returns the truncated principal cube root of an integer –
<code>if x &gt;= 0 { ⌊∛x⌋ } else { ⌈∛x⌉ }</code></p>
<p>This is solving for <code>r</code> in <code>r³ = x</code>, rounding toward zero.
If <code>x</code> is positive, the result will satisfy <code>r³ ≤ x &lt; (r+1)³</code>.
If <code>x</code> is negative, then <code>(r-1)³ &lt; x ≤ r³</code>.</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_integer::Roots;
<span class="kw">let </span>x: i32 = <span class="number">1234</span>;
<span class="macro">assert_eq!</span>((x * x * x).cbrt(), x);
<span class="macro">assert_eq!</span>((x * x * x + <span class="number">1</span>).cbrt(), x);
<span class="macro">assert_eq!</span>((x * x * x - <span class="number">1</span>).cbrt(), x - <span class="number">1</span>);
<span class="macro">assert_eq!</span>((-(x * x * x)).cbrt(), -x);
<span class="macro">assert_eq!</span>((-(x * x * x + <span class="number">1</span>)).cbrt(), -x);
<span class="macro">assert_eq!</span>((-(x * x * x - <span class="number">1</span>)).cbrt(), -(x - <span class="number">1</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-Roots-for-i16" class="impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#166">source</a><a href="#impl-Roots-for-i16" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Roots.html" title="trait num::integer::Roots">Roots</a> for i16</h3></section></summary><div class="impl-items"><section id="method.nth_root" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#166">source</a><a href="#method.nth_root" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.nth_root" class="fnname">nth_root</a>(&amp;self, n: u32) -&gt; i16</h4></section><section id="method.sqrt-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#166">source</a><a href="#method.sqrt-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.sqrt" class="fnname">sqrt</a>(&amp;self) -&gt; i16</h4></section><section id="method.cbrt-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#166">source</a><a href="#method.cbrt-1" class="anchor"></a><h4 class="code-header">fn <a href="#method.cbrt" class="fnname">cbrt</a>(&amp;self) -&gt; i16</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Roots-for-usize" class="impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#391">source</a><a href="#impl-Roots-for-usize" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Roots.html" title="trait num::integer::Roots">Roots</a> for usize</h3></section></summary><div class="impl-items"><section id="method.nth_root-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#391">source</a><a href="#method.nth_root-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.nth_root" class="fnname">nth_root</a>(&amp;self, n: u32) -&gt; usize</h4></section><section id="method.sqrt-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#391">source</a><a href="#method.sqrt-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.sqrt" class="fnname">sqrt</a>(&amp;self) -&gt; usize</h4></section><section id="method.cbrt-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#391">source</a><a href="#method.cbrt-2" class="anchor"></a><h4 class="code-header">fn <a href="#method.cbrt" class="fnname">cbrt</a>(&amp;self) -&gt; usize</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Roots-for-u16" class="impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#386">source</a><a href="#impl-Roots-for-u16" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Roots.html" title="trait num::integer::Roots">Roots</a> for u16</h3></section></summary><div class="impl-items"><section id="method.nth_root-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#386">source</a><a href="#method.nth_root-2" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.nth_root" class="fnname">nth_root</a>(&amp;self, n: u32) -&gt; u16</h4></section><section id="method.sqrt-3" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#386">source</a><a href="#method.sqrt-3" class="anchor"></a><h4 class="code-header">fn <a href="#method.sqrt" class="fnname">sqrt</a>(&amp;self) -&gt; u16</h4></section><section id="method.cbrt-3" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#386">source</a><a href="#method.cbrt-3" class="anchor"></a><h4 class="code-header">fn <a href="#method.cbrt" class="fnname">cbrt</a>(&amp;self) -&gt; u16</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Roots-for-u8" class="impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#385">source</a><a href="#impl-Roots-for-u8" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Roots.html" title="trait num::integer::Roots">Roots</a> for u8</h3></section></summary><div class="impl-items"><section id="method.nth_root-3" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#385">source</a><a href="#method.nth_root-3" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.nth_root" class="fnname">nth_root</a>(&amp;self, n: u32) -&gt; u8</h4></section><section id="method.sqrt-4" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#385">source</a><a href="#method.sqrt-4" class="anchor"></a><h4 class="code-header">fn <a href="#method.sqrt" class="fnname">sqrt</a>(&amp;self) -&gt; u8</h4></section><section id="method.cbrt-4" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#385">source</a><a href="#method.cbrt-4" class="anchor"></a><h4 class="code-header">fn <a href="#method.cbrt" class="fnname">cbrt</a>(&amp;self) -&gt; u8</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Roots-for-u32" class="impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#387">source</a><a href="#impl-Roots-for-u32" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Roots.html" title="trait num::integer::Roots">Roots</a> for u32</h3></section></summary><div class="impl-items"><section id="method.nth_root-4" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#387">source</a><a href="#method.nth_root-4" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.nth_root" class="fnname">nth_root</a>(&amp;self, n: u32) -&gt; u32</h4></section><section id="method.sqrt-5" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#387">source</a><a href="#method.sqrt-5" class="anchor"></a><h4 class="code-header">fn <a href="#method.sqrt" class="fnname">sqrt</a>(&amp;self) -&gt; u32</h4></section><section id="method.cbrt-5" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#387">source</a><a href="#method.cbrt-5" class="anchor"></a><h4 class="code-header">fn <a href="#method.cbrt" class="fnname">cbrt</a>(&amp;self) -&gt; u32</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Roots-for-u128" class="impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#390">source</a><a href="#impl-Roots-for-u128" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Roots.html" title="trait num::integer::Roots">Roots</a> for u128</h3></section></summary><div class="impl-items"><section id="method.nth_root-5" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#390">source</a><a href="#method.nth_root-5" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.nth_root" class="fnname">nth_root</a>(&amp;self, n: u32) -&gt; u128</h4></section><section id="method.sqrt-6" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#390">source</a><a href="#method.sqrt-6" class="anchor"></a><h4 class="code-header">fn <a href="#method.sqrt" class="fnname">sqrt</a>(&amp;self) -&gt; u128</h4></section><section id="method.cbrt-6" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#390">source</a><a href="#method.cbrt-6" class="anchor"></a><h4 class="code-header">fn <a href="#method.cbrt" class="fnname">cbrt</a>(&amp;self) -&gt; u128</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Roots-for-i128" class="impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#170">source</a><a href="#impl-Roots-for-i128" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Roots.html" title="trait num::integer::Roots">Roots</a> for i128</h3></section></summary><div class="impl-items"><section id="method.nth_root-6" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#170">source</a><a href="#method.nth_root-6" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.nth_root" class="fnname">nth_root</a>(&amp;self, n: u32) -&gt; i128</h4></section><section id="method.sqrt-7" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#170">source</a><a href="#method.sqrt-7" class="anchor"></a><h4 class="code-header">fn <a href="#method.sqrt" class="fnname">sqrt</a>(&amp;self) -&gt; i128</h4></section><section id="method.cbrt-7" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#170">source</a><a href="#method.cbrt-7" class="anchor"></a><h4 class="code-header">fn <a href="#method.cbrt" class="fnname">cbrt</a>(&amp;self) -&gt; i128</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Roots-for-i32" class="impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#167">source</a><a href="#impl-Roots-for-i32" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Roots.html" title="trait num::integer::Roots">Roots</a> for i32</h3></section></summary><div class="impl-items"><section id="method.nth_root-7" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#167">source</a><a href="#method.nth_root-7" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.nth_root" class="fnname">nth_root</a>(&amp;self, n: u32) -&gt; i32</h4></section><section id="method.sqrt-8" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#167">source</a><a href="#method.sqrt-8" class="anchor"></a><h4 class="code-header">fn <a href="#method.sqrt" class="fnname">sqrt</a>(&amp;self) -&gt; i32</h4></section><section id="method.cbrt-8" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#167">source</a><a href="#method.cbrt-8" class="anchor"></a><h4 class="code-header">fn <a href="#method.cbrt" class="fnname">cbrt</a>(&amp;self) -&gt; i32</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Roots-for-i8" class="impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#165">source</a><a href="#impl-Roots-for-i8" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Roots.html" title="trait num::integer::Roots">Roots</a> for i8</h3></section></summary><div class="impl-items"><section id="method.nth_root-8" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#165">source</a><a href="#method.nth_root-8" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.nth_root" class="fnname">nth_root</a>(&amp;self, n: u32) -&gt; i8</h4></section><section id="method.sqrt-9" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#165">source</a><a href="#method.sqrt-9" class="anchor"></a><h4 class="code-header">fn <a href="#method.sqrt" class="fnname">sqrt</a>(&amp;self) -&gt; i8</h4></section><section id="method.cbrt-9" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#165">source</a><a href="#method.cbrt-9" class="anchor"></a><h4 class="code-header">fn <a href="#method.cbrt" class="fnname">cbrt</a>(&amp;self) -&gt; i8</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Roots-for-i64" class="impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#168">source</a><a href="#impl-Roots-for-i64" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Roots.html" title="trait num::integer::Roots">Roots</a> for i64</h3></section></summary><div class="impl-items"><section id="method.nth_root-9" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#168">source</a><a href="#method.nth_root-9" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.nth_root" class="fnname">nth_root</a>(&amp;self, n: u32) -&gt; i64</h4></section><section id="method.sqrt-10" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#168">source</a><a href="#method.sqrt-10" class="anchor"></a><h4 class="code-header">fn <a href="#method.sqrt" class="fnname">sqrt</a>(&amp;self) -&gt; i64</h4></section><section id="method.cbrt-10" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#168">source</a><a href="#method.cbrt-10" class="anchor"></a><h4 class="code-header">fn <a href="#method.cbrt" class="fnname">cbrt</a>(&amp;self) -&gt; i64</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Roots-for-isize" class="impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#171">source</a><a href="#impl-Roots-for-isize" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Roots.html" title="trait num::integer::Roots">Roots</a> for isize</h3></section></summary><div class="impl-items"><section id="method.nth_root-10" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#171">source</a><a href="#method.nth_root-10" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.nth_root" class="fnname">nth_root</a>(&amp;self, n: u32) -&gt; isize</h4></section><section id="method.sqrt-11" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#171">source</a><a href="#method.sqrt-11" class="anchor"></a><h4 class="code-header">fn <a href="#method.sqrt" class="fnname">sqrt</a>(&amp;self) -&gt; isize</h4></section><section id="method.cbrt-11" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#171">source</a><a href="#method.cbrt-11" class="anchor"></a><h4 class="code-header">fn <a href="#method.cbrt" class="fnname">cbrt</a>(&amp;self) -&gt; isize</h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Roots-for-u64" class="impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#388">source</a><a href="#impl-Roots-for-u64" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Roots.html" title="trait num::integer::Roots">Roots</a> for u64</h3></section></summary><div class="impl-items"><section id="method.nth_root-11" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#388">source</a><a href="#method.nth_root-11" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.nth_root" class="fnname">nth_root</a>(&amp;self, n: u32) -&gt; u64</h4></section><section id="method.sqrt-12" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#388">source</a><a href="#method.sqrt-12" class="anchor"></a><h4 class="code-header">fn <a href="#method.sqrt" class="fnname">sqrt</a>(&amp;self) -&gt; u64</h4></section><section id="method.cbrt-12" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/num_integer/roots.rs.html#388">source</a><a href="#method.cbrt-12" class="anchor"></a><h4 class="code-header">fn <a href="#method.cbrt" class="fnname">cbrt</a>(&amp;self) -&gt; u64</h4></section></div></details><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div id="implementors-list"><section id="impl-Roots-for-BigInt" class="impl has-srclink"><a class="srclink rightside" href="../../src/num_bigint/bigint.rs.html#508">source</a><a href="#impl-Roots-for-BigInt" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Roots.html" title="trait num::integer::Roots">Roots</a> for <a class="struct" href="../struct.BigInt.html" title="struct num::BigInt">BigInt</a></h3></section><section id="impl-Roots-for-BigUint" class="impl has-srclink"><a class="srclink rightside" href="../../src/num_bigint/biguint.rs.html#346">source</a><a href="#impl-Roots-for-BigUint" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.Roots.html" title="trait num::integer::Roots">Roots</a> for <a class="struct" href="../struct.BigUint.html" title="struct num::BigUint">BigUint</a></h3></section></div><script src="../../implementors/num_integer/roots/trait.Roots.js" data-ignore-extern-crates="num_bigint,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>