<div dir="ltr"><div><span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">zeljko: the rTitle is defined as DECIMAL(8,4), for sure.</span></div>
<div><span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">Allan Registos: I need 4 decimal </span><span style="font-family:arial,sans-serif;font-size:13px">precision on that field. And I tried to input 0.1200, got same wrong value inserted: 0.1199</span></div>
<div><span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)"><br></span></div><div><span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">Strange. I tried many values and y found this happens:</span><br>
</div><br style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)"><span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">...</span><br style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">
<span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">inserting 0.06 stored as 0.0599</span><br style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">
<span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">0.07 --> 0.07</span><br style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">
<span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">0.08 --> 0.08</span><br style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">
<span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">0.09 --> 0.0899</span><br style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">
<span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">0.10 --> 0.10</span><br style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">
<span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">0.11 --> 0.11</span><br style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">
<span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">0.12 --> 0.1199</span><br style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">
<span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">0.13 --> 0.13</span><br style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">
<span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">0.14 --> 0.14</span><br style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">
<span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">0.15 --> 0.1499</span><br style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">
<span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">0.16 --> 0.16</span><br style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">
<span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">0.17 --> 0.17</span><br style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">
<span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">0.18 --> 0.1799</span><br style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">
<span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">...</span><br style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">
<br>there's a patron here. C<span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">ould this be a bug ?</span><br>
<div><span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)"><br></span></div><div><span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">Lazarus: 1.0.10</span></div>
<div><span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">FPC: 2.6.2</span></div><div><span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">Firebird: 2.5</span></div>
<div><span style="color:rgb(0,0,0);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:17.472000122070313px;background-color:rgb(240,244,247)">ZeoisLib: 7.0.4</span></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">2014-06-04 5:08 GMT-04:00 zeljko <span dir="ltr"><<a href="mailto:zeljko@holobit.net" target="_blank">zeljko@holobit.net</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="">On 06/04/2014 10:43 AM, Mattias Gaertner wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Wed, 04 Jun 2014 15:47:24 +0800<br>
"Allan E. Registos" <<a href="mailto:allan.registos@smpc.steniel.com.ph" target="_blank">allan.registos@smpc.steniel.<u></u>com.ph</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Wednesday, 04 June, 2014 06:03 AM, Philippe wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
generally, if one needs accurate values he does not use real values<br>
... use integer (or word, longint, longword etc) ... then when needed<br>
make the conversion or formating (for computing or printing) ...<br>
<br>
</blockquote>
My thinking is quite the opposite. I am not a mathematician though. :)<br>
What if we need a high degree of precision in our computation?  So we<br>
need this type of figure: #####.##### the more precision(accuracy) we<br>
need, the more digits<br>
</blockquote>
<br>
If you need 5 digits, i.e. decimals: multiply by 100.000 when<br>
storing and divide by 100.000 when loading the value.<br>
Computers work on binary numbers and decimal 1.2 (= 1+2/10) has no exact<br>
representation in binary.<br>
</blockquote>
<br></div>
That's why numeric type is used. Saving field as integer and divide it while loading is stupid if you have correct numeric type in db.<span class="HOEnZb"><font color="#888888"><br>
<br>
zeljko</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
--<br>
______________________________<u></u>_________________<br>
Lazarus mailing list<br>
<a href="mailto:Lazarus@lists.lazarus.freepascal.org" target="_blank">Lazarus@lists.lazarus.<u></u>freepascal.org</a><br>
<a href="http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus" target="_blank">http://lists.lazarus.<u></u>freepascal.org/mailman/<u></u>listinfo/lazarus</a><br>
</div></div></blockquote></div><br></div>