Subject | Re: [IBO] Problem with rounding .. any advice. |
---|---|
Author | Martijn Tonies |
Post date | 2008-11-11T11:37:49Z |
Hello Adrian,
the Currency value ( ".AsCurrency" ) into a Double and expect no rounding?
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Sybase
SQL Anywhere, Oracle & MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com
> I have the following situation:What if you define this as Currency instead of Double? Cause you're putting
>
> I enter a Cash value in an IB_Edit, then copy it to string.
> I then remove any spaces, R or $ signs
>
> code below:
> var
> PostEntry, TempTotal: Double;
the Currency value ( ".AsCurrency" ) into a Double and expect no rounding?
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Sybase
SQL Anywhere, Oracle & MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com
> s: String;495.1
> ....
> s:= IB_EditPayment.text; Here I enter 495.10
> delete(s,pos('R',s),1);
> delete(s,pos('r',s),1);
> delete(s,pos('$',s),1);
> while pos(' ',s)>0 do
> delete(s,pos(' ',s),1);
> TempPaymentStr := s;
>
> PostEntry := StrToFloat(TempPaymentStr); // PostEntry is
>Prax.IB_QueryEntry.FieldByName('TransCredit').AsCurrency;
>
> I then retrieve TempEntry
> TempEntry := Prax.IB_QueryEntry.FieldByName('TransDebit').AsCurrency -
>something like that, throwing me.
> TransDebit value contains 495.10
> TransCredit = 0.00 or can be null
>
> When comparing the two supposedly equal values:
> if PostEntry > TempTotal then
> ... it branches here, but both PostEntry, and TempTotal Contains 495.10
> else
> ... and should thus branch here.
>
> This must be some floating point thingy with 495.10000000000000003456 or
>FB2.1.1.17910-0
> How do I circumvent this behaviour.
>
> PS TransCredit and TransDebit defined as Numeric(15.2) ODS 11.1
>___________________________________________________________________________
>
> [Non-text portions of this message have been removed]
>
>
> ------------------------------------
>
>
> IB Objects - direct, complete, custom connectivity to Firebird orInterBase
> without the need for BDE, ODBC or any other layer.___________________________________________________________________________
>
> http://www.ibobjects.com - your IBO community resource for Tech Infopapers,
> keyword-searchable FAQ, community code contributions and more !Yahoo! Groups Links
>
>
>