From ffd39b7124f4e25f4559516032b3e0fcd8c36465 Mon Sep 17 00:00:00 2001 From: vaeng <34183939+vaeng@users.noreply.github.com> Date: Tue, 8 Oct 2024 15:35:49 +0200 Subject: [PATCH 1/2] docs: update literals introduction with C++23 standard information --- concepts/literals/introduction.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/concepts/literals/introduction.md b/concepts/literals/introduction.md index eee241b3..465ed31b 100644 --- a/concepts/literals/introduction.md +++ b/concepts/literals/introduction.md @@ -33,6 +33,15 @@ auto net_worth_carlisle_cullen{46'000'000'000LL}; // int and uint are not enough Floating-point numbers usually resolve to `double` during compilation. This is a good default case and use-cases with the narrower `float` type are less frequent than the unsigned example above. +~~~~exercism/advanced +The [C++23 standard][cpp23-literals] introduces more fine grained control with literals like `f128` or `F16`. +Some compilers allow their own literals. +GCC permits the usage of `d` as a literal, but this is not forseen in the standard and can hinder cross-platform compatibility. + +[cpp23-literals]: https://en.cppreference.com/w/cpp/language/floating_literal + +~~~~ + ```cpp auto light_year_in_m{9.46073e+15f}; // well in the range of float auto earth_to_edge_comoving_distance_in_nm{4.32355e+32}; // needs double type for magnitude From bdef2b5ccad012a8da9f7d97999eb358bb39df88 Mon Sep 17 00:00:00 2001 From: Christian Willner <34183939+vaeng@users.noreply.github.com> Date: Wed, 16 Oct 2024 12:10:40 +0200 Subject: [PATCH 2/2] Update concepts/literals/introduction.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: AndrĂ¡s B Nagy <20251272+BNAndras@users.noreply.github.com> --- concepts/literals/introduction.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/concepts/literals/introduction.md b/concepts/literals/introduction.md index 465ed31b..99f433b1 100644 --- a/concepts/literals/introduction.md +++ b/concepts/literals/introduction.md @@ -36,7 +36,7 @@ This is a good default case and use-cases with the narrower `float` type are les ~~~~exercism/advanced The [C++23 standard][cpp23-literals] introduces more fine grained control with literals like `f128` or `F16`. Some compilers allow their own literals. -GCC permits the usage of `d` as a literal, but this is not forseen in the standard and can hinder cross-platform compatibility. +GCC permits the usage of `d` as a literal, but this is not foreseen in the standard and can hinder cross-platform compatibility. [cpp23-literals]: https://en.cppreference.com/w/cpp/language/floating_literal