sine.c 428 B

12345678910111213141516171819202122
  1. #include <stdio.h>
  2. #include <unistd.h>
  3. #include "math.h"
  4. #define PI 3.14159265358979323846
  5. int main(int argc, char **argv) {
  6. /* CHANGE THESE */
  7. int range = 1000000;
  8. int freq = 3000;
  9. float lewave = 2*(PI/freq);
  10. int step = 2;
  11. if (step % 2 != 0) step++;
  12. while (1) {
  13. printf("%f\n", range * sinf(((step+=2)%freq) * lewave) * tanf((step++) * lewave));
  14. sleep(0.5);
  15. }
  16. return 0;
  17. }