Skip to content

math: Sine and cosine accuracy #191

@mansourmoufid

Description

@mansourmoufid

Hi,

When I try to test the sine and cosine implementations with inputs on [0, 2pi] rather than [-1, 1], they are only accurate to two or three decimal places.

I know people put in the effort and I don't want to be rude and mess with their code, but I would like to suggest two formulas which are more accurate and probably just as fast. They are polynomial approximations accurate to nine decimal places. The formulas are here: http://eliteraspberries.github.io/pal/formulas/

Polynomial approximations involve mainly floating-point multiplication and addition, which is good for modern hardware with a multiply-accumulate instruction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions