Files
archived-camoufox/browser/scripts
Jake WriterandClaude Opus 5.5 4b48bffd74 Generate the Windows CRT math tables from their definitions
UcrtMathPow.c and UcrtMathTrig.c carried their tables as literal
values with no account of where they came from. They are the tables of
the published algorithms the CRT uses: P. T. P. Tang's table-driven
logarithm and exponential (ACM TOMS 1990 and 1989) for pow, and Cody
and Waite's and Payne and Hanek's argument reduction with AMD LibM's
polynomial kernels for sin, cos and tan. Every table and constant is
the same as in AMD's aocl-libm-ose (src/isa/avx/gas/pow.S and
remainder_piby2_new.S), and the minimax coefficients are AMD's.

browser/scripts/gen-ucrt-math-tables.py now computes them from their
definitions (1/F, ln(2F), 2^(j/64), the bits of 2/pi, splits of ln 2
and pi/2) with the standard library, at two precisions, and writes
UcrtMathPowTables.h and UcrtMathTrigTables.h. Every value is
bit-identical to the old literals. The 2/pi table keeps the 158 bytes
that hold 2/pi's bits; the 98 bytes after them were not part of it and
are never read. check.py fails if the headers are stale, and still
matches ucrtbase.dll on all 33,386 sin, cos and tan and 27,249 pow
inputs under GCC and Clang.

The file headers now describe the algorithms and cite their sources,
carry the MPL-2.0 notice, and name the special cases by AMD's flags.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:23:50 -06:00
..
2026-10-19 17:08:56 +00:00
2026-10-06 19:10:22 -06:00
2026-10-06 19:10:22 -06:00