This is Unofficial EPICS BASE Doxygen Site
osdStrtod.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define strtoll   _strtoi64
 
#define strtoull   _strtoui64
 

Functions

LIBCOM_API double epicsStrtod (const char *str, char **endp)
 

Macro Definition Documentation

#define strtoll   _strtoi64

Definition at line 27 of file osdStrtod.h.

#define strtoull   _strtoui64

Definition at line 28 of file osdStrtod.h.

Function Documentation

LIBCOM_API double epicsStrtod ( const char *  str,
char **  endp 
)

Definition at line 346 of file epicsStdlib.c.

347 {
348  const char *cp = str;
349  int negative = 0;
350  double res;
351 
352  while (isspace((int)*cp))
353  cp++;
354 
355  if (*cp == '+') {
356  cp++;
357  } else if (*cp == '-') {
358  negative = 1;
359  cp++;
360  }
361 
362  if (epicsStrnCaseCmp("0x", cp, 2) == 0) {
363  if (negative)
364  return strtol(str, endp, 16);
365  else
366  return strtoul(str, endp, 16);
367  }
368  if (!isalpha((int)*cp)) {
369  res = strtod(str, endp);
370  if (isinf(res))
371  errno = ERANGE;
372  return res;
373  }
374 
375  if (epicsStrnCaseCmp("NAN", cp, 3) == 0) {
376  res = epicsNAN;
377  cp += 3;
378  if (*cp == '(') {
379  cp++;
380  while (*cp && (*cp++ != ')'))
381  continue;
382  }
383  }
384  else if (epicsStrnCaseCmp("INF", cp, 3) == 0) {
385  res = negative ? -epicsINF : epicsINF;
386  cp += 3;
387  if (epicsStrnCaseCmp("INITY", cp, 5) == 0) {
388  cp += 5;
389  }
390  } else {
391  cp = str;
392  res = 0;
393  }
394 
395  if (endp)
396  *endp = (char *)cp;
397 
398  return res;
399 }
#define isinf(x)
Definition: epicsMath.h:16
#define str(v)
float epicsNAN
Definition: epicsMath.cpp:35
int epicsStrnCaseCmp(const char *s1, const char *s2, size_t len)
Definition: epicsString.c:206
float epicsINF
Definition: epicsMath.cpp:36