aboutsummaryrefslogtreecommitdiff
path: root/test/015_math_intpow
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2025-03-29 10:04:16 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2025-03-29 10:04:16 +0100
commitb6c1ff6cfdfe0f4ce602fe83e54c3112a1c95690 (patch)
treef9d61c905194276dcf632e31e07ec485b172b131 /test/015_math_intpow
parent0f23987edbbabdf88fbe175f695b4fdb727586fd (diff)
downloadnissy-core-b6c1ff6cfdfe0f4ce602fe83e54c3112a1c95690.tar.gz
nissy-core-b6c1ff6cfdfe0f4ce602fe83e54c3112a1c95690.zip
Optimize genptable for coordinate solve (20x speedup)
Diffstat (limited to 'test/015_math_intpow')
-rw-r--r--test/015_math_intpow/00_1_0.in3
-rw-r--r--test/015_math_intpow/00_1_0.out1
-rw-r--r--test/015_math_intpow/01_x_0.in3
-rw-r--r--test/015_math_intpow/01_x_0.out1
-rw-r--r--test/015_math_intpow/02_3_2.in3
-rw-r--r--test/015_math_intpow/02_3_2.out1
-rw-r--r--test/015_math_intpow/intpow_tests.c26
7 files changed, 38 insertions, 0 deletions
diff --git a/test/015_math_intpow/00_1_0.in b/test/015_math_intpow/00_1_0.in
new file mode 100644
index 0000000..41c18f9
--- /dev/null
+++ b/test/015_math_intpow/00_1_0.in
@@ -0,0 +1,3 @@
11.0
20
31.0
diff --git a/test/015_math_intpow/00_1_0.out b/test/015_math_intpow/00_1_0.out
new file mode 100644
index 0000000..7326d96
--- /dev/null
+++ b/test/015_math_intpow/00_1_0.out
@@ -0,0 +1 @@
Ok
diff --git a/test/015_math_intpow/01_x_0.in b/test/015_math_intpow/01_x_0.in
new file mode 100644
index 0000000..1545b05
--- /dev/null
+++ b/test/015_math_intpow/01_x_0.in
@@ -0,0 +1,3 @@
1234324.52324234
20
31.0
diff --git a/test/015_math_intpow/01_x_0.out b/test/015_math_intpow/01_x_0.out
new file mode 100644
index 0000000..7326d96
--- /dev/null
+++ b/test/015_math_intpow/01_x_0.out
@@ -0,0 +1 @@
Ok
diff --git a/test/015_math_intpow/02_3_2.in b/test/015_math_intpow/02_3_2.in
new file mode 100644
index 0000000..b1c935f
--- /dev/null
+++ b/test/015_math_intpow/02_3_2.in
@@ -0,0 +1,3 @@
13.0
22
39.0
diff --git a/test/015_math_intpow/02_3_2.out b/test/015_math_intpow/02_3_2.out
new file mode 100644
index 0000000..7326d96
--- /dev/null
+++ b/test/015_math_intpow/02_3_2.out
@@ -0,0 +1 @@
Ok
diff --git a/test/015_math_intpow/intpow_tests.c b/test/015_math_intpow/intpow_tests.c
new file mode 100644
index 0000000..48b255c
--- /dev/null
+++ b/test/015_math_intpow/intpow_tests.c
@@ -0,0 +1,26 @@
1#include "../test.h"
2
3#define ABS(x) ((x) < 0 ? (-(x)) : (x))
4
5double intpow(double, uint64_t);
6
7const double tolerance = 1e-6;
8
9void run(void) {
10 char str[STRLENMAX];
11 double b, r, c;
12 uint64_t e;
13
14 fgets(str, STRLENMAX, stdin);
15 b = atof(str);
16 fgets(str, STRLENMAX, stdin);
17 e = atoll(str);
18 fgets(str, STRLENMAX, stdin);
19 r = atof(str);
20
21 c = intpow(b, e);
22 if (ABS(r - c) > tolerance)
23 printf("Error! Expected %lf but got %lf\n", r, c);
24 else
25 printf("Ok\n");
26}

Generated with cgit - Back to sebastiano.tronto.net