Entries tagged as: function

2014
10-26

my own sin and cos implementation in C / C++

Here is my own implementation of sin and cos functions in C language. It's may be usedful if you want to compile very small exe file, without using standard libc.
  1. float cos(float x){
  2. if( x < 0.0f )
  3. x = -x;
  4. while( M_PI < x )
  5. x -= M_2_PI;
  6. return 1.0f - (x*x/2.0f)*( 1.0f - (x*x/12.0f) * ( 1.0f - (x*x/30.0f) * (1.0f - x*x/56.0f )));
  7. }
  8.  
  9. float sin(float x){return cos(x-M_PI_2);}
  10.  
2010
10-24

python fast tutorial

This tutorial is for thous who can programing but don't know Python language. I will show how to use variables, loops, arrays, functions, and how to write scripts. (more…)