<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div class="moz-cite-prefix">On 1/9/2025 0:10, Damian McGuckin
wrote:<br>
</div>
<blockquote type="cite" cite="mid:ed86a599-ee6b-3b3-65ea-2180884b4366@esi.com.au">
<br>
Joshua,
<br>
<br>
On Wed, 8 Jan 2025, Joshua Cranmer wrote:
<br>
<br>
<blockquote type="cite">On 1/8/2025 14:13, Jerome Coonen wrote:
<br>
Joshua: C++ doesn't want pragmas, but wants templates
instead. Have
<br>
tried to propose, but have found resistance.
<br>
</blockquote>
<br>
Can you share an example of the template approach, specifically
the one with the 11 template arguments?<br>
</blockquote>
One hasn't been proposed yet, but the general thinking is that
something like this would exist:<br>
template <typename T, round mode, exception behavior, ...><br>
class float;<br>
<p>which starts to get obscene if you represent the
fast-math-related behavior as individual parameters.<br>
</p>
<blockquote type="cite" cite="mid:ed86a599-ee6b-3b3-65ea-2180884b4366@esi.com.au">
<br>
<blockquote type="cite"> Joshua: C++ does all FENV_ACCESS
on a per-function basis.
<br>
<br>
C++ implementations allow something like FENV_ACCESS on a
per-function basis.
<br>
</blockquote>
<br>
Do you have an example please?<br>
</blockquote>
<p>MSVC implements a few FP programs, like <a href="https://learn.microsoft.com/en-us/cpp/preprocessor/float-control?view=msvc-170">#pragma
fp_control</a> (the documentation doesn't say it, but tests on
compiler explorer confirm that it's function-level).</p>
<p>Clang has a rich set of pragmas
(<a class="moz-txt-link-freetext" href="https://clang.llvm.org/docs/LanguageExtensions.html#extensions-to-specify-floating-point-flags">https://clang.llvm.org/docs/LanguageExtensions.html#extensions-to-specify-floating-point-flags</a>),
in addition to implementing the MSVC pragmas, that work on a
per-block basis. It also implements #pragma STDC FENV_ACCESS
directly.</p>
<p>GCC has the -frounding-math parameter that controls the same
thing as FENV_ACCESS, and I think (though I haven't tested) it's
possible to specify this with the per-function attribute allowing
custom optimizations to be applied to functions.<br>
</p>
<p><br>
</p>
</body>
</html>