Page 1 of 1

FormatNumber always display 2 decimals even for integer

Posted: Wed Apr 15, 2020 1:12 pm
by Marc56us
As 'NbDecimals' is optional, it would be logical that in the absence of this parameter there are no decimals displayed (if integer) and not two as is currently the case.

Code: Select all

Debug FormatNumber(125400.25) ; Will display: 125,400.25
Debug FormatNumber(125400)    ; Will display: 125,400.00 ; .00 not needed
Debug FormatNumber(125400, 0) ; Will display: 125,400    ; is OK but need to add parameter
-- Fr
Comme "NbDecimals" est facultatif, il serait logique qu'en l'absence de ce paramètre, pour un entier, aucune décimale ne soit affichée et non deux comme c'est le cas actuellement.

Re: FormatNumber always display 2 decimals even for integer

Posted: Wed Apr 15, 2020 1:43 pm
by ChrisR
hmm, not sure, FormatNumber seems to use the system default value
In windows, it's stored in the registry, here:
HKCU\Control Panel \International,iDigits (default value : 2)
iDigits = Number of digits after the dot in decimal values.