Skip to content

Conversation

jddarcy
Copy link
Member

@jddarcy jddarcy commented Oct 3, 2025

Upon further inspection, found a few more opportunities to refine the use of constants in the Float16 implementation.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8369123: Still more small Float16 refactorings (Enhancement - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/27625/head:pull/27625
$ git checkout pull/27625

Update a local copy of the PR:
$ git checkout pull/27625
$ git pull https://git.openjdk.org/jdk.git pull/27625/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 27625

View PR using the GUI difftool:
$ git pr show -t 27625

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/27625.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 3, 2025

👋 Welcome back darcy! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Oct 3, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot changed the title JDK-8369123: Still more small Float16 refactorings 8369123: Still more small Float16 refactorings Oct 3, 2025
@openjdk
Copy link

openjdk bot commented Oct 3, 2025

@jddarcy The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 3, 2025
@mlbridge
Copy link

mlbridge bot commented Oct 3, 2025

Webrevs

@eirbjo
Copy link
Contributor

eirbjo commented Oct 4, 2025

// Currently Float16 is a value-based class and in future it is

in the future

// IEEEremainder / remainder operator remainder

Would one remainder suffice for this remainder reminder?

private final short value;

Consider adding a field comment to align with Float, Double and friends.

private static final Float16 ZERO = valueOf(0);

Other private implementation constants in this class have comments. These would be rather obvious, but perheps we can consider adding them just for consistency?

Should we consider ordering private vs. public constants? Now they seem a bit mingled, making it harder for the eye to scan the public API of the class.

Line 372:

return new Float16((short)(sign_bit | 0x7c00));

0x7c00 here is EXP_BIT_MASK, right?

// toHexString, line 288:
return s.replaceFirst("p-1022$", "p-14");

Are we okay to invoke regex from such low level code?

@ExE-Boss
Copy link

ExE-Boss commented Oct 5, 2025

// IEEEremainder / remainder operator remainder

Would one remainder suffice for this remainder reminder?

IEEEremainder differs from the Java language remainder operator, due to the difference in rounding policy.


Refs:

@eirbjo
Copy link
Contributor

eirbjo commented Oct 5, 2025

// IEEEremainder / remainder operator remainder

IEEEremainder differs from the Java language remainder operator, due to the difference in rounding policy.

Thanks for providing context, it makes the sentence easier to understand. I now parse "remainder operator remainder" as "the remainder function as defined by JVM drem/frem bytecodes".

The comment seems a bit terse in its current form, more of a note-to-self reminder of future implementation ideas. Usually comments refer to current functionality, so this was sticking out to me as somewhat unusual. @jddarcy may have an opinion here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs [email protected] rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

3 participants