Commit d3388b6
committed
AK: Make atan() more precise and faster on non-x86
Instead of calling asin(), approximate atan() directly.
Takes the biggest error of atan() over 0..2*pi (which is
an arbitrary interval, given that atan()'s domain is all
reals) from 7.15256e-07 to 1.19209e-07. That's enough to
make TestPDF pass when run inside serenity (part of SerenityOS#25934).
It also takes bench_trig_atan* from:
Running benchmark 'bench_trig_atan'.
Completed benchmark 'bench_trig_atan' in 181ms
Running benchmark 'bench_trig_atanf'.
Completed benchmark 'bench_trig_atanf' in 188ms
to
Running benchmark 'bench_trig_atan'.
Completed benchmark 'bench_trig_atan' in 123ms
Running benchmark 'bench_trig_atanf'.
Completed benchmark 'bench_trig_atanf' in 72ms
See the PR adding this commit for details on the program that
computed the precision.
(I first tried making asin() more precise, but even with a more
precise asin(), atan()'s error never went below 7.15256e-07 when
it was implemented in terms of asin(). Possibly because larger
values all map to arguments close to 1.0 for asin().)1 parent d59af74 commit d3388b6
1 file changed
+44
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
899 | 899 | | |
900 | 900 | | |
901 | 901 | | |
902 | | - | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
903 | 946 | | |
904 | 947 | | |
905 | 948 | | |
| |||
0 commit comments