desimal numbers calculation

Jan Schenkel janschenkel at yahoo.com
Mon Oct 14 07:02:01 EDT 2002


--- Esa_Kivelä <Esa.Kivela at ncrc.fi> wrote:
> Greetings
> 
> Some newbie question:
> 
> I tried to calculate desimal numbers in RR but how
> can code some calculation. 
>  
> In the card I have some text filed where users put
> some numbers like 0,5, 3,4 and so on. 
>  
> In some field I'd like to show those fields result
> as ie. 0,5 + 3,4 and so on but that + operator in
> the script won't calculate desimal numbers. 
>  
> Is there any other way to sum those desimal numbers?
> 
>  
> Yours 
>  
> EsaK 
>

Hi Esa,

RunRev expects numeric data to have a decimal point.
Therefore, you'll have to convert between 'display'
and 'calculation' format before and after calculation.
If you don't need thousand separators, then it's as
easy as:
  function Conv4Disp pNumber
    replace "." with "," in pNumber
    return pNumber
  end Conv4Disp
  function Conv4Calc pNumber
    replace "," with "." in pNumber
    return pNumber
  end Conv4Calc

Hope this helped,

Jan Schenkel.

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com



More information about the Use-livecode mailing list