<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body smarttemplateinserted="true" text="#000000" bgcolor="#FFFFFF">
<blockquote type="cite">
Btw, anyone know about a BCD math implementation for Free Pascal,
like<br>
it used to be implemented in DR CBASIC? (those were the days...
;-) )<br>
</blockquote>
<br>
<br>
I have one here: <a class="moz-txt-link-freetext" href="http://benibela.de/sources_en.html#bigdecimalmath">http://benibela.de/sources_en.html#bigdecimalmath</a><br>
<br>
<br>
<br>
<div class="moz-cite-prefix">Am 23.08.2017 um 02:16 schrieb Paul
Nance:<br>
</div>
<blockquote type="cite"
cite="mid:CAFZoqGYmDP5ujKUDa=LO9v6hwRPtwEkqK+-DzCibBccTkUH0Aw@mail.gmail.com">
<meta http-equiv="Context-Type" content="text/html; charset=UTF-8">
<div dir="auto">Turbo Pascal also had a BCD unit.</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Aug 22, 2017 6:56 PM, "Ralf Quint"
<<a href="mailto:freedos.la@gmail.com"
moz-do-not-send="true">freedos.la@gmail.com</a>> wrote:<br
type="attribution">
<blockquote class="gmail_quote">On 8/22/2017 1:39 PM, Mark
Morgan Lloyd wrote:<br>
> On 21/08/17 22:15, Ralf Quint wrote:<br>
>> On 8/21/2017 3:02 PM, James Richters wrote:> I
am having an issue<br>
>> with a simple floating point application. I am
setting a variable to<br>
>> a specific value and immediately after I set it,
it is not exactly<br>
>> what I set it to. Here's an example>>
Draw_GX_Min:=999.999;> <br>
>> Writeln(Draw_GX_Min:3:30);>> The writeln
results in<br>
>> 999.<wbr>999000000000020000000000000000<wbr>
>> Why is it not <br>
>> 999.<wbr>999000000000000000000000000000<wbr> where
did 0.00000000000002 come<br>
>> from?>Out of thin air... Well, kind of. Double
floating point means<br>
>> 16 digitsof precision, so when you force a 30 digit
precision output,<br>
>> anythingpast 16 digits is random garbage, at
best...<br>
><br>
> And in any event, that's probably much more precision
than the GPU is<br>
> using to generate the final image :-)<br>
><br>
Well, older GPUs (at least NVidia, pretty sure similar
restrictions<br>
apply to AMD) use(d) only 32bit "single" floats, giving a 7
digit<br>
precision, though newer ones can also handle 64bit doubles.
But there<br>
are quite a few differences in how certain FP operations are
handled on<br>
those GPUs, which result in even doubles only having 14
(instead of 16)<br>
digits of precision at best. So while NVidia keeps
mentioning IEEE754,<br>
their GPUs are in practice not 100% compliant.<br>
<br>
As I mentioned before, if someone needs to work a lot with
floating<br>
point arithmetic, it really helps to get yourself acquainted
to the way<br>
those works and all the possible pitfalls.<br>
<br>
Btw, anyone know about a BCD math implementation for Free
Pascal, like<br>
it used to be implemented in DR CBASIC? (those were the
days... ;-) )<br>
<br>
Ralf<br>
<br>
<br>
<br>
---<br>
This email has been checked for viruses by Avast antivirus
software.<br>
<a href="https://www.avast.com/antivirus" rel="noreferrer"
target="_blank" moz-do-not-send="true">https://www.avast.com/<wbr>antivirus</a><br>
<br>
______________________________<wbr>_________________<br>
fpc-pascal maillist - <a
href="mailto:fpc-pascal@lists.freepascal.org"
moz-do-not-send="true">fpc-pascal@lists.freepascal.<wbr>org</a><br>
<a
href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal"
rel="noreferrer" target="_blank" moz-do-not-send="true">http://lists.freepascal.org/<wbr>cgi-bin/mailman/listinfo/fpc-<wbr>pascal</a></blockquote>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
fpc-pascal maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a></pre>
</blockquote>
<br>
</body>
</html>