On Sat, 31 Jan 2026 23:14:35 GMT, Joe Darcy <[email protected]> wrote:

> > Just curious, are we planning to experience with a more generic polynomial 
> > that takes an eligible numerical type, like ones that take float or 
> > textbook imaginary?
> 
> Yes, long-term that is a possibility -- that was part of the motivation for 
> naming the class "PolynomialDouble" rather than just "Polynomial." 
> Conceptually, `Polynomial<N extends Numeric>` would make sense, perhaps with 
> some mild side-conditions on Numerics.

A bit more detail, the add/subtract operations on a polynomial use the 
add/subtract/negate operations on the type of the coefficient.  Polynomial 
multiply uses add/subtract/negate/multiply on the type of the coefficient.

Therefore, hypothetically `instantiating Polynomial<SomeRing>` would work fine 
for polynomial add, subtract, and multiply. (An implementation of 
"`Polynomial<double>`" more sophisticated than this prototype would want to use 
a more accurate summation technique to compute the coefficients of a polynomial 
product.)

For polynomial division, looks like the coefficients to be a field (or field 
like) so that dividing the coefficient values yields a single value that can be 
used for more computations.

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

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

Reply via email to