<div dir="ltr"><div>Yes, I tried with round too. </div><div><br></div><div>Now I understand the problem, thanks to the explanation of Mattias. </div><div>But I could not find a solution yet. </div><div><br></div><div>The problem only occurs when I insert data using INSERT and POST functions. </div>
<div>I tried creating an SQL INSERT, and running it with ExecuteQuery (), and the values are saved correctly. The problem apparently is not in Firebird, but in ZEOS classes implementation, or their ancestors. </div><div>
<br></div><div>I think maybe I'll look for a different approach to solve my problem, perhaps with the use of BCD fields. We'll see.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-06-04 11:55 GMT-04:00 Poncho Velázquez <span dir="ltr"><<a href="mailto:poncho-velazquez@hotmail.com" target="_blank">poncho-velazquez@hotmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div dir="ltr">Hi Daniel,<div><br></div><div>have you tried to use function Round in te assignment of the value??</div><div><br></div><div>Regards</div><div>Poncho<br><br><div><hr>Date: Tue, 3 Jun 2014 16:39:30 -0400<br>
From: <a href="mailto:derles@gmail.com" target="_blank">derles@gmail.com</a><br>To: <a href="mailto:lazarus@lists.lazarus.freepascal.org" target="_blank">lazarus@lists.lazarus.freepascal.org</a><br>Subject: [Lazarus] Problem rounding values at post<div>
<div class="h5"><br><br><div dir="ltr"><div>Hello. </div><div>I have this problem: </div><div><br></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><br></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><br></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><br></div><div>Then, at the table, I see that the values are stored as follows: </div>
<div><br></div><div>rTitle = <b>0.1199</b></div><div>rDiameter = 0.12 </div><div><br></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><br></div><div>Any idea?</div><div><br></div><div>Tks. </div><div>Daniel.</div></div>
<br></div></div><div class="">--
_______________________________________________
Lazarus mailing list
<a href="mailto:Lazarus@lists.lazarus.freepascal.org" target="_blank">Lazarus@lists.lazarus.freepascal.org</a>
<a href="http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus" target="_blank">http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus</a></div></div></div> </div></div>
<br>--<br>
_______________________________________________<br>
Lazarus mailing list<br>
<a href="mailto:Lazarus@lists.lazarus.freepascal.org">Lazarus@lists.lazarus.freepascal.org</a><br>
<a href="http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus" target="_blank">http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus</a><br>
<br></blockquote></div><br></div>