main logo
Subject: Money field and decimals [was Re: [V4RB] VFloat - strange behavior]
Author: Francois Van Lerberghe
Posted: 2001/08/30 07:58:38
 
View Entire Thread
New Search


john roberts wrote :
> =

> on 8/30/01 6:12 AM, Francois Van Lerberghe at fvanlerberghe .at. freegates .D.O.T b=
e
> wrote:
> =

> > Must I use VDouble field in order to retrieve safely the value I
> > stored ?
> > (I need 2 decimals precision because it's for storing money amount)
> =

> As noted above, using vDouble will not resolve your problem.
> =

> Store the money values as a string with two-decimals. Define a virtual
> method which converts that to a number; this can be used for sorting/fi=
nd
> operations if needed. The string field can be brought into RB very easi=
ly
> and with no time penalty. Use the format function with a format
> specification "#.00" or "#,00" as needed.

Ok. But when you use the field to do calculation, you'll convert the
string into double. So why don't use directly VDouble ?
I think converting the string into double lost the precision of the
string representation. So using directly VDouble avoid the need of
conversion and, for large database, the time penalty. No ?

Fran=E7ois Van Lerberghe
Thier Monty, 15A
B-4570 Marchin
Belgique
 
©2001 Francois Van Lerberghe
<-- Prior Message New Search Next Message -->