diff options
author | Benjamin Chausse <benjamin@chausse.xyz> | 2022-09-29 16:39:09 -0400 |
---|---|---|
committer | Benjamin Chausse <benjamin@chausse.xyz> | 2022-09-29 16:39:09 -0400 |
commit | e8364e95ee1b38e49af29a2aa1338b3d978411f0 (patch) | |
tree | 042a81f77fa1ef7e7cfca831307cc76486e5731d /tools | |
parent | c56472ceb5d46af1db39b1ac2cd822baffa3ec30 (diff) |
Trigonometry somewhat works
Diffstat (limited to 'tools')
-rw-r--r-- | tools/gen-trig-test.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/tools/gen-trig-test.c b/tools/gen-trig-test.c index 365a90d..54b39bf 100644 --- a/tools/gen-trig-test.c +++ b/tools/gen-trig-test.c @@ -11,25 +11,24 @@ #include <stdio.h> #include <stdlib.h> -/* This code was used to generate floating numbers found in testData.h - * It's purpose is to generate a list of expected outputs for the sine - * and cosine function with a given number. It uses the math.h library +/* This code was used to generate double precision floating point numbers found + * in testData.h It's purpose is to generate a list of expected outputs for the + * sine and cosine function with a given number. It uses the math.h library * which cannot be used for the assignment and which is therefore a great * subject to test and compare with. * - * The generated [][3]int list is organized as follows: - * { original_value, expected_sine, expected_cosine } + * The generated [][3]int list is organized as follows: { original_value, + * expected_sine, expected_cosine } * - * Values chosen here test the following edge cases, - * - Common trigonometric circle identities (0°,30°,45°,60°,90°, etc...) - * - Negative values - * - Values surpassing 2π + * Values chosen here test the following edge cases, - Common trigonometric + * circle identities (0°,30°,45°,60°,90°, etc...) - Negative values - Values + * surpassing 2π */ int main(){ // list of number {{{ - float lst[20] = { + double lst[20] = { 0, // 0° M_PI/6, // 30° M_PI/4, // 45° @@ -56,17 +55,16 @@ int main(){ printf("int piValues[][] = {\n"); int max = (sizeof(lst)/sizeof(lst[0]))-1; - printf("%d",max); for (int i=0; i<max; i++) { printf(" {%f, %f, %f},\n", lst[i], sin(lst[i]), cos(lst[i])); }; - printf(" {%f, %f, %f}\n}", + printf(" {%f, %f, %f}\n}\n", lst[max], sin(lst[max]), cos(lst[max])); - return 0 + return 0; } |