Java decimal rounding and retention bit (iii) __J2SE technology

Source: Internet
Author: User

ROUND_UP: Round in the direction of the absolute value. The rounding bit is followed by a non 0 digit, carrying. (absolute value does not become smaller)

Round_down: Round in the direction of a small absolute value. The number of digits after the rounding bit, directly shed. (absolute value does not become larger)

Round_ceiling: Round up. Positive round_up, negative round_down.

Round_floor: Rounding down. Positive Round_down, negative round_up.

ROUND_HALF_UP: Number >=5,round_up after rounding bit

Round_half_down: Number <=5,round_down after rounding bit

Round_even: The number after rounding bit, 4 homes 6 into. 5 after the count (note 5 after a number is not 0 to carry); otherwise, look at the first, odd, carry, even discard.

such as 1.2401~1.25


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.