RFR: [type-classes] JDK-8376823: Add prototype polynomial class [v2]

Joe Darcy darcy at openjdk.org
Sat Jan 31 19:17:53 UTC 2026


On Fri, 30 Jan 2026 20:04:04 GMT, Joe Darcy <darcy at openjdk.org> wrote:

>> Add a simple polynomial class over doubles as an example of a ring.
>
> Joe Darcy has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Updates.

Pushed an implementation for divide and remainder:


jshell> PolynomialDouble p = PolynomialDouble.valueOf(1, 1, 2);
p ==> (2.0*x^2 + x + 1.0)

jshell> PolynomialDouble q = PolynomialDouble.valueOf(1, 1, 0, 4);
q ==> (4.0*x^3 + x + 1.0)

jshell> p / q
$3 ==> 0.0

jshell> p % q
$4 ==> (2.0*x^2 + x + 1.0)

jshell> q / p
$5 ==> (2.0*x + -1.0)

jshell> q % p
$6 ==> 2.0

-------------

PR Comment: https://git.openjdk.org/valhalla/pull/2004#issuecomment-3829116988


More information about the valhalla-dev mailing list