MobilityDB 1.3
Loading...
Searching...
No Matches

◆ float8_in_opt_error()

double float8_in_opt_error ( char *  num,
const char *  type_name,
const char *  orig_string 
)

float8in_internal_opt_error - guts of float8in()

Returns
On error return DBL_MAX

This is exposed for use by functions that want a reasonably platform-independent way of inputting doubles. The behavior is essentially like strtod + ereport on error, but note the following differences:

  1. Both leading and trailing whitespace are skipped.
  2. If endptr_p is NULL, we throw error if there's trailing junk. Otherwise, it's up to the caller to complain about trailing junk.
  3. In event of a syntax error, the report mentions the given type_name and prints orig_string as the input; this is meant to support use of this function with types such as "box" and "point", where what we are parsing here is just a substring of orig_string.

"num" could validly be declared "const char *", but that results in an unreasonable amount of extra casting both here and in callers, so we don't.