Tuesday, September 14, 2010

VBScript CLng function



CInt function

Back to the expression, this expression has been converted to Integer subtype Variant.

CInt (expression)

expression argument is any valid expression.

Explain
Usually, you can use the subtype conversion functions to write code to display the results of certain operations should be expressed as a specific data type, instead of the default type. For example, in the event of currency, single-precision or double precision arithmetic of the situation, use CInt or CLng to enforce integer.

CInt function used for other data types to Integer from the sub-types of internationally recognized format. Such as the decimal separator (such as 1000 sub-Fu) identification, may depend on the system locale.

If the expression in the Integer subtype outside the acceptable range, then an error occurs.

The following examples use CInt function to convert the value to Integer:

Dim MyDouble, MyIntMyDouble = 2345.5678''MyDouble is Double. MyInt = CInt (MyDouble)''MyInt contains 2346.
Note that different from the Fix and Int functions CInt remove the fractional part of value, but with rounded way. When the fractional part of exactly equal to 0.5, CInt always be the number rounded to the nearest even number. For example, 0.5 rounded to 0, and 1.5 rounded to 2.

CLng function

Back to the expression, this expression has been converted to Long subtype of Variant.

CLng (expression)

expression argument is any valid expression.

Explain
Usually, you can use the sub-type data conversion functions to write code to display the results of certain operations should be expressed as a specific data type, rather than the default data type. For example, in the event of currency operations, single-precision or double precision arithmetic case, use CInt or CLng to force integer arithmetic functions.

CLng function is used for the data type to Long from other sub-types of the internationally recognized format. For example, the decimal separator and thousands separator system identification depends on the locale.

If the expression values of sub-type Long is not allowed within the error occurs.

The following examples use CLng function to convert the value Long:

Dim MyVal1, MyVal2, MyLong1, MyLong2MyVal1 = 25427.45: MyVal2 = 25427.55''MyVal1, MyVal2 is the double value. MyLong1 = CLng (MyVal1)''MyLong1 25427. MyLong2 = CLng (MyVal2)''MyLong2 contains 25 428.
Note CLng function different from the Fix and Int remove the fractional part, but with rounded way. When the fractional part of exactly equal to 0.5, CLng function always be the number rounded to the nearest even number. For example, 0.5 rounded to 0, and 1.5 rounded to 2.







Recommended links:



The SMTP User Authentication Based On QMail Setup Guide (Part Two)



mts Format



Ps3 Wmv



Guide E-Mail Clients



What Is Digital TV Renovation Project?



Compilation of various source - col



Borrow money To make money doing business



Adobe GoLive has pushed for Dreamweaver where to go



Lists Automation Tools



C # and Object-oriented programming language [1]



Light: Cold Chain Dancer



Talent ON: A New Maxima



Ps3 Rmvb



Convert youtube to mpg



No comments:

Post a Comment