Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need Round UP Command
Message
 
À
08/10/2001 07:03:01
Mark Hall
Independent Developer & Voip Specialist
Keston, Kent, Royaume Uni
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00564838
Message ID:
00565525
Vues:
18
>
>ROUND( nValue + 0.5)
>
>Will always round up.

Unless nValue is already an integer -- such as 4.0. The ROUND of (4.0+0.5) is 5.0, which I doubt is desirable in this case. You might instead want to go with 0.49 (if that precision is close enough), or use an IIF() statement. (Yes, I know the problems with IIF()s in VB but in this case I doubt that the performance hit will be a real problem:)

ROUND(IIF(ROUND(nValue,0) = nValue, nValue, nValue + 0.5))
The whole problem with the world is that fools and fanatics are always so certain of themselves, but wiser people so full of doubts. - Bertrand Russell
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform