C # collection of the entire function

Source: Internet
Author: User

 

C # The use of the entire function is a practical concept that we often encounter in actual development and application. How can we use C # to retrieve the entire function? First, we need to understand what is C # The use of the entire function and C # The use of the whole function.

C # example of using the entire function:

Math. Round is "rounded up nearby". When rounding 5, it is different from "Rounding 5" (taking an even number), for example:

    1. Math. Round (0.5, 0) = 0
    2.  Math. Round (1.5, 0) = 2
    3.  Math. Round (2.5, 0) = 2
    4.  Math. Round (3.5, 0) = 4
    5. Math. Ceiling (3.1) = 4;
    6. Math. Floor (3.9) = 3;

The day plate value has nothing to do with the floor value. In fact, the result of floor is the same as that of (INT), so you can also write math. Floor (double) 2/3 + 0.5)

C # Application Analysis of the entire function

Floor and ceil are functions in math unit. Uses math is required before use.

Trunc and round are functions in system unit and can be used by default.

The floor is directly retrieved from a small value, such as floor (-123.55) =-124, floor (123.55) = 123

Trunc cut down integers directly, such as trunc (-123.55) =-123, floor (123.55) = 123

Ceil is directly retrieved from large values, such as Ceil (-123.55) =-123, Ceil (123.55) = 124

Round calculates rounding, for example, round (-123.55) =-124, round (123.55) = 124

C # Use the integer function to get the whole instance up.

    1. Int A=5;
    2. Int B=2;
    3.  
    4. LBL. Text=Convert. tostring (math. Ceiling ((Double)/(Double) B ));

C # Here I will introduce you to the content related to the integer function. I hope it will be helpful for you to understand and learn the whole function of C.

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.