Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8951483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:40:27+00:00 2026-06-15T13:40:27+00:00

float sinx(float x) { static const float a[] = {-.1666666664,.0083333315,-.0001984090,.0000027526,-.0000000239}; float xsq = x*x;

  • 0
float sinx(float x)
{
    static const float a[] = {-.1666666664,.0083333315,-.0001984090,.0000027526,-.0000000239};
    float xsq = x*x;
    float temp = x*(1 + a[0]*xsq + a[1]*xsq*xsq + a[2]* xsq*xsq*xsq+a[3]*xsq*xsq*xsq*xsq+ a[4]*xsq*xsq*xsq*xsq*xsq);
    return temp;
}

How are those constants calculated? How to calculate cos and tan using this method?
Can I extend this to get more precision? I guess I need to add more constants?


error graph of "fast" and Taylor sine
Plot of the error of the “fast” sine described above against a Taylor polynomial of equal degree.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:40:29+00:00Added an answer on June 15, 2026 at 1:40 pm

    They are -1/6, 1/120, -1/5040 .. and so on.

    Or rather: -1/3!, 1/5!, -1/7!, 1/9!… etc

    Look at the taylor series for sin x in here:

    enter image description here

    It has cos x right below it:

    enter image description here

    For cos x, as seen from the picture above, the constants are -1/2!, 1/4!, -1/6!, 1/8!…

    tan x is slightly different:

    enter image description here

    So to adjust this for cosx:

    float cosx(float x)
    {
        static const float a[] = {-.5, .0416666667,-.0013888889,.0000248016,-.0000002756};
        float xsq = x*x;
        float temp = (1 + a[0]*xsq + a[1]*xsq*xsq + a[2]* xsq*xsq*xsq+a[3]*xsq*xsq*xsq*xsq+ a[4]*xsq*xsq*xsq*xsq*xsq);
        return temp;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

const float FPS = 60; timer = al_create_timer(1.0 / FPS); Apparently, those two lines
float Calculate(const string &query) { std::cout << Query: << query << \n; unsigned int
int main() { float x=3.4e2; printf(%f,x); return 0; } Output: 340.000000 // It's ok.
float pfIdentity[] = { -1.0f,0.0f,0.0f,0.0f, 0.0f,1.0f,0.0f,0.0f, 0.0f,0.0f,1.0f,0.0f, 0.0f,0.0f,0.0f,1.0f }; ================================================================================== const char* pszVertShader =
public float randomNumber(float x, float y, Random rnd) { //Return a random number between
Suppose the following function: float *dosomething(const float *src, const int N) { float *dst
Float sum = new Float(300); // always somehow calculated DecimalFormat df = new DecimalFormat(#.#);
-(float)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ UITableViewCell * cell = [self.tableView cellForRowAtIndexPath:indexPath]; return cell.bounds.size.height; } What
float a, b; float sa() { return a;}; int main() { a = 10;
float pts[N][4]={{x1,y1,z1,v1},{x2,y2,z2,v2},...,{xN,yN,zN,vN}}; //in viewsight(0,0)-(w,h); //N==w*h //if pts[n][3]==0 then pts[n] is invalid How to evaluate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.