Skip to content

Commit ffa06e1

Browse files
committed
Format
1 parent 1f577da commit ffa06e1

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ Format
471471
| 56.789 | '5.7e+01' | '56.79' | '5.68e+01' | '5678.90%' |
472472
+--------------+----------------+----------------+----------------+----------------+
473473
```
474+
* **`'{<float>:g}'` is `'{<float>:.6}'` with stripped zeros, exponent starting at 7 figures.**
474475
* **When both rounding up and rounding down are possible, the one that returns result with even last digit is chosen. That makes `'{6.5:.0f}'` a `'6'` and `'{7.5:.0f}'` an `'8'`.**
475476
* **This rule only effects numbers that can be represented exactly by a float (`.5`, `.25`, …).**
476477

index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
<body>
5656
<header>
57-
<aside>July 4, 2023</aside>
57+
<aside>July 5, 2023</aside>
5858
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
5959
</header>
6060

@@ -435,6 +435,7 @@
435435

436436

437437
<ul>
438+
<li><strong><code class="python hljs"><span class="hljs-string">'{&lt;float&gt;:g}'</span></code> is <code class="python hljs"><span class="hljs-string">'{&lt;float&gt;:.6}'</span></code> with stripped zeros, exponent starting at 7 figures.</strong></li>
438439
<li><strong>When both rounding up and rounding down are possible, the one that returns result with even last digit is chosen. That makes <code class="python hljs"><span class="hljs-string">'{6.5:.0f}'</span></code> a <code class="python hljs"><span class="hljs-string">'6'</span></code> and <code class="python hljs"><span class="hljs-string">'{7.5:.0f}'</span></code> an <code class="python hljs"><span class="hljs-string">'8'</span></code>.</strong></li>
439440
<li><strong>This rule only effects numbers that can be represented exactly by a float (<code class="python hljs"><span class="hljs-number">.5</span></code>, <code class="python hljs"><span class="hljs-number">.25</span></code>, …).</strong></li>
440441
</ul>
@@ -2932,7 +2933,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
29322933

29332934

29342935
<footer>
2935-
<aside>July 4, 2023</aside>
2936+
<aside>July 5, 2023</aside>
29362937
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
29372938
</footer>
29382939

0 commit comments

Comments
 (0)