-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnumber_test.c
44 lines (41 loc) · 869 Bytes
/
number_test.c
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <stdlib.h>
#include <stdio.h>
char *numbers[] = {
"123.456e-789",
"0.4e00669999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999969999999006",
"-1e+9999",
"1.5e+9999",
"-123123e100000",
"123123e100000",
"123e-1000000",
"-123123123123123123123123123123",
"100000000000000000000",
"-237462374673276894279832749832423479823246327846",
"0e+1",
"0e1",
"4",
"-0.000000000000000000000000000000000000000000000000000000000000000000000000000001",
"20e1",
"-0",
"-123",
"-1",
"-0",
"1E-2",
"1E+2",
"1E22",
"123e45",
"123.456e78",
"1e-2",
"1e+2",
"123",
"123.456789",
"123e65",
};
int main() {
for (int i = 0; i < sizeof(numbers) / sizeof(numbers[0]); i++) {
char *dummy;
double result = strtod(numbers[i], &dummy);
printf("%s = %f\n", numbers[i], result);
}
return 0;
}