119-float-parse.c (809B)
1 /* Float/double type specifiers are parsed without error. 2 * The cg never materializes fp values; this exercises only the 3 * declarations + struct layout via sizeof. See docs/CC.md §Cut 4 * and docs/TCC-TODO.md blocker 1. */ 5 6 extern double atof(const char *); 7 extern float strtof(const char *, char **); 8 extern long double strtold(const char *, char **); 9 extern int ieee_finite(double d); 10 11 struct fields { 12 int tag; 13 float f; 14 double d; 15 long double ld; 16 }; 17 18 int main(int argc, char **argv) { 19 /* sizeof works without loading fp bits. */ 20 if (sizeof(float) != 4) return 1; 21 if (sizeof(double) != 8) return 2; 22 if (sizeof(long double) != 8 && sizeof(long double) != 16) return 3; 23 if (sizeof(struct fields) != 24 && sizeof(struct fields) != 32) return 4; 24 return 0; 25 }