How to check if a number is integer or not
i want to know to check in a program if the user has entered an enteger number or not
5 réponses
-
Contributeur sécuritéHi zakaria, Blux, hi everyone,
Blux... here you are testing whether a number is even! if your number is 3, the test won't be right as
int(3/2)=1 is not equal to 3/2=1,5 however 3 is an integer !
The true test is:
int(number)=number then number is an integer!
@12C4
Ipl -
ModérateurHello !
if int(number/2)=number/2 then number is integer...
A+ Blux "Les cons, ça ose tout.
C'est même à ça qu'on les reconnait" -
Hi !!
Try "TypeName" in VB/VBA code (if applicable).... ;-)))
Wild and Free -
hello
int(100000)=100000 is right, but 100000 is not an integer, but a long... -
Pierre Fauconnier is rigth.
if(int(nb)=nb && nb <257) is an integer(signed)
:-))