Simultaneous computation of cosine and sine

Raffaello Giulietti raffaello.giulietti at oracle.com
Fri Jan 30 20:43:43 UTC 2026


Dear Yassine,

you proposal would be a welcome addition.

To contribute to the OpenJDK, you or your employer would need to sign the Oracle Contributor Agreement (OCA) [1].
I recommend you read the first 2 or 3 sections of the OpenJDK Developers’ Guide [2] for the details before submitting any patch.


HTH
Raffaello Giulietti

----

[1] https://oca.opensource.oracle.com
[2] https://openjdk.org/guide

________________________________________
From: core-libs-dev <core-libs-dev-retn at openjdk.org> on behalf of Yassine Damerdji <yassine.damerdji at uliege.be>
Sent: Friday, January 30, 2026 18:21
To: core-libs-dev at openjdk.org
Subject: Simultaneous computation of cosine and sine

Dear all,

I am a scientist and a Java developer in the ESA/DPAC consortium (https://www.cosmos.esa.int/web/gaia/dpac).

I downloaded FdLibm.java from the Open-JDK project, and I wrote a function which computes simultaneously the cosine and sine of an angle. Indeed, in science we very often need both of the cosine and the sine in our computations.

I noticed that we can save 25% of the processing time compared to two separate calls to the cos and sin functions. The reason for this is that we won't repeat the common function they share.

My local tests were missing the JDK '@stable' annotation, which optimizes a lot and is not possible to keep in my local tests.

It would be great if we could include the new function in the official OpenJDK project.

I attach my local version of FdLibm.java (without @stable annotations) including the class SinCos (line 2483).

Many thanks in advance,

Yassine

PS : Mr Ivanov redirected me to this mailing list.


More information about the core-libs-dev mailing list