Devuan fork of gpsd
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

47 lines
796 B

  1. /*
  2. * Copyright (c) 2006 Chris Kuethe <chris.kuethe@gmail.com>
  3. * Copyright (c) 2009 BBN Technologies (Greg Troxel)
  4. *
  5. * This file is Copyright (c)2005-2019 by the GPSD project
  6. * SPDX-License-Identifier: BSD-2-clause
  7. */
  8. /*
  9. * This program provides a way to check sin/cos.
  10. */
  11. #include <stdio.h>
  12. #include <math.h>
  13. int test_trig(void);
  14. int main(void) {
  15. test_trig();
  16. /* For now, no evaluation. */
  17. return 0;
  18. }
  19. #define Deg2Rad(x) ((x) * (2 * M_PI / 360.0))
  20. int test_trig(void) {
  21. int i;
  22. double arg;
  23. double res;
  24. for (i = 0; i <= 360; i++) {
  25. arg = Deg2Rad(i);
  26. res = sin(arg);
  27. printf("sin(%.30f) = %.30f\n", arg, res);
  28. }
  29. for (i = 0; i <= 360; i++) {
  30. arg = Deg2Rad(i);
  31. res = cos(arg);
  32. printf("cos(%.30f) = %.30f\n", arg, res);
  33. }
  34. /* Always claim success. */
  35. return 0;
  36. }