int vs. cint?

E

ExcessAccess

What is the difference between:
iif([fieldname]<0,0,cint([fieldname]))
and
iif([fieldname]<0,0,int([fieldname]))
Thanks in advance for any clarification!

~J
 
B

Brian Camire

CInt returns an Integer variable. Values of Integer variables are limited
to the range from -32,768 to 32,767. So, for example, CInt(32768.1) will
return cause an overflow run-time error.

Int returns a Double variable. Doubles have a much (much, much) larger
range, from -1.79769313486231E308 to 1.79769313486232E308. So, for example,
Int(32768.1) returns 32678.

Also, CInt does not accept a Null argument, but Int does (in which case it
returns Null).
 
J

John Spencer (MVP)

PLUS CInt rounds numbers with decimal portion, while Int returns the number that
is the next smallest integer. Strip the decimal portion for Positive numbers
and for negative numbers gives the next number to the left on the number line.
Fix is similar but slightly different. Positives and negatives basically drop
the decimal portion.

Int(-5.25) returns -6; Int(5.25) returns 5

Brian said:
CInt returns an Integer variable. Values of Integer variables are limited
to the range from -32,768 to 32,767. So, for example, CInt(32768.1) will
return cause an overflow run-time error.

Int returns a Double variable. Doubles have a much (much, much) larger
range, from -1.79769313486231E308 to 1.79769313486232E308. So, for example,
Int(32768.1) returns 32678.

Also, CInt does not accept a Null argument, but Int does (in which case it
returns Null).

ExcessAccess said:
What is the difference between:
iif([fieldname]<0,0,cint([fieldname]))
and
iif([fieldname]<0,0,int([fieldname]))
Thanks in advance for any clarification!

~J
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top