Faster asin() Was Hiding In Plain Sight

This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).

A developer working on a ray tracer (PSRayTracing) tried to speed up std::asin() calls using Padé Approximants, only to discover that a branchless minimax polynomial approximation from Nvidia's old Cg Toolkit documentation (based on Abramowitz and Stegun formula 4.4.45) already existed and outperformed everything else. The Cg-based asin() is 1.5–1.9x faster on Intel hardware and measurably faster on Apple M4. The key lesson: search for existing solutions before reinventing the wheel. The formula was hiding in docs for dead software, originally from a 1960s math textbook, and an LLM prompt surfaced it instantly.

13m read timeFrom 16bpp.net
Post cover image
Table of contents
Quicker TrigPadé ApproximantsMeasuringAn LLM PromptMeasuring FurtherLessons

Sort: