Data type conversions: advanced to low-level conversion possible problems and methods of obtaining different precision

Source: Internet
Author: User

The basic data types are from low to Advanced: (Byte,short,char)--int--long- - float -- Double

PS: The "level" here refers to the size of the range that represents the value.

--------------------------------------------------------------------------------------------------------------- --

For a double-precision real class,Doublevalue () can get its corresponding double-precision real variable, and intvalue () can get its corresponding integer variable.

This method can be used when fetching 123.45 (long) and 123 (int) of different types.

You also need to consider the question that the value should be in the range of two types, such as between 1 and 100, which must be in double and int

Data type conversions: advanced to low-level conversion possible problems and methods of obtaining different precision

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.