On Mon, 2 Feb 2026 22:00:37 GMT, Joe Darcy <[email protected]> wrote:

> > Good that we are encapsulating degree with methods; might add a comment to 
> > indicate this intention, like no direct access for lazy fields.
> > Also, I noted we use (`this.`)`coeffs.length` a lot. How is it distinct 
> > from `deg()`? Hope we can clarify on that as well.
> > Otherwise, looks nice in concept.
> 
> The notion of "degree" is a polynomial concept while the length of the 
> backing array is an implementation artifact. With this data structure; degree 
> is _almost_ length - 1. The exception is a zero polynomial, which needs 
> special handling somehow since its degree is defined to not be 0 -- as would 
> be the case for any other constant polynomial -- but -1 (or sometimes 
> -infinity).
> 
> Writing this comment, this might tip my scales to internally use an empty 
> array to special case zero. That way, the degree would be one less than the 
> length is all cases.

Refactoring pushed; I'll go over this again on my own, but will likely push a 
variation of this later today. Thanks for the helpful discussions.

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

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

Reply via email to