Created
June 6, 2013 04:32
-
-
Save kg4sgp/5719337 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Program to make a table of sine values. | |
// I release this to public domain. | |
#include<stdio.h> | |
#include<math.h> | |
int main(){ | |
float pi = 3.14159265358979323846264338327; | |
int max = pow(2,7); // this should be HALF the value for 16bits so (2^16)/2 | |
int n = 1024; // this should be the number of elements in the table in this case it should be 2^16 | |
printf("\n int sine[] = { "); | |
int i = 0; | |
int count = 0; | |
for(i = 0; i <= (n-1); i++){ | |
printf(" %d,", (int)(max*sin((pi*i)/(n)))); | |
count++; | |
if (count == 10){ | |
printf("\n"); | |
count = 0; | |
} | |
} | |
printf(" };\n\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment