Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit001b805

Browse files
committed
8240624: Note mapping of RoundingMode constants to equivalent IEEE 754-2019 attribute
Reviewed-by: bpb
1 parent4a32eda commit001b805

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

‎src/java.base/share/classes/java/math/RoundingMode.java‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003,2017, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003,2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -87,6 +87,13 @@
8787
* ({@link BigDecimal#ROUND_UP}, {@link BigDecimal#ROUND_DOWN},
8888
* etc. ).
8989
*
90+
* @apiNote
91+
* Five of the rounding modes declared in this class correspond to
92+
* rounding direction attributes defined in the <cite>IEEE Standard
93+
* for Floating-Point Arithmetic</cite>, IEEE 754-2019. Where present,
94+
* this correspondence will be noted in the documentation of the
95+
* particular constant.
96+
*
9097
* @see BigDecimal
9198
* @see MathContext
9299
* @author Josh Bloch
@@ -130,6 +137,8 @@ public enum RoundingMode {
130137
* Rounding mode to round towards zero. Never increments the digit
131138
* prior to a discarded fraction (i.e., truncates). Note that this
132139
* rounding mode never increases the magnitude of the calculated value.
140+
* This mode corresponds to the IEEE 754-2019 rounding
141+
* attribute roundTowardZero.
133142
*
134143
*<p>Example:
135144
*<table class="striped">
@@ -159,6 +168,8 @@ public enum RoundingMode {
159168
* result is positive, behaves as for {@code RoundingMode.UP};
160169
* if negative, behaves as for {@code RoundingMode.DOWN}. Note
161170
* that this rounding mode never decreases the calculated value.
171+
* This mode corresponds to the IEEE 754-2019 rounding
172+
* attribute roundTowardPositive.
162173
*
163174
*<p>Example:
164175
*<table class="striped">
@@ -188,6 +199,8 @@ public enum RoundingMode {
188199
* result is positive, behave as for {@code RoundingMode.DOWN};
189200
* if negative, behave as for {@code RoundingMode.UP}. Note that
190201
* this rounding mode never increases the calculated value.
202+
* This mode corresponds to the IEEE 754-2019 rounding
203+
* attribute roundTowardNegative.
191204
*
192205
*<p>Example:
193206
*<table class="striped">
@@ -219,6 +232,8 @@ public enum RoundingMode {
219232
* fraction is &ge; 0.5; otherwise, behaves as for
220233
* {@code RoundingMode.DOWN}. Note that this is the rounding
221234
* mode commonly taught at school.
235+
* This mode corresponds to the IEEE 754-2019 rounding
236+
* attribute roundTiesToAway.
222237
*
223238
*<p>Example:
224239
*<table class="striped">
@@ -286,6 +301,8 @@ public enum RoundingMode {
286301
* chiefly used in the USA. This rounding mode is analogous to
287302
* the rounding policy used for {@code float} and {@code double}
288303
* arithmetic in Java.
304+
* This mode corresponds to the IEEE 754-2019 rounding
305+
* attribute roundTiesToEven.
289306
*
290307
*<p>Example:
291308
*<table class="striped">

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp