RFR: 8376040: Add prototype "textbook complex" class [v2]

Joe Darcy darcy at openjdk.org
Fri Jan 23 21:20:30 UTC 2026


On Thu, 22 Jan 2026 10:38:05 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:

>> Joe Darcy has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Respond to review comments, cleanup.
>
> src/java.base/share/classes/java/lang/ComplexTextbook.java line 195:
> 
>> 193:         } else {
>> 194:             return false;
>> 195:         }
> 
> Suggestion:
> 
>         return that instanceof ComplexTextbook c && real == c.real && imag == c.imag;

Done; I'll make any other necessary adjustments to the java.lang.Object methods when adding support for overloaded operators.

> src/java.base/share/classes/java/lang/ComplexTextbook.java line 393:
> 
>> 391:         double b = c.imag;
>> 392:         return StrictMath.hypot(a, b);
>> 393:     }
> 
> Since we have `abs()`, is there a reason for not having `theta()` (or `arg()`, or whatever)?

Those could be added in a subsequent iteration, sure.

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

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


More information about the valhalla-dev mailing list