blob: 48b255cf5e26541d715f3363c5941e316dd7a580 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#include "../test.h"
#define ABS(x) ((x) < 0 ? (-(x)) : (x))
double intpow(double, uint64_t);
const double tolerance = 1e-6;
void run(void) {
char str[STRLENMAX];
double b, r, c;
uint64_t e;
fgets(str, STRLENMAX, stdin);
b = atof(str);
fgets(str, STRLENMAX, stdin);
e = atoll(str);
fgets(str, STRLENMAX, stdin);
r = atof(str);
c = intpow(b, e);
if (ABS(r - c) > tolerance)
printf("Error! Expected %lf but got %lf\n", r, c);
else
printf("Ok\n");
}
|