<div dir="auto"><div><div class="gmail_quote"><div dir="ltr">Wolf <<a href="mailto:wv99999@gmail.com" target="_blank" rel="noreferrer">wv99999@gmail.com</a>> schrieb am Mi., 13. Juni 2018, 09:27:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<p>Why not ask the CPU to do the rounding? This is what Intel offers
in volume 1 of the Intel ® 64 and IA-32 Architectures Software
Developer's Manual:<br>
</p>
<font size="-1">4.8.4.1<br>
Rounding Control (RC) Fields<br>
In the Intel 64 and IA-32 architectures, the rounding mode is
controlled by a 2-bit rounding-control (RC) field<br>
(Table 4-8 shows the encoding of this field). The RC field is
implemented in two different locations:<br>
•<br>
x87 FPU control register (bits 10 and 11)<br>
•<br>
The MXCSR register (bits 13 and 14)<br>
Although these two RC fields perform the same function, they
control rounding for different execution environ-<br>
ments within the processor. The RC field in the x87 FPU control
register controls rounding for computations<br>
performed with the x87 FPU instructions; the RC field in the MXCSR
register controls rounding for SIMD floating-<br>
point computations performed with the SSE/SSE2 instructions.</font><i><br>
</i><br>
Do you want more?<br></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Which is what FPC already provides with SetRoundMode() in unit Math. </div><div dir="auto"><br></div><div dir="auto">As long as one changes the rounding mode only locally for some calculations and restores it afterwards there should be no problem (the rounding mode can be considered as thread specific as well). </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven</div><div dir="auto"><br></div><div dir="auto">PS: please don't add images as inline content, the archive can't display them correctly. </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF"></div></blockquote></div></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><a href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal" rel="noreferrer noreferrer noreferrer" target="_blank"></a></blockquote></div></div></div>