<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On Wednesday, 04 June, 2014 06:03 AM,
Philippe wrote:<br>
</div>
<blockquote
cite="mid:baacd737f696db582abf73665996108f@quarta.com.br"
type="cite">
<p>generally, if one needs accurate values he does not use real
values ... use integer (or word, longint, longword etc) ... then
when needed make the conversion or formating (for computing or
printing) ...</p>
</blockquote>
My thinking is quite the opposite. I am not a mathematician though.
:) What if we need a high degree of precision in our computation?
So we need this type of figure: #####.##### the more
precision(accuracy) we need, the more digits we add after the
decimal point. Integer store whole numbers w/o any fraction
components. <br>
Since I am using PosgreSQL, according to the docs:<br>
<br>
"The type <tt class="TYPE">numeric</tt> can store numbers with a
very large number of digits and perform calculations exactly. It is
especially recommended for storing monetary amounts and other
quantities where exactness is required. However, arithmetic on <tt
class="TYPE">numeric</tt> values is very slow compared to the
integer types, or to the floating-point types described in the next
section. "<br>
<br>
The numeric data type must be equivalent of Firebird's decimal data
type.<br>
<br>
<blockquote
cite="mid:baacd737f696db582abf73665996108f@quarta.com.br"
type="cite">
<p>(it may exists another solution ... someone else may help
better for that!)</p>
<p>Philippe</p>
<p>Em 03.06.2014 17:39, Daniel Erles escreveu:</p>
<blockquote type="cite" style="padding-left:5px;
border-left:#1010ff 2px solid; margin-left:5px; width:100%"><!-- html ignored --><!-- head ignored --><!-- meta ignored -->
<div dir="ltr">
<div>Hello. </div>
<div>I have this problem: </div>
<div> </div>
<div>My database (Firebird) has a table with the following
fields: </div>
<div>... </div>
<div>rTitle DECIMAL(8,4) not null,</div>
<div>rDiameter DECIMAL(10,6) not null, </div>
<div>... </div>
<div> </div>
<div>In my program I have a Form with a a TZTable object
(ZEOS) called zData, bound to that table. </div>
<div>In a routine I have the following code: </div>
<div> </div>
<div>zData.Insert;</div>
<div>...</div>
<div>zData.FieldByName('rTitle').AsFloat := 0.12; </div>
<div>zData.FieldByName('rDiameter').AsFloat := 0.12; </div>
<div>...</div>
<div>zData.Post;</div>
<div> </div>
<div>Then, at the table, I see that the values are stored as
follows: </div>
<div> </div>
<div>rTitle = <strong>0.1199</strong></div>
<div>rDiameter = 0.12 </div>
<div> </div>
<div>Do not know why rTitle is 0.1199 instead of 0.12 </div>
<div>I need the saved values are accurate. </div>
<div>I've tried AsFloat, AsCurrency, Value, always with the
same result. </div>
<div> </div>
<div>Any idea?</div>
<div> </div>
<div>Tks. </div>
<div>Daniel.</div>
</div>
<br>
<pre>--
_______________________________________________
Lazarus mailing list
<a moz-do-not-send="true" href="mailto:Lazarus@lists.lazarus.freepascal.org">Lazarus@lists.lazarus.freepascal.org</a>
<a moz-do-not-send="true" href="http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus">http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus</a>
</pre>
</blockquote>
<p> </p>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">--
_______________________________________________
Lazarus mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Lazarus@lists.lazarus.freepascal.org">Lazarus@lists.lazarus.freepascal.org</a>
<a class="moz-txt-link-freetext" href="http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus">http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus</a>
</pre>
</blockquote>
</body>
</html>