28 strtof(
const char *nptr,
char **endptr)
30 int caller_errno = errno;
35 dresult = strtod(nptr, endptr);
36 fresult = (float) dresult;
43 if (dresult != 0 && fresult == 0)
44 caller_errno = ERANGE;
45 if (!isinf(dresult) && isinf(fresult))
46 caller_errno = ERANGE;
55 #elif HAVE_BUGGY_STRTOF
75 pg_strtof(
const char *nptr,
char **endptr)
77 int caller_errno = errno;
81 fresult = (
strtof) (nptr, endptr);
87 else if ((*endptr == nptr) || isnan(fresult) ||
88 ((fresult >= FLT_MIN || fresult <= -FLT_MIN) && !isinf(fresult)))
103 double dresult = strtod(nptr, NULL);
110 else if ((dresult == 0.0 && fresult == 0.0) ||
111 (isinf(dresult) && isinf(fresult) && (fresult == dresult)))
114 errno = caller_errno;
117 else if ((dresult > 0 && dresult <= FLT_MIN && (
float) dresult != 0.0) ||
118 (dresult < 0 && dresult >= -FLT_MIN && (
float) dresult != 0.0))
121 errno = caller_errno;
122 return (
float) dresult;
float strtof(const char *nptr, char **endptr)