Skip to content

Add a look up table of specific angles #6

@jouae

Description

@jouae

Based on the output of bf16_test.c for commit 8345d9a, the maximum error of the 8th-order Chebyshev polynomial approximation remains within 1 ULP, and within $[0,\frac{\pi}{2}]$ the error is only 0.5 ULP.

./bf16_test
Test range [0, pi/2]:
Max difference = 0.003906, Total 56 numbers difference

Test range [pi/2, inf):
Max difference = 0.007812, Total 4623 numbers difference

Test range [-smallest, -inf):
Max difference = 0.007812,Total 9270 numbers difference

This means that without modifying the existing approximation method, corrections only need to be applied for range2 and range3.

Since there are 64 angles in each of range2 and range3 that exceed 0.5 ULP—i.e., a total of 128 angles that can produce a 1 ULP error—the most straightforward approach is to construct a lookup table of 128 BF16 entries to achieve correct rounding.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions