Odd behavior when converting C strings to/from doubles
问题 I'm having trouble understanding C's rules for what precision to assume when printing doubles, or when converting strings to doubles. The following program should illustrate my point: #include <errno.h> #include <float.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char **argv) { double x, y; const char *s = "1e-310"; /* Should print zero */ x = DBL_MIN/100.; printf("DBL_MIN = %e, x = %e\n", DBL_MIN, x); /* Trying to read in floating point number smaller than