[thelist] Re: thelist digest, Vol 1 #2558 - 43 msgs

Cam McVey cam_mcvey at hotmail.com
Wed Aug 21 01:02:30 CDT 2002


Hi Ken,

Just a quick overview:

You use CInt() to convert a variable into an integer.
You use Int() to return the integer portion of a number.

Subtle difference.

A variable of type 'Long' is a very large integer and would go beyond the
32,000+ barrier.
You would use CLng() to convert to a long.

However, you're not using integers at all (if you're dealing with a decimal
place) - you're dealing with floating-point numbers.

Use a type of Single which contains a single-precision, floating-point
number in the range -3.402823E38 to -1.401298E-45 for negative values;
1.401298E-45 to 3.402823E38 for positive values.

Use a type of Double which contains a double-precision, floating-point
number in the range -1.79769313486232E308 to -4.94065645841247E-324 for
negative values; 4.94065645841247E-324 to 1.79769313486232E308 for positive
values.

The functions to use would be CSng() - returns a type of Single; or CDbl()
which returns a Double.

Hope that helps.

Regards,
Cam

Cam McVey
http://mcvey.org/

----- Original Message -----
> Date: Tue, 20 Aug 2002 20:12:22 -0500
> From: Ken Kogler <ken.kogler at curf.edu>
> To: thelist at lists.evolt.org
> Subject: [thelist] ASP: cInt() VS int()
> Reply-To: thelist at lists.evolt.org
>
> I was using cInt() in an app I'm writing, but as soon as the number goes
> over the magical limit (36,000 and change), I get an overflow error. So
> I switched to int(), which can handle bigger numbers.
>
> But I just discovered that int() is dropping everything after the
> decimal. MSDN's docs say that it's designed to do that (another
> "feature" I guess), but I'm doing multiplication with currency, and I
> need the part after the decimal!
>
> Anyone know a way around this?
>
> --Ken
>
>
>
> --__--__--
>
> _______________________________________________
> Help: http://lists.evolt.org/mailman/listinfo/thelist
>
> Archives: http://lists.evolt.org
>
> End of thelist Digest
>



More information about the thelist mailing list