Skip to content

Commit c0d2cd7

Browse files
author
cpprefjp-autoupdate
committed
update automatically
1 parent bac8ec0 commit c0d2cd7

6 files changed

Lines changed: 242 additions & 575 deletions

File tree

lang/cpp29/feature_test_macros.html

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@
189189
<p class="text-right"><small>
190190
最終更新日時:
191191
<time itemprop="datePublished" class="js-local-time"
192-
datetime="2026-08-12T13:56:43+09:00">
193-
2026年08月12日 13時56分43秒 (JST)
192+
datetime="2026-09-02T11:57:54+09:00">
193+
2026年09月02日 11時57分54秒 (JST)
194194
</time>
195195
<br/>
196196
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
@@ -274,6 +274,12 @@ <h3>ライブラリ</h3>
274274
<td><code><a href="../../reference/simd.html">&lt;simd&gt;</a></code>に、ビット列を操作する<code><a href="../../reference/simd/bit_reverse.html">bit_reverse()</a></code><code><a href="../../reference/simd/bit_repeat.html">bit_repeat()</a></code><code><a href="../../reference/simd/bit_compress.html">bit_compress()</a></code><code><a href="../../reference/simd/bit_expand.html">bit_expand()</a></code>関数と、<a class="cpprefjp-defined-word" data-desc="未定義の動作。処理系は予期せぬ動作をする可能性がある。要するに動作保証対象外。undefined behavior (UB)。" href="../../implementation-compliance.html#dfn-undefined-behavior">未定義動作</a>にならないシフト<code><a href="../../reference/simd/shl.html">shl()</a></code><code><a href="../../reference/simd/shr.html">shr()</a></code>関数を追加</td>
275275
<td><code><a href="../../reference/simd.html">&lt;simd&gt;</a></code></td>
276276
</tr>
277+
<tr>
278+
<td><code>__cpp_lib_to_chars</code></td>
279+
<td><code>202606L</code></td>
280+
<td><code><a href="../../reference/charconv/to_chars.html">std::to_chars()</a></code>の浮動小数点数に対する既定表現を、値の範囲によって固定小数表記と指数表記を選択するよう変更</td>
281+
<td><code><a href="../../reference/charconv.html">&lt;charconv&gt;</a></code></td>
282+
</tr>
277283
</tbody>
278284
</table>
279285
<h2>参照</h2>
@@ -295,6 +301,10 @@ <h2>参照</h2>
295301
<li>C++29で<code>__cpp_lib_simd_bitops</code>が追加された</li>
296302
</ul>
297303
</li>
304+
<li><a href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2026/p3505r4.html" target="_blank">P3505R4 Fix the default floating-point representation in <code>std::format</code></a><ul>
305+
<li>C++29で<code>__cpp_lib_to_chars</code><code>202606L</code>に更新された</li>
306+
</ul>
307+
</li>
298308
</ul></div>
299309

300310
</div>

reference/charconv/to_chars.html

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,12 @@
189189
<p class="text-right"><small>
190190
最終更新日時:
191191
<time itemprop="datePublished" class="js-local-time"
192-
datetime="2026-08-08T22:18:00+09:00">
193-
2026年08月08日 22時18分00秒 (JST)
192+
datetime="2026-09-02T11:57:54+09:00">
193+
2026年09月02日 11時57分54秒 (JST)
194194
</time>
195195
<br/>
196196
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
197-
<span itemprop="name">rotarymars</span>
197+
<span itemprop="name">Akira Takahashi</span>
198198
</span>
199199
が更新
200200
</small></p>
@@ -372,7 +372,11 @@ <h2>効果</h2>
372372
</li>
373373
<li>
374374
<p>(2), (3), (4), (5) : Cロケールで<code>printf</code>によって行われたかのように浮動小数点数を文字列へ変換する。<br />
375-
フォーマット指定子は<code>%f,%e</code>どちらかを出力文字列が最も短くなるように(両者が同じなら<code>%f</code>が優先)選択する。</p>
375+
フォーマット指定子は以下のように選択する。</p>
376+
<ul>
377+
<li>C++17 : <code>%f</code>, <code>%e</code>のどちらかを、出力文字列が最も短くなるように選択する(両者が同じなら<code>%f</code>が優先)</li>
378+
<li>C++29 : 浮動小数点数型を<code>T</code>として、<code>value</code>の絶対値が<code>[l, u)</code>の範囲にあれば<code>%f</code>、そうでなければ<code>%e</code>を選択する。<code>l</code>は10<sup>-4</sup>に対応する<code>T</code>の値、<code>u</code><code><a href="../limits/numeric_limits/radix.html">std::numeric_limits&lt;T&gt;::radix</a></code><code><a href="../limits/numeric_limits/digits.html">std::numeric_limits&lt;T&gt;::digits</a>+ 1</code>乗を10の累乗へ切り下げた値に対応する<code>T</code>の値である</li>
379+
</ul>
376380
</li>
377381
<li>
378382
<p>(6), (7), (8), (9) : <code>fmt</code>によって指定されたフォーマット指定子を用いて、Cロケールで<code>printf</code>によって行われたかのように浮動小数点数を文字列へ変換する。<br />
@@ -416,6 +420,23 @@ <h2>備考</h2>
416420
<li>MSVCでは浮動小数点数→10進文字列変換の実装に<a href="https://github.com/ulfjack/ryu" target="_blank">Ryu</a>というアルゴリズムを利用している。</li>
417421
<li>(1) : 実装によって全ての整数型(符号付、無し)および<code>char</code><a class="cpprefjp-defined-word" data-desc="同名の関数を異なる引数・テンプレート・制約などで複数定義すること。または同名の関数の集合">オーバーロード</a>が提供される</li>
418422
<li>(5), (9), (13) : 浮動小数点数型は<a class="cpprefjp-defined-word" data-desc="&lt;stdfloat&gt;で定義される内部表現の規定された浮動小数点数型" href="../stdfloat.html">拡張浮動小数点数型</a>を含む</li>
423+
<li>(2), (3), (4), (5) :<ul>
424+
<li>C++29での<code>[l, u)</code>は、<code>double</code>では<code>[10</code><sup><code>-4</code></sup><code>, 10</code><sup><code>16</code></sup><code>)</code><code>float</code>では<code>[10</code><sup><code>-4</code></sup><code>, 10</code><sup><code>7</code></sup><code>)</code>となる</li>
425+
<li>C++17の規則では出力文字列の長さで指定子を選択するため、値が近くても表記が大きく変わることがあった。C++29ではPythonやRustなど他言語と同様に値の範囲で選択するため、この不整合が解消される<ul>
426+
<li><code>100000.0</code>の変換結果<ul>
427+
<li>C++17 : <code>1e+05</code></li>
428+
<li>C++29 : <code>100000</code><code>120000.0</code>はどちらのバージョンでも<code>120000</code>であり、近い値どうしで表記が食い違わなくなる)</li>
429+
</ul>
430+
</li>
431+
<li><code>1234567890123456700000.0</code>の変換結果<ul>
432+
<li>C++17 : <code>1234567890123456774144</code>(意味のない桁を含む)</li>
433+
<li>C++29 : <code>1.2345678901234568e+22</code></li>
434+
</ul>
435+
</li>
436+
</ul>
437+
</li>
438+
</ul>
439+
</li>
419440
</ul>
420441
<h2></h2>
421442
<h3>基本の使用例 (C++17)</h3>
@@ -654,6 +675,14 @@ <h2>参照</h2>
654675
<li>C++23で<a class="cpprefjp-defined-word" data-desc="&lt;stdfloat&gt;で定義される内部表現の規定された浮動小数点数型" href="../stdfloat.html">拡張浮動小数点数型</a>に対応した</li>
655676
</ul>
656677
</li>
678+
<li><a href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2026/p3505r4.html" target="_blank">P3505R4 Fix the default floating-point representation in <code>std::format</code></a><ul>
679+
<li>C++29で、(2), (3), (4), (5)のフォーマット指定子の選択が、出力文字列の長さによるものから<code>value</code>の値の範囲によるものへ変更された。この変更は<code><a href="../format/format.html">std::format()</a></code>で型指定を省略した場合の出力にも影響する。LEWGでは以前のバージョンへの欠陥報告 (DR) として扱うことが推奨されているため、処理系がC++29より前のモードでも新しい表現を採用する場合がある</li>
680+
</ul>
681+
</li>
682+
<li><a href="https://cplusplus.github.io/LWG/issue4602" target="_blank">LWG Issue 4602. Incorrect lower bound for the default floating-point representation</a><ul>
683+
<li>P3505R4が意図せず変更していた<code>l</code>, <code>u</code>の定義を、10<sup>-4</sup>などの値に最も近い<code>T</code>の値を指すという本来の設計へ戻す修正。C++29のワーキングドラフトへはまだ適用されていない (Readyステータス)</li>
684+
</ul>
685+
</li>
657686
<li><a href="https://ja.cppreference.com/w/c/io/fprintf" target="_blank">C言語リファレンス - fprintf</a></li>
658687
</ul></div>
659688

reference/chrono/make24.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ <h2>例</h2>
263263
<span class="w"> </span><span class="n"><a href="../cassert/assert.html">assert</a></span><span class="p">(</span><span class="n"><span style="color:#ff0000">chrono::make24</span></span><span class="p">(</span><span class="n"><a href="duration/op_h.html">12h</a></span><span class="p">,</span><span class="w"> </span><span class="nb">false</span><span class="p">)</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n"><a href="duration/op_h.html">0h</a></span><span class="p">);</span>
264264

265265
<span class="w"> </span><span class="n"><a href="../cassert/assert.html">assert</a></span><span class="p">(</span><span class="n"><span style="color:#ff0000">chrono::make24</span></span><span class="p">(</span><span class="n"><a href="duration/op_h.html">12h</a></span><span class="p">,</span><span class="w"> </span><span class="nb">true</span><span class="p">)</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n"><a href="duration/op_h.html">12h</a></span><span class="p">);</span>
266-
<span class="w"> </span><span class="n"><a href="../cassert/assert.html">assert</a></span><span class="p">(</span><span class="n"><span style="color:#ff0000">chrono::make24</span></span><span class="p">(</span><span class="n"><a href="duration/op_h.html">1h</a></span><span class="p">,</span><span class="w"> </span><span class="nb">true</span><span class="p">)</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="mf">1l</span><span class="n">bqbBboyUsuqkpkFHSaQSMQmnvZQVHIk</span><span class="p">);</span>
266+
<span class="w"> </span><span class="n"><a href="../cassert/assert.html">assert</a></span><span class="p">(</span><span class="n"><span style="color:#ff0000">chrono::make24</span></span><span class="p">(</span><span class="n"><a href="duration/op_h.html">1h</a></span><span class="p">,</span><span class="w"> </span><span class="nb">true</span><span class="p">)</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="mi">1</span><span class="n"><a href="duration/op_h.html">3h</a></span><span class="p">);</span>
267267
<span class="w"> </span><span class="n"><a href="../cassert/assert.html">assert</a></span><span class="p">(</span><span class="n"><span style="color:#ff0000">chrono::make24</span></span><span class="p">(</span><span class="n"><a href="duration/op_h.html">3h</a></span><span class="p">,</span><span class="w"> </span><span class="nb">true</span><span class="p">)</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n"><a href="duration/op_h.html">15h</a></span><span class="p">);</span>
268268
<span class="w"> </span><span class="n"><a href="../cassert/assert.html">assert</a></span><span class="p">(</span><span class="n"><span style="color:#ff0000">chrono::make24</span></span><span class="p">(</span><span class="n"><a href="duration/op_h.html">11h</a></span><span class="p">,</span><span class="w"> </span><span class="nb">true</span><span class="p">)</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n"><a href="duration/op_h.html">23h</a></span><span class="p">);</span>
269269
<span class="p">}</span>

reference/format/format.html

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@
189189
<p class="text-right"><small>
190190
最終更新日時:
191191
<time itemprop="datePublished" class="js-local-time"
192-
datetime="2026-08-31T13:28:20+09:00">
193-
2026年08月31日 13時28分20秒 (JST)
192+
datetime="2026-09-02T11:57:54+09:00">
193+
2026年09月02日 11時57分54秒 (JST)
194194
</time>
195195
<br/>
196196
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
@@ -475,9 +475,18 @@ <h4>浮動小数点数型の場合</h4>
475475
<td style="text-align: left;">値に応じて指数表記を使う</td>
476476
<td style="text-align: left;"><code>to_chars(first, last, value, chars_format::general, precision)</code> (精度が指定されたとき)<br /><code>to_chars(first, last, value, chars_format::general, 6)</code> (それ以外)</td>
477477
</tr>
478+
<tr>
479+
<td style="text-align: left;">(指定なし)</td>
480+
<td style="text-align: left;">値に応じて指数表記を使う</td>
481+
<td style="text-align: left;"><code>to_chars(first, last, value, chars_format::general, precision)</code> (精度が指定されたとき)<br /><code>to_chars(first, last, value)</code> (それ以外)</td>
482+
</tr>
478483
</tbody>
479484
</table>
480-
<p>デフォルトは <code>g</code></p>
485+
<p>型指定を省略した場合、精度も指定されていなければ<code>g</code>とは異なり、精度・フォーマット指定なしの<code><a href="../charconv/to_chars.html">to_chars</a></code>と同じ表現になる。この既定表現で指数表記を使うかどうかの判定は、以下のように変更された。</p>
486+
<ul>
487+
<li>C++20 : 出力文字列が最も短くなるほうを選択する。<code>std::format("{}", 100000.0)</code><code>"1e+05"</code>となる</li>
488+
<li>C++29 : 値の範囲によって選択する。<code>std::format("{}", 100000.0)</code><code>"100000"</code>となる</li>
489+
</ul>
481490
<p>大文字のオプションを指定すると数値中のアルファベットが大文字になる。</p>
482491
<p>「値に応じて」の詳細や、精度の意味については<code><a href="../charconv/to_chars.html">to_chars</a></code>を参照。</p>
483492
<p>代替表現を指定すると、小数点以下が何もなくても小数点記号を出力する。<code>g</code>/<code>G</code>の場合は、代替表現を指定しないかぎり末尾の0およびそれによって不要になる小数点を出力しない。</p>
@@ -1083,6 +1092,10 @@ <h2>参照</h2>
10831092
<li>C++29で、<code><a href="../cstdint/uintptr_t.html">uintptr_t</a></code>が必ず定義されるようになったことにともない、ポインタの出力が<a class="cpprefjp-defined-word" data-desc="処理系定義の動作。処理系によって事前に定めた動作をする" href="../../implementation-compliance.html#dfn-implementation-defined-behavior">処理系定義</a>となる場合の規定が削除された</li>
10841093
</ul>
10851094
</li>
1095+
<li><a href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2026/p3505r4.html" target="_blank">P3505R4 Fix the default floating-point representation in <code>std::format</code></a><ul>
1096+
<li>C++29で、浮動小数点数の型指定と精度をどちらも省略した場合の既定表現が、値の範囲によって固定小数表記と指数表記を選択するよう変更された。他言語の実装と揃えるためである</li>
1097+
</ul>
1098+
</li>
10861099
</ul></div>
10871100

10881101
</div>

0 commit comments

Comments
 (0)