Discussion about Java Floating Point?

2022-03-14 Thread A Z
To core-libs-dev@openjdk.java.net, In terms of floating point, it seems there are thus three (3) phenomena that are relevant. 1) Arithmetic on float and double, via operators. 2) Elementary function calls, namely those made from java.lang.StrictMath, as it is, on double values. 3) Compariso

Re: RFR: 8282162: [vector] Optimize vector negation API

2022-03-14 Thread Xiaohong Gong
On Tue, 15 Mar 2022 02:39:42 GMT, Joe Darcy wrote: > Note that in terms of Java semantics, negation of floating point values needs > to be implemented as subtraction from negative zero rather than positive zero: > > double negate(double arg) {return -0.0 - arg; } > > This is to handle signed z

Re: RFR: 8282162: [vector] Optimize vector negation API

2022-03-14 Thread Joe Darcy
On Fri, 11 Mar 2022 06:29:22 GMT, Xiaohong Gong wrote: > The current vector `"NEG"` is implemented with substraction a vector by zero > in case the architecture does not support the negation instruction. And to > fit the predicate feature for architectures that support it, the masked > vector

Re: RFR: JDK-8283143: Use minimal-length literals to initialize PI and E constants

2022-03-14 Thread Stuart Marks
On Tue, 15 Mar 2022 01:36:14 GMT, Joe Darcy wrote: > Depending on the range of the number line, a double value has between 15 and > 17 digits of decimal precision. The literals used to initialize Math.PI and > Math.E have several digits more precision than that maximum. > > That is potentially

Re: RFR: JDK-8283124: Add constant for tau to Math and StrictMath [v2]

2022-03-14 Thread Iris Clark
On Mon, 14 Mar 2022 23:21:26 GMT, Joe Darcy wrote: >> Add a constant for tau, 2*pi, to Math and StrictMath. Since 2*pi is a very >> common value in mathematical formulas, it is helpful to give it a distinct >> constant. >> >> Please also review the CSR https://bugs.openjdk.java.net/browse/JDK-

Re: RFR: 8267319: Use larger default key sizes and algorithms based on CNSA [v5]

2022-03-14 Thread Valerie Peng
On Mon, 14 Mar 2022 21:08:30 GMT, Weijun Wang wrote: >> Valerie Peng has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Update again and undo DSA changes > > src/java.base/share/classes/sun/security/util/SecurityProviderConstants.java > li

RFR: JDK-8283143: Use minimal-length literals to initialize PI and E constants

2022-03-14 Thread Joe Darcy
Depending on the range of the number line, a double value has between 15 and 17 digits of decimal precision. The literals used to initialize Math.PI and Math.E have several digits more precision than that maximum. That is potentially confusing to readers of the code and the minimum length strin

Re: RFR: 8279598: Provide adapter from RandomGenerator to Random [v17]

2022-03-14 Thread Stuart Marks
On Sat, 12 Mar 2022 01:26:24 GMT, Yasser Bazzi wrote: >> Hi, could i get a review on this implementation proposed by Stuart Marks, i >> decided to use the >> https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/random/RandomGenerator.html >> interface to create the default me

Re: RFR: 8282162: [vector] Optimize vector negation API

2022-03-14 Thread Xiaohong Gong
On Fri, 11 Mar 2022 06:29:22 GMT, Xiaohong Gong wrote: > The current vector `"NEG"` is implemented with substraction a vector by zero > in case the architecture does not support the negation instruction. And to > fit the predicate feature for architectures that support it, the masked > vector

Re: RFR: JDK-8236128: Allow jpackage create installers for services

2022-03-14 Thread Alexander Matveev
On Fri, 11 Mar 2022 23:37:06 GMT, Alexey Semenyuk wrote: > Implementation of [JDK-8275062: "Allow jpackage create installers for > services"](https://bugs.openjdk.java.net/browse/JDK-8275062) > CSR Marked as reviewed by almatvee (Reviewer). - PR: https://git.openjdk.java.net/jdk/

Re: RFR: JDK-8283124: Add constant for tau to Math and StrictMath

2022-03-14 Thread Joseph D. Darcy
Hi Raffaello, With changing TAU to be set to 2.0 * PI, I'll file a follow-up bug to use the least-precision decimal values that will get rounded to PI and E, respectively, in Math and StrictMath. (Per the general base conversion properties for the double format, there will be between 15 and 1

Re: RFR: JDK-8283124: Add constant for tau to Math and StrictMath [v2]

2022-03-14 Thread Joe Darcy
> Add a constant for tau, 2*pi, to Math and StrictMath. Since 2*pi is a very > common value in mathematical formulas, it is helpful to give it a distinct > constant. > > Please also review the CSR https://bugs.openjdk.java.net/browse/JDK-8283136 Joe Darcy has updated the pull request incrementa

Re: RFR: JDK-8283124: Add constant for tau to Math and StrictMath

2022-03-14 Thread Joe Darcy
On Mon, 14 Mar 2022 20:52:39 GMT, Joe Darcy wrote: > Add a constant for tau, 2*pi, to Math and StrictMath. Since 2*pi is a very > common value in mathematical formulas, it is helpful to give it a distinct > constant. > > Please also review the CSR https://bugs.openjdk.java.net/browse/JDK-82831

Re: RFR: 8253495: CDS generates non-deterministic output [v6]

2022-03-14 Thread Calvin Cheung
On Fri, 11 Mar 2022 06:55:23 GMT, Ioi Lam wrote: >> This patch makes the result of "java -Xshare:dump" deterministic: >> - Disabled new Java threads from launching. This is harmless. See comments >> in jvm.cpp >> - Fixed a problem in hashtable ordering in heapShared.cpp >> - BasicHashtableEntry

Re: RFR: JDK-8283124: Add constant for tau to Math and StrictMath

2022-03-14 Thread Raffaello Giulietti
Right, and PI with 16 digits (or 17). On 3/14/22 22:51, Hans Boehm wrote: Couldn't the apiNote just say TAU == 2 * PI instead? I think the fact that this is actually a guaranteed floating point equality aids clarity. On Mon, Mar 14, 2022 at 2:33 PM Raffaello Giulietti mailto:raffaello.giul

Re: RFR: JDK-8283075: Bad IllegalArgumentException message when calling ClassDesc.arrayType(int) which results in a rank > 255 [v2]

2022-03-14 Thread Vicente Romero
On Mon, 14 Mar 2022 21:27:29 GMT, Joe Darcy wrote: >> Improving the exception messages for out-of-supported-range array types. >> >> I'll update copyrights before pushing. > > Joe Darcy has updated the pull request incrementally with one additional > commit since the last revision: > > Respo

Re: RFR: 8280400: JDK 19 L10n resource files update - msgdrop 10 [v3]

2022-03-14 Thread Naoto Sato
On Mon, 14 Mar 2022 20:39:46 GMT, Alisen Chung wrote: >> msg drop for jdk19, Mar 9, 2022 > > Alisen Chung has updated the pull request incrementally with one additional > commit since the last revision: > > removed repeated lines from ROOT bundle in CurrencyNames src/jdk.compiler/share/class

Re: RFR: JDK-8283124: Add constant for tau to Math and StrictMath

2022-03-14 Thread Raffaello Giulietti
Hello, I find it a bit disturbing that PI is specified with 21 digits whereas TAU has 16. I think that specifying PI as public static final double PI = 3.141592653589793; doesn't harm anybody and makes it visually more consistent with TAU- Greetings Raffaello On 3/14/22 22:13, Brian Bu

Re: RFR: 8267319: Use larger default key sizes and algorithms based on CNSA [v5]

2022-03-14 Thread Weijun Wang
On Mon, 14 Mar 2022 20:08:31 GMT, Valerie Peng wrote: >> It's been several years since we increased the default key sizes. Before >> shifting to PQC, NSA replaced its Suite B cryptography recommendations with >> the Commercial National Security Algorithm Suite which suggests: >> >> - SHA-384 f

Re: RFR: JDK-8283075: Bad IllegalArgumentException message when calling ClassDesc.arrayType(int) which results in a rank > 255 [v2]

2022-03-14 Thread Joe Darcy
> Improving the exception messages for out-of-supported-range array types. > > I'll update copyrights before pushing. Joe Darcy has updated the pull request incrementally with one additional commit since the last revision: Respond to review feedback. - Changes: - all: https://

Re: RFR: JDK-8283124: Add constant for tau to Math and StrictMath

2022-03-14 Thread Brian Burkhalter
On Mon, 14 Mar 2022 20:52:39 GMT, Joe Darcy wrote: > Add a constant for tau, 2*pi, to Math and StrictMath. Since 2*pi is a very > common value in mathematical formulas, it is helpful to give it a distinct > constant. > > Please also review the CSR https://bugs.openjdk.java.net/browse/JDK-82831

RFR: JDK-8283124: Add constant for tau to Math and StrictMath

2022-03-14 Thread Joe Darcy
Add a constant for tau, 2*pi, to Math and StrictMath. Since 2*pi is a very common value in mathematical formulas, it is helpful to give it a distinct constant. Please also review the CSR https://bugs.openjdk.java.net/browse/JDK-8283136 - Commit messages: - JDK-8283124: Add constan

Re: RFR: 8280400: JDK 19 L10n resource files update - msgdrop 10 [v3]

2022-03-14 Thread Alisen Chung
> msg drop for jdk19, Mar 9, 2022 Alisen Chung has updated the pull request incrementally with one additional commit since the last revision: removed repeated lines from ROOT bundle in CurrencyNames - Changes: - all: https://git.openjdk.java.net/jdk/pull/7765/files - new: htt

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v15]

2022-03-14 Thread Roger Riggs
On Wed, 9 Mar 2022 23:59:32 GMT, Claes Redestad wrote: >> I'm requesting comments and, hopefully, some help with this patch to replace >> `StringCoding.hasNegatives` with `countPositives`. The new method does a >> very similar pass, but alters the intrinsic to return the number of leading >> b

Re: RFR: JDK-8283075: Bad IllegalArgumentException message when calling ClassDesc.arrayType(int) which results in a rank > 255

2022-03-14 Thread Vicente Romero
On Mon, 14 Mar 2022 19:56:17 GMT, Joe Darcy wrote: > Improving the exception messages for out-of-supported-range array types. > > I'll update copyrights before pushing. src/java.base/share/classes/java/lang/constant/ClassDesc.java line 186: > 184: if (rank <= 0 || netRank > > Constant

Re: RFR: 8267319: Use larger default key sizes and algorithms based on CNSA [v5]

2022-03-14 Thread Valerie Peng
> It's been several years since we increased the default key sizes. Before > shifting to PQC, NSA replaced its Suite B cryptography recommendations with > the Commercial National Security Algorithm Suite which suggests: > > - SHA-384 for secure hashing > - AES-256 for symmetric encryption > - RS

RFR: JDK-8283075: Bad `IllegalArgumentException` message when calling `ClassDesc.arrayType(int)` which results in a rank > 255

2022-03-14 Thread Joe Darcy
Improving the exception messages for out-of-supported-range array types. I'll update copyrights before pushing. - Commit messages: - Appease jcheck - Update @bug line of test - JDK-8283075: Bad `IllegalArgumentException` message when calling `ClassDesc.arrayType(int)` which resul

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v15]

2022-03-14 Thread Claes Redestad
On Wed, 9 Mar 2022 23:59:32 GMT, Claes Redestad wrote: >> I'm requesting comments and, hopefully, some help with this patch to replace >> `StringCoding.hasNegatives` with `countPositives`. The new method does a >> very similar pass, but alters the intrinsic to return the number of leading >> b

Re: RFR: JDK-8266431: Dual-Pivot Quicksort improvements (Radix sort) [v12]

2022-03-14 Thread iaroslavski
> Sorting: > > - adopt radix sort for sequential and parallel sorts on int/long/float/double > arrays (almost random and length > 6K) > - fix tryMergeRuns() to better handle case when the last run is a single > element > - minor javadoc and comment changes > > Testing: > - add new data inputs i

Integrated: 8283049: Fix non-singleton LoggerFinder error message: s/on/one

2022-03-14 Thread Carter Kozak
On Thu, 10 Mar 2022 22:28:14 GMT, Carter Kozak wrote: > 8283049: Fix non-singleton LoggerFinder error message: s/on/one This pull request has now been integrated. Changeset: 70bd57ed Author:Carter Kozak Committer: Daniel Fuchs URL: https://git.openjdk.java.net/jdk/commit/70bd57ed35

Re: RFR: 8280400: JDK 19 L10n resource files update - msgdrop 10 [v2]

2022-03-14 Thread Alexander Zuev
On Thu, 10 Mar 2022 17:55:44 GMT, Alisen Chung wrote: >> msg drop for jdk19, Mar 9, 2022 > > Alisen Chung has updated the pull request incrementally with one additional > commit since the last revision: > > moved CurrencyNames changes to jdk.localedata Marked as reviewed by kizune (Reviewer)

Re: RFR: 8283049: Fix non-singleton LoggerFinder error message: s/on/one [v2]

2022-03-14 Thread Daniel Fuchs
On Fri, 11 Mar 2022 19:18:55 GMT, Carter Kozak wrote: >> 8283049: Fix non-singleton LoggerFinder error message: s/on/one > > Carter Kozak has updated the pull request incrementally with one additional > commit since the last revision: > > Add 8283049 to LoggerFinderLoaderTest @bug docs Marke

Re: Behavior change in the jar tool JDK11 vs JDK8.

2022-03-14 Thread Alan Bateman
On 14/03/2022 11:48, Pasam Soujanya1 wrote: There is a significant difference in the way the JAR tool (starting JDK11) seems to be responding to target files that are not present , when compared to JDK8. With JDK 8, the jar tool just reports about target files that are absent, and creates the

Re: Behavior change in the jar tool JDK11 vs JDK8.

2022-03-14 Thread Remi Forax
- Original Message - > From: "Pasam Soujanya1" > To: "core-libs-dev" > Sent: Monday, March 14, 2022 12:48:42 PM > Subject: Behavior change in the jar tool JDK11 vs JDK8. > There is a significant difference in the way the JAR tool (starting JDK11) > seems > to be responding to target fil

Re: RFR: 8280400: JDK 19 L10n resource files update - msgdrop 10 [v2]

2022-03-14 Thread Alisen Chung
On Thu, 10 Mar 2022 18:56:41 GMT, Chris Plummer wrote: >> Alisen Chung has updated the pull request incrementally with one additional >> commit since the last revision: >> >> moved CurrencyNames changes to jdk.localedata > > src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResourc

Re: RFR: 8282407: Missing ')' in MacResources.properties

2022-03-14 Thread Naoto Sato
On Sat, 12 Mar 2022 03:12:30 GMT, Alexander Matveev wrote: > - Fixed by adding missing ']'. > - I changed '()' to '[]', since other error messages use '[]' and not '()'. It is OK as it stands, but usually localized files are provided by the l10n process, so engineers only need to modify the b

Integrated: 8282929: Localized monetary symbols are not reflected in `toLocalizedPattern` return value

2022-03-14 Thread Naoto Sato
On Fri, 11 Mar 2022 19:53:20 GMT, Naoto Sato wrote: > `DecimalFormat.toLocalizedPattern()` was not honoring the monetary > decimal/grouping separator symbols. Fix is straightforward to use the correct > symbols depending on the formatter type. This pull request has now been integrated. Change

Behavior change in the jar tool JDK11 vs JDK8.

2022-03-14 Thread Pasam Soujanya1
There is a significant difference in the way the JAR tool (starting JDK11) seems to be responding to target files that are not present , when compared to JDK8. With JDK 8, the jar tool just reports about target files that are absent, and creates the jar file with whatever targets are available.

Re: RFR: 8283067: Incorrect comment in java.base/share/classes/java/util/ArrayList.java

2022-03-14 Thread Stuart Marks
On Sat, 12 Mar 2022 09:48:14 GMT, xpbob wrote: > * Constructs an empty list with an initial capacity of ten > > => > > * Constructs an empty list with default sized empty instances. > > > private static final Object[] DEFAULTCAPACITY_EMPTY_ELEMENTDATA = {}; > > DEFAULTCAPACITY_EMPTY_ELEMEN

Integrated: 8058924: FileReader(String) documentation is insufficient

2022-03-14 Thread Brian Burkhalter
On Thu, 10 Mar 2022 02:30:35 GMT, Brian Burkhalter wrote: > Add a statement to the `java.io` package documentation clarifying how a > `String` representing a _pathname string_ is interpreted in the package. This pull request has now been integrated. Changeset: 13cebffe Author:Brian Burkhal

Re: RFR: 4511638: Double.toString(double) sometimes produces incorrect results [v6]

2022-03-14 Thread Raffaello Giulietti
On Tue, 8 Feb 2022 22:11:34 GMT, Raffaello Giulietti wrote: >> Hello, >> >> here's a PR for a patch submitted on March 2020 >> [1](https://cr.openjdk.java.net/~bpb/4511638/webrev.04/) when Mercurial was >> a thing. >> >> The patch has been edited to adhere to OpenJDK code conventions about

Re: RFR: 8279508: Auto-vectorize Math.round API [v15]

2022-03-14 Thread Jatin Bhateja
On Mon, 14 Mar 2022 09:29:28 GMT, Andrew Haley wrote: >> Good suggestion, but as of now we are not using vector calling conventions >> for stubs. > > I don't understand this comment. If the stub is only to be used by you, then > you can determine your own calling convention. We are passing mix

Re: RFR: 8279508: Auto-vectorize Math.round API [v17]

2022-03-14 Thread Tobias Hartmann
On Sun, 13 Mar 2022 06:36:15 GMT, Jatin Bhateja wrote: >> Summary of changes: >> - Intrinsify Math.round(float) and Math.round(double) APIs. >> - Extend auto-vectorizer to infer vector operations on encountering scalar >> IR nodes for above intrinsics. >> - Test creation using new IR testing fra

Re: Questions about enhancement and Correction to Java OpenJDK Floating Point?

2022-03-14 Thread Raffaello Giulietti
Hi Terry, as pointed out by Martin, the real issue is using *binary* floating-point arithmetic, like float or double, to emulate *decimal* arithmetic. When you write 0.1D in Java, C or C++, what happens is that this decimal number is rounded to the double closest to the mathematical value 1/

Re: RFR: 8279508: Auto-vectorize Math.round API [v15]

2022-03-14 Thread Andrew Haley
On Sun, 13 Mar 2022 04:27:25 GMT, Jatin Bhateja wrote: >> src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp line 4024: >> >>> 4022: * the result is equal to the value of Integer.MAX_VALUE. >>> 4023: */ >>> 4024: void >>> C2_MacroAssembler::vector_cast_float_special_cases_avx(XMMRegister dst, >>>

Re: Questions about enhancement and Correction to Java OpenJDK Floating Point?

2022-03-14 Thread Martin Desruisseaux
Hello A.Z As far as I know, the difference in output that you observed between Java and C/C++ is not caused by a difference in floating-point computation, but in a difference in the way numbers are rounded by the "printf" command. Java has a policy of showing all significant digits, while C "

Re: Questions about enhancement and Correction to Java OpenJDK Floating Point?

2022-03-14 Thread Remi Forax
- Original Message - > From: "A Z" > To: "core-libs-dev" > Sent: Monday, March 14, 2022 7:49:04 AM > Subject: Questions about enhancement and Correction to Java OpenJDK Floating > Point? Hi Terry, if you want to have the same output as C, instead of println() use printf(). In your exam