<p dir="auto">In at least one case (and presumably more), <code class="notranslate">FromStr::from_str()</code> produces a result that is off by one ulp.</p>
<p dir="auto">Example:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="pub fn main() {
    use std::str::FromStr;    
    let literal: f64 = 0.123f64;
    let fromstr: f64 = FromStr::from_str(&quot;0.123&quot;).unwrap();
    println!(&quot;Literal: {:16X}&quot;, as_int(literal)); // Literal: 3FBF7CED916872B0
    println!(&quot;FromStr: {:16X}&quot;, as_int(fromstr)); // FromStr: 3FBF7CED916872B1
    println!(&quot;Equal: {}&quot;, literal == fromstr);    // Equal: false
}

pub fn as_int(f: f64) -&gt; u64 {
    unsafe{ std::mem::transmute::&lt;f64,u64&gt;(f) }
}"><pre class="notranslate"><code class="notranslate">pub fn main() {
    use std::str::FromStr;    
    let literal: f64 = 0.123f64;
    let fromstr: f64 = FromStr::from_str("0.123").unwrap();
    println!("Literal: {:16X}", as_int(literal)); // Literal: 3FBF7CED916872B0
    println!("FromStr: {:16X}", as_int(fromstr)); // FromStr: 3FBF7CED916872B1
    println!("Equal: {}", literal == fromstr);    // Equal: false
}

pub fn as_int(f: f64) -&gt; u64 {
    unsafe{ std::mem::transmute::&lt;f64,u64&gt;(f) }
}
</code></pre></div>
<p dir="auto">Here the compiler produces the correct result for the literal value but the runtime parsing function produces a different, incorrect result.  The difference is tiny, but of course it is enough to cause problems :)</p>
<p dir="auto">For the record, here is the output of <code class="notranslate">rustc --version --verbose</code> on my system:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="rustc 1.0.0-nightly (30e1f9a1c 2015-03-14) (built 2015-03-15)
binary: rustc
commit-hash: 30e1f9a1c2bf7134135800bc9afd082773defadc
commit-date: 2015-03-14
build-date: 2015-03-15
host: x86_64-unknown-linux-gnu
release: 1.0.0-nightly"><pre class="notranslate"><code class="notranslate">rustc 1.0.0-nightly (30e1f9a1c 2015-03-14) (built 2015-03-15)
binary: rustc
commit-hash: 30e1f9a1c2bf7134135800bc9afd082773defadc
commit-date: 2015-03-14
build-date: 2015-03-15
host: x86_64-unknown-linux-gnu
release: 1.0.0-nightly
</code></pre></div>
<p dir="auto">Some inputs to <code class="notranslate">std::float::from_str</code> give a value that prints as an integer, but does not compare equal to it:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="rusti&gt; std::float::from_str(&quot;0.67e3&quot;).get()
670
rusti&gt; std::float::from_str(&quot;0.67e3&quot;).get() == 670f
false
rusti&gt; std::float::to_str_hex(670f)
~&quot;29e&quot;
rusti&gt; std::float::to_str_hex(std::float::from_str(&quot;0.67e3&quot;).get())
~&quot;29e.00000000002&quot;"><pre class="notranslate"><code class="notranslate">rusti&gt; std::float::from_str("0.67e3").get()
670
rusti&gt; std::float::from_str("0.67e3").get() == 670f
false
rusti&gt; std::float::to_str_hex(670f)
~"29e"
rusti&gt; std::float::to_str_hex(std::float::from_str("0.67e3").get())
~"29e.00000000002"
</code></pre></div>
<p dir="auto">For comparison, Python does not have this issue:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; float('.67e3') == 670
True"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; float('.67e3') == 670
True
</code></pre></div>