Slide 39 of the slide deck [1] corresponding to the talk, gives a link

https://github.com/openjdk/valhalla/tree/type-classes/

to a Valhalla branch hosting numerical experiments with type classes [2]. Some of the numerical prototypes there predate JavaOne. One of the prototypes added after JavaOne was a BigRational type build on top of BigIntegers:

 
https://github.com/openjdk/valhalla/blob/type-classes/src/java.base/share/classes/java/math/BigRational.java

Note a "Fraction" type would be different from a "Rational" type since Fraction would presumably distinguish between "1/2" and "2/4" whereas a Rational type would normalize these to 1/2.

-Joe

[1] https://github.com/jddarcy/SpeakingArchive/blob/master/J1-2026-NumericalPaths.pdf

[2] https://github.com/openjdk/valhalla/compare/lworld...type-classes

On 8/2/2026 1:18 PM, David Alayachew wrote:
Hello @valhalla-dev <[email protected]>,

I just recently watched the video from JavaOne 2026 by Joe Darcy titled
"Paths to New Numeric Types on the Java Platform". Here is a link to it.

https://reddit.com/r/java/comments/1vdesc4/paths_to_new_numeric_types_on_the_java_platform/

My question is about Fractions.

The talk mentions that, if the mentioned features ever ship, we can expect
to see Float16, amongst others, added to the JDK. Might we see Fractions
join that list?

I attempted my own version of this, titled BigNumber. Simply put, it was a
class with a BigInteger numerator and a BigInteger denominator. Thus,
arbitrary precision until you need to cast/convert to another type. It was
a really pleasant alternative to BigDecimal.

Here is the class -- https://github.com/davidalayachew/BigNumber

I'm not at all proposing that my implementation is the right way to do it.
Furthermore, I can make my own if/when this feature drops. But I wanted to
ask if a fraction type like this might be added, as I suspect that this
would be a valuable tool for others too.

Thank you for your time and consideration.
David Alayachew


Reply via email to