RFR: 8376040: Add prototype "textbook complex" class

Raffaello Giulietti rgiulietti at openjdk.org
Thu Jan 22 11:02:11 UTC 2026


On Thu, 22 Jan 2026 00:35:05 GMT, Joe Darcy <darcy at openjdk.org> wrote:

> First cut at a version of complex numbers using the textbook algorithms for the arithmetic operations. This version is intended for prototyping and _not_ for production use.

src/java.base/share/classes/java/lang/ComplexTextbook.java line 116:

> 114:     public double imag() { // better as a static method?
> 115:         return imag;
> 116:     }

Besides being shorter and unambiguous, `re()` and `im()` are the standard names used in maths AFAIK.

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/1942#discussion_r2716403264


More information about the valhalla-dev mailing list