root/maint/gnulib/lib/c-strtod.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /* Convert string to double, using the C locale.  -*- coding: utf-8 -*-
   2 
   3    Copyright (C) 2003-2004, 2009-2021 Free Software Foundation, Inc.
   4 
   5    This program is free software: you can redistribute it and/or modify
   6    it under the terms of the GNU General Public License as published by
   7    the Free Software Foundation; either version 3 of the License, or
   8    (at your option) any later version.
   9 
  10    This program is distributed in the hope that it will be useful,
  11    but WITHOUT ANY WARRANTY; without even the implied warranty of
  12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13    GNU General Public License for more details.
  14 
  15    You should have received a copy of the GNU General Public License
  16    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
  17 
  18 #ifdef __cplusplus
  19 extern "C" {
  20 #endif
  21 
  22 /* Parse the initial portion of the string pointed to by NPTR as a floating-
  23    point number (in decimal or hexadecimal notation), like in the C locale:
  24    accepting only the ASCII digits '0'..'9', and only '.' as decimal point
  25    character.
  26    If ENDPTR is not NULL, set *ENDPTR to point to the first byte beyond the
  27    parsed number or to NPTR if the string does not start with a parsable
  28    number.
  29    Return value:
  30    - If successful, return the value as a double or 'long double',
  31      respectively, and don't modify errno.
  32    - In case of overflow, return ±HUGE_VAL or ±HUGE_VALL, respectively, and
  33      set errno to ERANGE.
  34    - In case of underflow, return a value very near to 0 and set errno to
  35      ERANGE.
  36    - If the string does not start with a number at all, return 0 (and recall
  37      that if ENDPTR != NULL, *ENDPTR is set to NPTR), and maybe set errno to
  38      EINVAL.
  39    - In case of other error, return 0 and set errno, for example to ENOMEM.  */
  40 extern double      c_strtod  (char const *nptr, char **endptr);
  41 extern long double c_strtold (char const *nptr, char **endptr);
  42 
  43 #ifdef __cplusplus
  44 }
  45 #endif

/* [previous][next][first][last][top][bottom][index][help] */