double becomes integer

Ruslan Zasukhin sunshine at public.kherson.ua
Sat Jun 25 20:25:54 CDT 2005


On 6/25/05 7:50 PM, "Jules Jacquot" <jules.jacquot at wanadoo.fr> wrote:

Hi Jules,

> hi,ruslan
> 
> if i have defined a double value like this
> 
>    cotisouv=tblCotisations.field("Assdouv").value
> 
> i have 2,40
> 
> if i multiply cotisouv by a constant e.g. 3
> 
> cotisouv=tblCotisations.field("Assdouv").value*3
> 
> i have 6
> 
> workarond :
> 
> cotisouv=cdbl(tblCotisations.field("Assdouv").getstring)*3
> 
> then i have the correct result 7,2
> 
> what do you think about ? Bug ?

No. this is why:

    tblCotisations.field("Assdouv").value * 3
               ^^^^^^^^^

You use access as to Vfield.Value. This is VARIANT.
I.e. This value do not have own type.

Now you do * 3, which is integer.

        unknown type * integer

What type RB choose for result?
Right. Integer.  

You can do

1) 
    tblCotisations.field("Assdouv").value * 3.0


2) 
    tblCotisations.DoubleField("Assdouv").value*3


-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the Valentina mailing list