Round()
Syntaxe
Resultat.f(d) = Round(Nombre.f(d), Mode)Description
Arrondit un nombre flottant selon le mode choisi.
Arguments
Nombre.f ou Nombre.d Le nombre à virgule flottante (float ou double) Mode Peut prendre l'une des valeurs suivantes : #PB_Round_Down : Le nombre est arrondi par défaut. #PB_Round_Up : Le nombre est arrondi par excès. #PB_Round_Nearest: Le nombre est arrondi à l'entier le plus proche (0.5 est arrondi à 1)
Valeur de retour
Le nombre arrondi.
C'est un nombre à virgule flottante (float ou double)
Remarques
Pour transformer un nombre à virgule flottante en un entier sans arrondi, utiliser Int() ou IntQ().
Exemple
Debug Round(11.6, #PB_Round_Down) ; Affiche '11.0' Debug Round(-3.6, #PB_Round_Down) ; Affiche '-4.0' Debug Round(11.6, #PB_Round_Up) ; Affiche '12.0' Debug Round(-3.6, #PB_Round_Up) ; Affiche '-3.0' Debug Round(11.6, #PB_Round_Nearest) ; Affiche '12.0' Debug Round(11.4, #PB_Round_Nearest) ; Affiche '11.0' Debug Round(11.5, #PB_Round_Nearest) ; Affiche '12.0' Debug Round(-3.5, #PB_Round_Nearest) ; Affiche '-4.0'
Voir aussi
Int(), IntQ()
OS Supportés
Tous