Share your opinion
WIDGETS GAMBAS
GAMBAS 3 SOFTWARES
TUTORIALS
Library
|
ROUND - ROUND command
ROUND INSTRUCTION
When you do a complex calcul, you have a lot of decimals after the point. It's possible to troncate the result to have 2 or 3 significant numbers when you use the ROUND command. Here the syntax touse this instruction : Round ( variable, number + or - significant who troncate) Example : PUBLIC SUB mensualite() DIM duree AS Integer DIM periode AS Integer DIM taux AS Float DIM montant AS Integer DIM tm AS Float DIM mensualite AS Float montant = 10000 taux = 0.05 duree = 60 periode = 12 '12 mensualité par an tm = (1 + taux) ^ (1 / periode) mensualite = Round(montant * (tm - 1) / (1 - (tm) ^ - (duree)), -10) Message.Info("la mensualité est de " & mensualite) END RESULT = 186,0201907093 Remplace -10 by -2 RESULT= 186.02 Remplace -2 by 2 RESULT = 200 That'all folk ! Creation date : 09/10/2009 @ 18:30 Reactions to this article
| QUICK MENU
SEARCH
LANGUAGE
COMPONENTS
Other
LANGUAGE
Where, who?
VISITS
visitors visitors online ARCHIVES GAMBAS 1/2
|