Java sin sin5(float x)

Here you can find the source of sin5(float x)

Description

5th order Taylor series approx of sin(x) only valid from about -pi < x < pi

License

Open Source License

Declaration

public static float sin5(float x) 

Method Source Code

//package com.java2s;
/********************************************************************
Copyright (c) 2000-2008 Steven E. Hugg.//  w  w w  .j ava2  s .  c om
    
This file is part of Exoflight.
    
Exoflight is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
    
Exoflight is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
    
You should have received a copy of the GNU General Public License
along with Exoflight.  If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/

public class Main {
    /**
      * 5th order Taylor series approx of sin(x)
      * only valid from about -pi < x < pi
      */
    public static float sin5(float x) {
        float x2 = x * x;
        return x * (x2 * x2 - 20 * x2 + 120) / 120;
    }
}

Related

  1. sin(int angle)
  2. sin(int f)
  3. sin(int i)
  4. sin(Number x)
  5. sin(Short a)
  6. sin_core(double x)
  7. sin_v2(double x)
  8. sind(double degreeAngle)
  9. sinDeg(double degrees)