Hacker News new | ask | show | jobs
by jcranmer 2080 days ago
Look up the names of the functions in java.lang.Math. They are exactly the names and semantics used in the libm functions. Even down to the presence of the atan2 function which computes tan¯¹(y / x).

(You could also point out that JavaScript literally lifts java.lang.Math and java.util.Date into JS code as well, down to Date.getYear returning the Gregorian year - 1900).

2 comments

Almost completely irrelevant side note: atan2 is immensely useful because it actually does more than calculate the arctangent. It handles all the corner cases in converting a 2d vector to an angle. There's no chance of division by zero, it gets the answer into the correct quadrant automatically, and so on. Those things add up to an annoying series of if statements if all you have is an arctangent function.
First, this is not a 99% blatant copy. I see things on the java side that are not in the libm side, like addExact, IEEEremainder or nextDown. I see things on the libm side that are not in the java package, like fpclassify, gamma or jN. I see things that have been adapted to match java conventions, like copySign vs copysign. The Jaccard similarity index appears to be pretty far from 1, whereas it is a perfect 1 in the case of Google. The perfect 1, up to keeping the 'java' in 'java.*', makes it a 'blatant theft' in the case of Google.

Second, unclear what the legal status of libm is. It appears to implement a standard, thus is legitimate to ask whether the set of implemented functions and their names are the original contribution of libm authors, or are derived from the standards. Generally, if one wants to implement a standard, one needs to acquire the rights to do so, usually in the form of a reasonable fee.

Third, if there are significant overlapping parts that are the creative work of libm authors, and they can establish a prior art claim, they are entitled to seek fair compensation from Sun / Oracle.

https://docs.oracle.com/javase/8/docs/api/java/lang/Math.htm...

https://sourceware.org/newlib/libm.html

PS. Re: atan2, wikipedia: 'The function atan2(y,x) first appeared in the programming language Fortran (in IBM's implementation FORTRAN-IV in 1961). It was originally intended to return a correct and unambiguous value for the angle θ in converting from cartesian coordinates (x, y) to polar coordinates (r, θ).' Perfect example of a term that arguably migrates into the common technical vocabulary over decades.

>I see things on the libm side that are not in the java package, like fpclassify, gamma or jN.

Which were added in C99, which postdates the initial release of Java.