News for hackers. Stuff that matters.
Re:Faster asin() was hiding in plain sight by exmadscientist on Wednesday March 11, 2026 @12:06PM (#47337404)
This line:

> This amazing snippet of code was languishing in the docs of dead software, which in turn the original formula was scrawled away in a math textbook from the 60s.

was kind of telling for me. I have some background in this sort of work (and long ago concluded that there was pretty much nothing you can do to improve on existing code, unless either you have some new specific hardware or domain constraint, or you're just looking for something quick-n-dirty for whatever reason, or are willing to invest research-paper levels of time and effort) and to think that someone would call Abramowitz and Stegun "a math textbook from the 60s" is kind of funny. It's got a similar level of importance to its field as Knuth's Art of Computer Programming or stuff like that. It's not an obscure text. Yeah, you might forget what all is in it if you don't use it often, but you'd go "oh, of course that would be in there, wouldn't it...."

Re:Faster asin() was hiding in plain sight by wolfi1 on Wednesday March 11, 2026 @12:17PM (#47337567)
Abramowitz/Stegun has been updated 2010 and resides now here: https://dlmf.nist.gov/
Re:Faster asin() was hiding in plain sight by rerdavies on Wednesday March 11, 2026 @07:04PM (#47343645)
Doesn't seem to be terribly up to date though. It seems to use almost exclusively taylor series, and seems to be completely uninterested in error analysis of any kind. Unless I'm missing something.
Re:Faster asin() was hiding in plain sight by exmadscientist on Thursday March 12, 2026 @02:51AM (#47347334)
It's a general-purpose reference for mathematicians, not specifically for numerical analysis. Mathematicians are usually interested in the boring old power series centered at zero (Maclaurin series), so that's what gets prominence.
Re:Faster asin() was hiding in plain sight by def-pri-pub on Wednesday March 11, 2026 @01:43PM (#47338729)
These are books that my uni courses never had me read. I'm a little shocked at times at how my degree program skimped on some of the more famous texts.
Re:Faster asin() was hiding in plain sight by neutronicus on Wednesday March 11, 2026 @02:45PM (#47339541)
It is not a textbook, it is an extremely dense reference manual, so that honestly makes sense.

In physics grad school, professors would occasionally allude to it, and textbooks would cite it ... pretty often. So it's a thing anyone with postgraduate physics education should know exists, but you wouldn't ever be assigned it.

Re:Faster asin() was hiding in plain sight by rendaw on Thursday March 12, 2026 @06:31AM (#47348753)
Presumably someone read it though, at some point, in order to be able to cite it.
Re:Faster asin() was hiding in plain sight by neutronicus on Thursday March 12, 2026 @06:54AM (#47348960)
The relevant sections, at any rate
Re:Faster asin() was hiding in plain sight by eesmith on Thursday March 12, 2026 @10:15AM (#47350825)
I didn't need Abramowitz and Stegun until grad school. In the 1990s. It was a well-known reference book for people at that level, not a text book.

For my undergrad the CRC math handbook was enough.

Re:Faster asin() was hiding in plain sight by axus on Wednesday March 11, 2026 @04:45PM (#47341412)
In this case, AI understood history better than the human.
Re:Faster asin() was hiding in plain sight by bsder on Wednesday March 11, 2026 @06:52PM (#47343487)
Yeah, if you want something that's somewhat obscure, pull up Cody and Waite "Software Manual for the Elementary Functions".

And, lo and behold, the ASIN implementation is minimax.

Re:Faster asin() was hiding in plain sight by mkbosmans on Thursday March 12, 2026 @04:14AM (#47347871)
One of the ways that the classics can be improved is not to take the analytic ideal coefficients and approximate them to the closest floating point number, but rather take those ideal coefficients as a starting point for a search of slightly better ones.

The SLEEF Vectorized Math Library [1] does this and therefore can usually provide accuracy guarantees for the whole floating point range with a polynomial order lower than theory would predict.

Its asinf function [2] is accurate to 1 ULP for all single precision floats, and is similar to the `asin_cg` from the article, with the main difference the sqrt is done on the input of the polynomial instead of the output.

[1] https://sleef.org/ [2] https://github.com/shibatch/sleef/blob/master/src/libm/sleef...

Re:Faster asin() was hiding in plain sight by mkbosmans on Thursday March 12, 2026 @04:22AM (#47347923)
I'm sorry, that second reference was actually for the 3.5ULP variant. The 1 ULP is here: https://github.com/shibatch/sleef/blob/master/src/libm/sleef...