Page loading

Share your opinion
What do you think about gambaslinux.fr?
 
Interesting
It miss some informations
Excellent website
Results
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 !smile


Creation date : 09/10/2009 @ 18:30
Last update : 15/02/2022 @ 08:31
Category : ROUND
Page read 5550 times


Print the article Print the article


react.gifReactions to this article

Nobody gave a comment yet.
Be the first one to do it!


QUICK MENU
SEARCH




LANGUAGE
COMPONENTS
Other
LANGUAGE
Where, who?
VISITS

   visitors

   visitors online

ARCHIVES GAMBAS 1/2
^ Top ^