Embedded Xinu Operating System
An ongoing research project and educational operating system.
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Groups Pages
Functions
trig.c File Reference
#include <stddef.h>
#include <framebuffer.h>

Functions

double power (double base, int exp)
 
long factorial (int num)
 
double cosine_taylor (double x, int terms)
 
double cos (int x)
 
double sine_taylor (double x, int terms)
 
double sin (int x)
 

Detailed Description

Provides sine and cosine for Taylor series. Cannot handle values above 215 degrees–will cause overflow. To correct this, only compute values between 0 and 90. Answers are not exactly accurate, but accurate enough for our purposes.

Function Documentation

double sin ( int  x)

Compute the sine using the Taylor approximation as a helper function Note: For graphics purposes, the sine must always be turned negative because a monitor is technically in quadrant 4 instead of quadrant 1.

Parameters
xAngle, in degrees
Returns
Double-precision result of the computation