<p dir="auto">This would constitute an addition of two new formatting flags, <code class="notranslate">{:e}</code> and <code class="notranslate">{:E}</code> and corresponding traits (e.g <code class="notranslate">LowerSci</code> and <code class="notranslate">UpperSci</code>). Here's the output I envision based on how Rust handles floating point and signs today. Notably, this differs from how C does it (Rust already differs from C, see <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2641779" data-permission-text="Title is private" data-url="https://github.com/rust-lang/rust/issues/1375" data-hovercard-type="issue" data-hovercard-url="/rust-lang/rust/issues/1375/hovercard" href="https://github.com/rust-lang/rust/issues/1375">#1375</a>):</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="format!(&quot;{:e}&quot;, 1.0) == &quot;1e0&quot;;
format!(&quot;{:e}&quot;, 10.0) == &quot;1e1&quot;;
format!(&quot;{:+e}&quot;, 10.0) == &quot;+1e+1&quot;;
format!(&quot;{:e}&quot;, 1.1234567) == &quot;1.123457e0&quot;;
format!(&quot;{:e}&quot;, 1.3e-1) == &quot;1.3e-1&quot;;
format!(&quot;{:.2e}&quot;, 1.3e-1) == &quot;1.30e-1&quot;;
format!(&quot;{:E}&quot;, 1.3e-1) == &quot;1.3E-1&quot;;"><pre class="notranslate"><span class="pl-en">format</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"{:e}"</span>, <span class="pl-c1">1.0</span><span class="pl-kos">)</span> == <span class="pl-s">"1e0"</span><span class="pl-kos">;</span>
<span class="pl-en">format</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"{:e}"</span>, <span class="pl-c1">10.0</span><span class="pl-kos">)</span> == <span class="pl-s">"1e1"</span><span class="pl-kos">;</span>
<span class="pl-en">format</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"{:+e}"</span>, <span class="pl-c1">10.0</span><span class="pl-kos">)</span> == <span class="pl-s">"+1e+1"</span><span class="pl-kos">;</span>
<span class="pl-en">format</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"{:e}"</span>, <span class="pl-c1">1.1234567</span><span class="pl-kos">)</span> == <span class="pl-s">"1.123457e0"</span><span class="pl-kos">;</span>
<span class="pl-en">format</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"{:e}"</span>, <span class="pl-c1">1.3e-1</span><span class="pl-kos">)</span> == <span class="pl-s">"1.3e-1"</span><span class="pl-kos">;</span>
<span class="pl-en">format</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"{:.2e}"</span>, <span class="pl-c1">1.3e-1</span><span class="pl-kos">)</span> == <span class="pl-s">"1.30e-1"</span><span class="pl-kos">;</span>
<span class="pl-en">format</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"{:E}"</span>, <span class="pl-c1">1.3e-1</span><span class="pl-kos">)</span> == <span class="pl-s">"1.3E-1"</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">%e should work like in printf in C, it should format a floating-point number using scientific notation.</p>