Rechercher : dans
Par :

How to check if a number is integer or not

Dernière réponse le 5 déc 2002 à 11:05:15 zakaria, le 28 oct 2002 à 21:15:32 
 Signaler ce message aux modérateurs

I want to know to check in a program if the user has entered an enteger number or not

Meilleures réponses pour « how to check if a number is integer or not » dans :
NSIS Error : de nombreux logiciels ne s'installent plus VoirNSIS Error The installer you are trying to use is corrupted or incomplete. This could be the result of a damaged disk, a failed download or a virus. You may want to contact the author of this installer to obtain a new copy. It may be possible...
SQL - Contraintes d'intégrité VoirExpression de contraintes d'intégrité Une contrainte d'intégrité est une clause permettant de contraindre la modification de tables, faite par l'intermédiaire de requêtes d'utilisateurs, afin que les données saisies dans la base soient...

1

blux, le 28 oct 2002 à 22:28:15

Hello !

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"

Répondre à blux

2

ipl, le 29 oct 2002 à 01:13:46

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

Répondre à ipl

5

blux, le 29 oct 2002 à 13:44:15

Yes, you're right...
sorry, I was tired...

A+ Blux            "Les cons, ça ose tout.
C'est même à ça qu'on les reconnait"

Répondre à blux

3

WhiteFang, le 29 oct 2002 à 06:38:53

Hi !!
Try "TypeName" in VB/VBA code (if applicable).... ;-)))
Wild and Free

Répondre à WhiteFang

4

Teebo, le 29 oct 2002 à 07:39:58

Well, you test the type, even if it should works, this is not really a thing to do...and our friend didn't tell whcih langage he was using...bad boy ;-)))

Répondre à Teebo

6

Pierre Fauconnier, le 4 déc 2002 à 22:00:49

Hello

int(100000)=100000 is right, but 100000 is not an integer, but a long...

Répondre à Pierre Fauconnier

8

teebo, le 5 déc 2002 à 11:04:38

Well, depends what you call an integer, when I was a child I learned at school that 351458486956136896548746584 was an integer as well as 1...
Why should computer change the tausends years old reality?

ö,ö  "Il est plus facile de donner des conseils
\_/    que de les appliquer"

Répondre à teebo

7

jojo, le 5 déc 2002 à 10:24:37

Pierre Fauconnier is rigth.
if(int(nb)=nb && nb <257) is an integer(signed)
:-))

Répondre à jojo

9

 teebo, le 5 déc 2002 à 11:05:15

Why do you automaticaly switch to the computer defined integer, use a dictionnary!

ö,ö  "Il est plus facile de donner des conseils
\_/    que de les appliquer"

Répondre à teebo
Collection CommentÇaMarche.net