trait.Signed.html 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta name="generator" content="rustdoc">
  7. <meta name="description" content="API documentation for the Rust `Signed` trait in crate `num_traits`.">
  8. <meta name="keywords" content="rust, rustlang, rust-lang, Signed">
  9. <title>num_traits::Signed - Rust</title>
  10. <link rel="stylesheet" type="text/css" href="../normalize.css">
  11. <link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle">
  12. <link rel="stylesheet" type="text/css" href="../dark.css">
  13. <link rel="stylesheet" type="text/css" href="../main.css" id="themeStyle">
  14. <script src="../storage.js"></script>
  15. </head>
  16. <body class="rustdoc trait">
  17. <!--[if lte IE 8]>
  18. <div class="warning">
  19. This old browser is unsupported and will most likely display funky
  20. things.
  21. </div>
  22. <![endif]-->
  23. <nav class="sidebar">
  24. <div class="sidebar-menu">&#9776;</div>
  25. <p class='location'>Trait Signed</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.abs">abs</a><a href="#tymethod.abs_sub">abs_sub</a><a href="#tymethod.signum">signum</a><a href="#tymethod.is_positive">is_positive</a><a href="#tymethod.is_negative">is_negative</a></div><a class="sidebar-title" href="#foreign-impls">Implementations on Foreign Types</a><div class="sidebar-links"><a href="#impl-Signed">i64</a><a href="#impl-Signed">isize</a><a href="#impl-Signed">i32</a><a href="#impl-Signed">i8</a><a href="#impl-Signed">f32</a><a href="#impl-Signed">i16</a><a href="#impl-Signed">Wrapping&lt;T&gt;</a><a href="#impl-Signed">f64</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class='location'><a href='index.html'>num_traits</a></p><script>window.sidebarCurrent = {name: 'Signed', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></script></div>
  26. </nav>
  27. <div class="theme-picker">
  28. <button id="theme-picker" aria-label="Pick another theme!">
  29. <img src="../brush.svg" width="18" alt="Pick another theme!">
  30. </button>
  31. <div id="theme-choices"></div>
  32. </div>
  33. <script src="../theme.js"></script>
  34. <nav class="sub">
  35. <form class="search-form js-only">
  36. <div class="search-container">
  37. <input class="search-input" name="search"
  38. autocomplete="off"
  39. placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
  40. type="search">
  41. </div>
  42. </form>
  43. </nav>
  44. <section id='main' class="content">
  45. <h1 class='fqn'><span class='in-band'>Trait <a href='index.html'>num_traits</a>::<wbr><a class="trait" href=''>Signed</a></span><span class='out-of-band'><span id='render-detail'>
  46. <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
  47. [<span class='inner'>&#x2212;</span>]
  48. </a>
  49. </span><a class='srclink' href='../src/num_traits/sign.rs.html#8-42' title='goto source code'>[src]</a></span></h1>
  50. <pre class='rust trait'>pub trait Signed: <a class="trait" href="../num_traits/trait.Num.html" title="trait num_traits::Num">Num</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/arith/trait.Neg.html" title="trait core::ops::arith::Neg">Neg</a>&lt;Output = Self&gt; {
  51. fn <a href='#tymethod.abs' class='fnname'>abs</a>(&amp;self) -&gt; Self;
  52. <div class='item-spacer'></div> fn <a href='#tymethod.abs_sub' class='fnname'>abs_sub</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Self) -&gt; Self;
  53. <div class='item-spacer'></div> fn <a href='#tymethod.signum' class='fnname'>signum</a>(&amp;self) -&gt; Self;
  54. <div class='item-spacer'></div> fn <a href='#tymethod.is_positive' class='fnname'>is_positive</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>;
  55. <div class='item-spacer'></div> fn <a href='#tymethod.is_negative' class='fnname'>is_negative</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>;
  56. }</pre><div class='docblock'><p>Useful functions for signed numbers (i.e. numbers that can be negative).</p>
  57. </div>
  58. <h2 id='required-methods' class='small-section-header'>
  59. Required Methods<a href='#required-methods' class='anchor'></a>
  60. </h2>
  61. <div class='methods'>
  62. <h3 id='tymethod.abs' class='method'><span id='abs.v' class='invisible'><code>fn <a href='#tymethod.abs' class='fnname'>abs</a>(&amp;self) -&gt; Self</code></span></h3><div class='docblock'><p>Computes the absolute value.</p>
  63. <p>For <code>f32</code> and <code>f64</code>, <code>NaN</code> will be returned if the number is <code>NaN</code>.</p>
  64. <p>For signed integers, <code>::MIN</code> will be returned if the number is <code>::MIN</code>.</p>
  65. </div><h3 id='tymethod.abs_sub' class='method'><span id='abs_sub.v' class='invisible'><code>fn <a href='#tymethod.abs_sub' class='fnname'>abs_sub</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Self) -&gt; Self</code></span></h3><div class='docblock'><p>The positive difference of two numbers.</p>
  66. <p>Returns <code>zero</code> if the number is less than or equal to <code>other</code>, otherwise the difference
  67. between <code>self</code> and <code>other</code> is returned.</p>
  68. </div><h3 id='tymethod.signum' class='method'><span id='signum.v' class='invisible'><code>fn <a href='#tymethod.signum' class='fnname'>signum</a>(&amp;self) -&gt; Self</code></span></h3><div class='docblock'><p>Returns the sign of the number.</p>
  69. <p>For <code>f32</code> and <code>f64</code>:</p>
  70. <ul>
  71. <li><code>1.0</code> if the number is positive, <code>+0.0</code> or <code>INFINITY</code></li>
  72. <li><code>-1.0</code> if the number is negative, <code>-0.0</code> or <code>NEG_INFINITY</code></li>
  73. <li><code>NaN</code> if the number is <code>NaN</code></li>
  74. </ul>
  75. <p>For signed integers:</p>
  76. <ul>
  77. <li><code>0</code> if the number is zero</li>
  78. <li><code>1</code> if the number is positive</li>
  79. <li><code>-1</code> if the number is negative</li>
  80. </ul>
  81. </div><h3 id='tymethod.is_positive' class='method'><span id='is_positive.v' class='invisible'><code>fn <a href='#tymethod.is_positive' class='fnname'>is_positive</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span></h3><div class='docblock'><p>Returns true if the number is positive and false if the number is zero or negative.</p>
  82. </div><h3 id='tymethod.is_negative' class='method'><span id='is_negative.v' class='invisible'><code>fn <a href='#tymethod.is_negative' class='fnname'>is_negative</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span></h3><div class='docblock'><p>Returns true if the number is negative and false if the number is zero or positive.</p>
  83. </div></div>
  84. <h2 id='foreign-impls' class='small-section-header'>
  85. Implementations on Foreign Types<a href='#foreign-impls' class='anchor'></a>
  86. </h2>
  87. <h3 id='impl-Signed' class='impl'><span class='in-band'><code>impl <a class="trait" href="../num_traits/sign/trait.Signed.html" title="trait num_traits::sign::Signed">Signed</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code><a href='#impl-Signed' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#46-71' title='goto source code'>[src]</a></span></h3>
  88. <span class='docblock autohide'><div class='impl-items'><h4 id='method.abs' class="method"><span id='abs.v-1' class='invisible'><code>fn <a href='#method.abs' class='fnname'>abs</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#48-50' title='goto source code'>[src]</a></span></h4>
  89. <h4 id='method.abs_sub' class="method"><span id='abs_sub.v-1' class='invisible'><code>fn <a href='#method.abs_sub' class='fnname'>abs_sub</a>(&amp;self, other: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#53-55' title='goto source code'>[src]</a></span></h4>
  90. <h4 id='method.signum' class="method"><span id='signum.v-1' class='invisible'><code>fn <a href='#method.signum' class='fnname'>signum</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#58-64' title='goto source code'>[src]</a></span></h4>
  91. <h4 id='method.is_positive' class="method"><span id='is_positive.v-1' class='invisible'><code>fn <a href='#method.is_positive' class='fnname'>is_positive</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#67' title='goto source code'>[src]</a></span></h4>
  92. <h4 id='method.is_negative' class="method"><span id='is_negative.v-1' class='invisible'><code>fn <a href='#method.is_negative' class='fnname'>is_negative</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#70' title='goto source code'>[src]</a></span></h4>
  93. </div></span><h3 id='impl-Signed-1' class='impl'><span class='in-band'><code>impl <a class="trait" href="../num_traits/sign/trait.Signed.html" title="trait num_traits::sign::Signed">Signed</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a></code><a href='#impl-Signed-1' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#46-71' title='goto source code'>[src]</a></span></h3>
  94. <span class='docblock autohide'><div class='impl-items'><h4 id='method.abs-1' class="method"><span id='abs.v-2' class='invisible'><code>fn <a href='#method.abs' class='fnname'>abs</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#48-50' title='goto source code'>[src]</a></span></h4>
  95. <h4 id='method.abs_sub-1' class="method"><span id='abs_sub.v-2' class='invisible'><code>fn <a href='#method.abs_sub' class='fnname'>abs_sub</a>(&amp;self, other: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#53-55' title='goto source code'>[src]</a></span></h4>
  96. <h4 id='method.signum-1' class="method"><span id='signum.v-2' class='invisible'><code>fn <a href='#method.signum' class='fnname'>signum</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#58-64' title='goto source code'>[src]</a></span></h4>
  97. <h4 id='method.is_positive-1' class="method"><span id='is_positive.v-2' class='invisible'><code>fn <a href='#method.is_positive' class='fnname'>is_positive</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#67' title='goto source code'>[src]</a></span></h4>
  98. <h4 id='method.is_negative-1' class="method"><span id='is_negative.v-2' class='invisible'><code>fn <a href='#method.is_negative' class='fnname'>is_negative</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#70' title='goto source code'>[src]</a></span></h4>
  99. </div></span><h3 id='impl-Signed-2' class='impl'><span class='in-band'><code>impl <a class="trait" href="../num_traits/sign/trait.Signed.html" title="trait num_traits::sign::Signed">Signed</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a></code><a href='#impl-Signed-2' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#46-71' title='goto source code'>[src]</a></span></h3>
  100. <span class='docblock autohide'><div class='impl-items'><h4 id='method.abs-2' class="method"><span id='abs.v-3' class='invisible'><code>fn <a href='#method.abs' class='fnname'>abs</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#48-50' title='goto source code'>[src]</a></span></h4>
  101. <h4 id='method.abs_sub-2' class="method"><span id='abs_sub.v-3' class='invisible'><code>fn <a href='#method.abs_sub' class='fnname'>abs_sub</a>(&amp;self, other: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#53-55' title='goto source code'>[src]</a></span></h4>
  102. <h4 id='method.signum-2' class="method"><span id='signum.v-3' class='invisible'><code>fn <a href='#method.signum' class='fnname'>signum</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#58-64' title='goto source code'>[src]</a></span></h4>
  103. <h4 id='method.is_positive-2' class="method"><span id='is_positive.v-3' class='invisible'><code>fn <a href='#method.is_positive' class='fnname'>is_positive</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#67' title='goto source code'>[src]</a></span></h4>
  104. <h4 id='method.is_negative-2' class="method"><span id='is_negative.v-3' class='invisible'><code>fn <a href='#method.is_negative' class='fnname'>is_negative</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#70' title='goto source code'>[src]</a></span></h4>
  105. </div></span><h3 id='impl-Signed-3' class='impl'><span class='in-band'><code>impl <a class="trait" href="../num_traits/sign/trait.Signed.html" title="trait num_traits::sign::Signed">Signed</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a></code><a href='#impl-Signed-3' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#46-71' title='goto source code'>[src]</a></span></h3>
  106. <span class='docblock autohide'><div class='impl-items'><h4 id='method.abs-3' class="method"><span id='abs.v-4' class='invisible'><code>fn <a href='#method.abs' class='fnname'>abs</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#48-50' title='goto source code'>[src]</a></span></h4>
  107. <h4 id='method.abs_sub-3' class="method"><span id='abs_sub.v-4' class='invisible'><code>fn <a href='#method.abs_sub' class='fnname'>abs_sub</a>(&amp;self, other: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#53-55' title='goto source code'>[src]</a></span></h4>
  108. <h4 id='method.signum-3' class="method"><span id='signum.v-4' class='invisible'><code>fn <a href='#method.signum' class='fnname'>signum</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i8.html">i8</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#58-64' title='goto source code'>[src]</a></span></h4>
  109. <h4 id='method.is_positive-3' class="method"><span id='is_positive.v-4' class='invisible'><code>fn <a href='#method.is_positive' class='fnname'>is_positive</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#67' title='goto source code'>[src]</a></span></h4>
  110. <h4 id='method.is_negative-3' class="method"><span id='is_negative.v-4' class='invisible'><code>fn <a href='#method.is_negative' class='fnname'>is_negative</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#70' title='goto source code'>[src]</a></span></h4>
  111. </div></span><h3 id='impl-Signed-4' class='impl'><span class='in-band'><code>impl <a class="trait" href="../num_traits/sign/trait.Signed.html" title="trait num_traits::sign::Signed">Signed</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a></code><a href='#impl-Signed-4' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#103-135' title='goto source code'>[src]</a></span></h3>
  112. <span class='docblock autohide'><div class='impl-items'><h4 id='method.abs-4' class="method"><span id='abs.v-5' class='invisible'><code>fn <a href='#method.abs' class='fnname'>abs</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#106-108' title='goto source code'>[src]</a></span></h4>
  113. <div class='docblock'><p>Computes the absolute value. Returns <code>NAN</code> if the number is <code>NAN</code>.</p>
  114. </div><h4 id='method.abs_sub-4' class="method"><span id='abs_sub.v-5' class='invisible'><code>fn <a href='#method.abs_sub' class='fnname'>abs_sub</a>(&amp;self, other: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#114-116' title='goto source code'>[src]</a></span></h4>
  115. <div class='docblock'><p>The positive difference of two numbers. Returns <code>0.0</code> if the number is
  116. less than or equal to <code>other</code>, otherwise the difference between<code>self</code>
  117. and <code>other</code> is returned.</p>
  118. </div><h4 id='method.signum-4' class="method"><span id='signum.v-5' class='invisible'><code>fn <a href='#method.signum' class='fnname'>signum</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#124-126' title='goto source code'>[src]</a></span></h4>
  119. <div class='docblock'><h1 id="returns" class="section-header"><a href="#returns">Returns</a></h1>
  120. <ul>
  121. <li><code>1.0</code> if the number is positive, <code>+0.0</code> or <code>INFINITY</code></li>
  122. <li><code>-1.0</code> if the number is negative, <code>-0.0</code> or <code>NEG_INFINITY</code></li>
  123. <li><code>NAN</code> if the number is NaN</li>
  124. </ul>
  125. </div><h4 id='method.is_positive-4' class="method"><span id='is_positive.v-5' class='invisible'><code>fn <a href='#method.is_positive' class='fnname'>is_positive</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#130' title='goto source code'>[src]</a></span></h4>
  126. <div class='docblock'><p>Returns <code>true</code> if the number is positive, including <code>+0.0</code> and <code>INFINITY</code></p>
  127. </div><h4 id='method.is_negative-4' class="method"><span id='is_negative.v-5' class='invisible'><code>fn <a href='#method.is_negative' class='fnname'>is_negative</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#134' title='goto source code'>[src]</a></span></h4>
  128. <div class='docblock'><p>Returns <code>true</code> if the number is negative, including <code>-0.0</code> and <code>NEG_INFINITY</code></p>
  129. </div></div></span><h3 id='impl-Signed-5' class='impl'><span class='in-band'><code>impl <a class="trait" href="../num_traits/sign/trait.Signed.html" title="trait num_traits::sign::Signed">Signed</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a></code><a href='#impl-Signed-5' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#46-71' title='goto source code'>[src]</a></span></h3>
  130. <span class='docblock autohide'><div class='impl-items'><h4 id='method.abs-5' class="method"><span id='abs.v-6' class='invisible'><code>fn <a href='#method.abs' class='fnname'>abs</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#48-50' title='goto source code'>[src]</a></span></h4>
  131. <h4 id='method.abs_sub-5' class="method"><span id='abs_sub.v-6' class='invisible'><code>fn <a href='#method.abs_sub' class='fnname'>abs_sub</a>(&amp;self, other: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#53-55' title='goto source code'>[src]</a></span></h4>
  132. <h4 id='method.signum-5' class="method"><span id='signum.v-6' class='invisible'><code>fn <a href='#method.signum' class='fnname'>signum</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i16.html">i16</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#58-64' title='goto source code'>[src]</a></span></h4>
  133. <h4 id='method.is_positive-5' class="method"><span id='is_positive.v-6' class='invisible'><code>fn <a href='#method.is_positive' class='fnname'>is_positive</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#67' title='goto source code'>[src]</a></span></h4>
  134. <h4 id='method.is_negative-5' class="method"><span id='is_negative.v-6' class='invisible'><code>fn <a href='#method.is_negative' class='fnname'>is_negative</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#70' title='goto source code'>[src]</a></span></h4>
  135. </div></span><h3 id='impl-Signed-6' class='impl'><span class='in-band'><code>impl&lt;T&gt; <a class="trait" href="../num_traits/sign/trait.Signed.html" title="trait num_traits::sign::Signed">Signed</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/core/num/struct.Wrapping.html" title="struct core::num::Wrapping">Wrapping</a>&lt;T&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="../num_traits/sign/trait.Signed.html" title="trait num_traits::sign::Signed">Signed</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<a class="struct" href="https://doc.rust-lang.org/nightly/core/num/struct.Wrapping.html" title="struct core::num::Wrapping">Wrapping</a>&lt;T&gt;: <a class="trait" href="../num_traits/trait.Num.html" title="trait num_traits::Num">Num</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<a class="struct" href="https://doc.rust-lang.org/nightly/core/num/struct.Wrapping.html" title="struct core::num::Wrapping">Wrapping</a>&lt;T&gt;: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/arith/trait.Neg.html" title="trait core::ops::arith::Neg">Neg</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/core/num/struct.Wrapping.html" title="struct core::num::Wrapping">Wrapping</a>&lt;T&gt; as <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/arith/trait.Neg.html" title="trait core::ops::arith::Neg">Neg</a>&gt;::<a class="type" href="https://doc.rust-lang.org/nightly/core/ops/arith/trait.Neg.html#associatedtype.Output" title="type core::ops::arith::Neg::Output">Output</a> == <a class="struct" href="https://doc.rust-lang.org/nightly/core/num/struct.Wrapping.html" title="struct core::num::Wrapping">Wrapping</a>&lt;T&gt;,&nbsp;</span></code><a href='#impl-Signed-6' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#77-99' title='goto source code'>[src]</a></span></h3>
  136. <span class='docblock autohide'><div class='impl-items'><h4 id='method.abs-6' class="method"><span id='abs.v-7' class='invisible'><code>fn <a href='#method.abs' class='fnname'>abs</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/num/struct.Wrapping.html" title="struct core::num::Wrapping">Wrapping</a>&lt;T&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#80-82' title='goto source code'>[src]</a></span></h4>
  137. <h4 id='method.abs_sub-6' class="method"><span id='abs_sub.v-7' class='invisible'><code>fn <a href='#method.abs_sub' class='fnname'>abs_sub</a>(&amp;self, other: &amp;<a class="struct" href="https://doc.rust-lang.org/nightly/core/num/struct.Wrapping.html" title="struct core::num::Wrapping">Wrapping</a>&lt;T&gt;) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/num/struct.Wrapping.html" title="struct core::num::Wrapping">Wrapping</a>&lt;T&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#85-87' title='goto source code'>[src]</a></span></h4>
  138. <h4 id='method.signum-6' class="method"><span id='signum.v-7' class='invisible'><code>fn <a href='#method.signum' class='fnname'>signum</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/num/struct.Wrapping.html" title="struct core::num::Wrapping">Wrapping</a>&lt;T&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#90-92' title='goto source code'>[src]</a></span></h4>
  139. <h4 id='method.is_positive-6' class="method"><span id='is_positive.v-7' class='invisible'><code>fn <a href='#method.is_positive' class='fnname'>is_positive</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#95' title='goto source code'>[src]</a></span></h4>
  140. <h4 id='method.is_negative-6' class="method"><span id='is_negative.v-7' class='invisible'><code>fn <a href='#method.is_negative' class='fnname'>is_negative</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#98' title='goto source code'>[src]</a></span></h4>
  141. </div></span><h3 id='impl-Signed-7' class='impl'><span class='in-band'><code>impl <a class="trait" href="../num_traits/sign/trait.Signed.html" title="trait num_traits::sign::Signed">Signed</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a></code><a href='#impl-Signed-7' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#103-135' title='goto source code'>[src]</a></span></h3>
  142. <span class='docblock autohide'><div class='impl-items'><h4 id='method.abs-7' class="method"><span id='abs.v-8' class='invisible'><code>fn <a href='#method.abs' class='fnname'>abs</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#106-108' title='goto source code'>[src]</a></span></h4>
  143. <div class='docblock'><p>Computes the absolute value. Returns <code>NAN</code> if the number is <code>NAN</code>.</p>
  144. </div><h4 id='method.abs_sub-7' class="method"><span id='abs_sub.v-8' class='invisible'><code>fn <a href='#method.abs_sub' class='fnname'>abs_sub</a>(&amp;self, other: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#114-116' title='goto source code'>[src]</a></span></h4>
  145. <div class='docblock'><p>The positive difference of two numbers. Returns <code>0.0</code> if the number is
  146. less than or equal to <code>other</code>, otherwise the difference between<code>self</code>
  147. and <code>other</code> is returned.</p>
  148. </div><h4 id='method.signum-7' class="method"><span id='signum.v-8' class='invisible'><code>fn <a href='#method.signum' class='fnname'>signum</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#124-126' title='goto source code'>[src]</a></span></h4>
  149. <div class='docblock'><h1 id="returns-1" class="section-header"><a href="#returns-1">Returns</a></h1>
  150. <ul>
  151. <li><code>1.0</code> if the number is positive, <code>+0.0</code> or <code>INFINITY</code></li>
  152. <li><code>-1.0</code> if the number is negative, <code>-0.0</code> or <code>NEG_INFINITY</code></li>
  153. <li><code>NAN</code> if the number is NaN</li>
  154. </ul>
  155. </div><h4 id='method.is_positive-7' class="method"><span id='is_positive.v-8' class='invisible'><code>fn <a href='#method.is_positive' class='fnname'>is_positive</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#130' title='goto source code'>[src]</a></span></h4>
  156. <div class='docblock'><p>Returns <code>true</code> if the number is positive, including <code>+0.0</code> and <code>INFINITY</code></p>
  157. </div><h4 id='method.is_negative-7' class="method"><span id='is_negative.v-8' class='invisible'><code>fn <a href='#method.is_negative' class='fnname'>is_negative</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/num_traits/sign.rs.html#134' title='goto source code'>[src]</a></span></h4>
  158. <div class='docblock'><p>Returns <code>true</code> if the number is negative, including <code>-0.0</code> and <code>NEG_INFINITY</code></p>
  159. </div></div></span>
  160. <h2 id='implementors' class='small-section-header'>
  161. Implementors<a href='#implementors' class='anchor'></a>
  162. </h2>
  163. <ul class='item-list' id='implementors-list'>
  164. </ul><script type="text/javascript" async
  165. src="../implementors/num_traits/sign/trait.Signed.js">
  166. </script></section>
  167. <section id='search' class="content hidden"></section>
  168. <section class="footer"></section>
  169. <aside id="help" class="hidden">
  170. <div>
  171. <h1 class="hidden">Help</h1>
  172. <div class="shortcuts">
  173. <h2>Keyboard Shortcuts</h2>
  174. <dl>
  175. <dt><kbd>?</kbd></dt>
  176. <dd>Show this help dialog</dd>
  177. <dt><kbd>S</kbd></dt>
  178. <dd>Focus the search field</dd>
  179. <dt><kbd>↑</kbd></dt>
  180. <dd>Move up in search results</dd>
  181. <dt><kbd>↓</kbd></dt>
  182. <dd>Move down in search results</dd>
  183. <dt><kbd>↹</kbd></dt>
  184. <dd>Switch tab</dd>
  185. <dt><kbd>&#9166;</kbd></dt>
  186. <dd>Go to active search result</dd>
  187. <dt><kbd>+</kbd></dt>
  188. <dd>Expand all sections</dd>
  189. <dt><kbd>-</kbd></dt>
  190. <dd>Collapse all sections</dd>
  191. </dl>
  192. </div>
  193. <div class="infos">
  194. <h2>Search Tricks</h2>
  195. <p>
  196. Prefix searches with a type followed by a colon (e.g.
  197. <code>fn:</code>) to restrict the search to a given type.
  198. </p>
  199. <p>
  200. Accepted types are: <code>fn</code>, <code>mod</code>,
  201. <code>struct</code>, <code>enum</code>,
  202. <code>trait</code>, <code>type</code>, <code>macro</code>,
  203. and <code>const</code>.
  204. </p>
  205. <p>
  206. Search functions by type signature (e.g.
  207. <code>vec -> usize</code> or <code>* -> vec</code>)
  208. </p>
  209. </div>
  210. </div>
  211. </aside>
  212. <script>
  213. window.rootPath = "../";
  214. window.currentCrate = "num_traits";
  215. </script>
  216. <script src="../main.js"></script>
  217. <script defer src="../search-index.js"></script>
  218. </body>
  219. </html>