Another common issue I&#39;ve had with doubles is<br><br>x := 0<br><br>x = 0 can somtimes return false and the debugger might show 0.00000000001 or something as a value even though it was hardcoded. <br><br>I now use routines like NearZero (just an example name) which rounds test values to a a reasonable test DP.<br>
<br><div class="gmail_quote">On Wed, Dec 30, 2009 at 11:19 PM, Kyley Harris <span dir="ltr">&lt;<a href="mailto:Kyley@harrissoftware.com">Kyley@harrissoftware.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Doubles and extendeds have always had minor rounding issues and other little things depending on the OS, and Hardware that its running on. The Currency is a special case which uses whole numbers rather than fractions for arithmetic. Its supposed to be guaranteed accurate to 4dp and they are not processed in the same way.<div>
<div></div><div class="h5"><br>
<br><div class="gmail_quote">On Wed, Dec 30, 2009 at 9:42 PM, Vikas... <span dir="ltr">&lt;<a href="mailto:vikas.image@gmail.com" target="_blank">vikas.image@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Hi Edward,<br><br>I use extended for both.<br><br>does it cause problem?<div><div></div><div><br><br><div class="gmail_quote">On Wed, Dec 30, 2009 at 1:24 PM, Edward Koryagin <span dir="ltr">&lt;<a href="mailto:ed_iv2001@yahoo.co.nz" target="_blank">ed_iv2001@yahoo.co.nz</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Use currency and everything should be fine.<br>
<br>
Edward Koryagin<br>
<br>
<br>
--- On Wed, 30/12/09, Edward Koryagin &lt;<a href="mailto:ed_iv2001@yahoo.co.nz" target="_blank">ed_iv2001@yahoo.co.nz</a>&gt; wrote:<br>
<br>
&gt; From: Edward Koryagin &lt;<a href="mailto:ed_iv2001@yahoo.co.nz" target="_blank">ed_iv2001@yahoo.co.nz</a>&gt;<br>
&gt; Subject: Re: [DUG] Need help with trunc command delphi 6<br>
&gt; To: &quot;NZ Borland Developers Group - Delphi List&quot; &lt;<a href="mailto:delphi@delphi.org.nz" target="_blank">delphi@delphi.org.nz</a>&gt;<br>
&gt; Received: Wednesday, 30 December, 2009, 8:28 PM<br>
<div><div></div><div>&gt; What data types do you use for 4.5<br>
&gt; and 0.1?<br>
&gt;<br>
&gt; Edward Koryagin<br>
&gt;<br>
&gt;<br>
&gt; --- On Wed, 30/12/09, Vikas... &lt;<a href="mailto:vikas.image@gmail.com" target="_blank">vikas.image@gmail.com</a>&gt;<br>
&gt; wrote:<br>
&gt;<br>
&gt; &gt; From: Vikas... &lt;<a href="mailto:vikas.image@gmail.com" target="_blank">vikas.image@gmail.com</a>&gt;<br>
&gt; &gt; Subject: [DUG] Need help with trunc command delphi 6<br>
&gt; &gt; To: <a href="mailto:delphi@delphi.org.nz" target="_blank">delphi@delphi.org.nz</a><br>
&gt; &gt; Received: Wednesday, 30 December, 2009, 8:00 PM<br>
&gt; &gt; Hello everyone,<br>
&gt; &gt;<br>
&gt; &gt; I am facing one strange problem here. We are using a<br>
&gt; &gt; banking teller application ,here we do calculation<br>
&gt; based on<br>
&gt; &gt; denominations in short.<br>
&gt; &gt;<br>
&gt; &gt; My main problem is when we use this application for<br>
&gt; long<br>
&gt; &gt; time with out closing it the trunc start giving<br>
&gt; incorrect<br>
&gt; &gt; value what i mean is <br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; quantity := trunc(amount/value).<br>
&gt; &gt;<br>
&gt; &gt; Sometime when amount = let say 4.5 and value =0.1 it<br>
&gt; gives<br>
&gt; &gt; like<br>
&gt; &gt;<br>
&gt; &gt; quantity := trunc(4.5/0.1)=44 which is wrong since my<br>
&gt; &gt; client complain it make them lose of 1 dollar amount.<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; However when i close the application and do again all<br>
&gt; works<br>
&gt; &gt; fine.<br>
&gt; &gt;<br>
&gt; &gt; Anyone ever faced this problem before  , or anyone<br>
&gt; know<br>
&gt; &gt; any substitute for trunc which works<br>
&gt; &gt; I am using delhi6<br>
&gt; &gt;<br>
&gt; &gt; Appreciate your help<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; regards<br>
&gt; &gt; vik<br>
&gt; &gt;<br>
&gt; &gt; --<br>
&gt; &gt;   vikas<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; -----Inline Attachment Follows-----<br>
&gt; &gt;<br>
&gt; &gt; _______________________________________________<br>
&gt; &gt; NZ Borland Developers Group - Delphi mailing list<br>
&gt; &gt; Post: <a href="mailto:delphi@delphi.org.nz" target="_blank">delphi@delphi.org.nz</a><br>
&gt; &gt; Admin: <a href="http://delphi." target="_blank">http://delphi.</a>.<a href="http://org.nz/mailman/listinfo/delphi" target="_blank">org.nz/mailman/listinfo/delphi</a><br>
&gt; &gt; Unsubscribe: send an email to <a href="mailto:delphi-request@delphi.org.nz" target="_blank">delphi-request@delphi.org.nz</a><br>
&gt; &gt; with Subject: unsubscribe<br>
&gt;<br>
&gt;<br>
&gt;      <br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; NZ Borland Developers Group - Delphi mailing list<br>
&gt; Post: <a href="mailto:delphi@delphi.org.nz" target="_blank">delphi@delphi.org.nz</a><br>
&gt; Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
&gt; Unsubscribe: send an email to <a href="mailto:delphi-request@delphi.org.nz" target="_blank">delphi-request@delphi.org.nz</a><br>
&gt; with Subject: unsubscribe<br>
&gt;<br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
NZ Borland Developers Group - Delphi mailing list<br>
Post: <a href="mailto:delphi@delphi.org.nz" target="_blank">delphi@delphi.org.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
Unsubscribe: send an email to <a href="mailto:delphi-request@delphi.org.nz" target="_blank">delphi-request@delphi.org.nz</a> with Subject: unsubscribe<br>
</div></div></blockquote></div><br><br clear="all"><br></div></div>-- <br><font color="#888888">  vikas<br>
</font><br>_______________________________________________<br>
NZ Borland Developers Group - Delphi mailing list<br>
Post: <a href="mailto:delphi@delphi.org.nz" target="_blank">delphi@delphi.org.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
Unsubscribe: send an email to <a href="mailto:delphi-request@delphi.org.nz" target="_blank">delphi-request@delphi.org.nz</a> with Subject: unsubscribe<br></blockquote></div><br><br clear="all"><br></div></div><font color="#888888">-- <br>
Kyley Harris<br>Harris Software<br>
+64-21-671-821<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Kyley Harris<br>Harris Software<br>+64-21-671-821<br>