source: buchla-68k/orig/GEMDOS/SINTEST.C@ 5f1d169

Last change on this file since 5f1d169 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Imported original source code.

  • Property mode set to 100755
File size: 1009 bytes
RevLine 
[3ae31e9]1/*
2 =============================================================================
3 sintest.c -- test the sin() function and floating point stuff
4 Version 1 -- 1987-08-10 -- D.N. Lynx Crowe
5 Setup for MetaComCo/Lattice C on the Atari 1040ST
6 =============================================================================
7*/
8
9#include "stdio.h"
10#include "limits.h"
11#include "math.h"
12
13#define NPTS 360
14#define PI2 (2.0 * PI)
15#define XI (PI2 / (float)NPTS)
16
17double points[NPTS]; /* array of y=sin(x) values */
18double xvals[NPTS]; /* array of x values */
19
20main()
21{
22 double x; /* temporary value */
23
24 int i; /* temporary value */
25
26 /* create an array of NPTS points of sin(x) from x=0 to 2 PI radians */
27
28 for (i = 0; i < NPTS; i++) {
29
30 x = (double)i * XI;
31 xvals[i] = x;
32 points[i] = sin(x);
33 }
34
35 for (i = 0; i < NPTS; i++)
36 printf("%3d: sin(%2.6f) = %2.6f\n", i, xvals[i], points[i]);
37
38 printf("XI = %3.6f, PI2 = %3.6f, PI = %3.6f\n", XI, PI2, PI);
39
40 exit(0);
41}
Note: See TracBrowser for help on using the repository browser.