RFR: 8376223: Add modeling interfaces for algebraic structures: groups, rings, and fields

John R Rose jrose at openjdk.org
Fri Jan 23 22:30:52 UTC 2026


On Fri, 23 Jan 2026 19:50:49 GMT, Joe Darcy <darcy at openjdk.org> wrote:

> First cut at adding modeling interfaces for the algebraic structures of rings, groups, and fields.

Personally, I (as a lumper) usually lump together the following facts:
 - FP types have rounding errors
 - FP operators are never fully associative (because rounding order matters)
 - FP types have extended elements (NaN, -0.0, Inf, -Inf) which do not correspond to real numbers

I think all of these are aspects of the approximation process.  I think I can logically justify this stance, by observing that Inf is the approximation of various large real numbers, and also is added by div-closure (1/0), and then -Inf is added by neg-closure (-1/0), and then -0.0 is div-closure again (1/(-1/0)), and then NaN is added for various kinds of closure to cover junk like 0xInf.

Whether you believe the details of that to be relevant, I think it is a tenable user model to say, quite simply, that double is an approximation (for computation purposes) of the field of reals, and not worry that somebody will say "gotcha, I saw a NaN!"

For similar reasons, I believe that the fact that double has an order that is _almost_ but _not quite_ total is just another aspect of approximation.  The non-totality of the order comes from the addition of the extended elements.  (-0.0 spoils converse-reflexivity, and NaN spoils trichotomy.  But, given the decision to add those extended elements to the model, what would anyone expect?)

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

PR Comment: https://git.openjdk.org/valhalla/pull/1957#issuecomment-3792849462


More information about the valhalla-dev mailing list