Java.math.RoundingMode several parameters detailed

Source: Internet
Author: User

Java.math.RoundingMode inside there are a few parameters make me a bit dizzy, now with a personal understanding of its summary:

To get a better understanding, we can draw an XY axis

Roundingmode.ceiling: Take the nearest integer to the right

Roundingmode.down: Remove the decimal part of the rounding, that is, positive to the left, negative numbers to the right, equivalent to the origin of the direction near the rounding

Roundingmode.floor: Take the nearest positive number to the left

Roundingmode.half_down: Five house six, negative number first to take the absolute value and then five six into the negative

ROUNDINGMODE.HALF_UP: Rounding, negative principle ibid.

Roundingmode.half_even: This comparison, the integer digits if the odd number is rounded, if even the five six into

Java.math.RoundingMode several parameters detailed

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.