Conversion from a floating point to an integer in C # and VB

Source: Internet
Author: User

Conversion from a floating point to an integer in C # and VB

 

/* C #
Int a1 = (INT) (3.22324); // 3
Int a2 = (INT) (3.82324); // 3
Int a3 = (INT) (-3.22324); // 3
Int A4 = (INT) (-3.82324); // 3

Int b1 = (INT) math. Round (3.22324); // 3
Int b2 = (INT) math. Round (3.82324); // 4
Int B3 = (INT) math. Round (-3.22324); //-3
Int B4 = (INT) math. Round (-3.82324); //-4

Int C1 = (INT) math. Ceiling (3.22324); // 4
Int C2 = (INT) math. Ceiling (3.82324); // 4
Int C3 = (INT) math. Ceiling (-3.22324); //-3
Int C4 = (INT) math. Ceiling (-3.82324); //-3

Int d1 = (INT) math. Floor (3.22324); // 3
Int D2 = (INT) math. Floor (3.82324); // 3
Int D3 = (INT) math. Floor (-3.22324); //-4
Int D4 = (INT) math. Floor (-3.82324); //-4
**/
/* Vb
A1 = int (3.22324); // 3
A2 = int (3.82324); // 3
A3 = int (-3.22324); //-4
A4 = int (-3.82324); //-4
**/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.