Simultaneous computation of cosine and sine

Yassine Damerdji yassine.damerdji at uliege.be
Fri Jan 30 17:21:30 UTC 2026


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20260130/736d3c82/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FdLibm.java
Type: text/x-java
Size: 133306 bytes
Desc: not available
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20260130/736d3c82/FdLibm-0001.java>


More information about the core-libs-dev mailing list