### Function

# GLib strtod

since: 2.0

#### Declaration

    gdouble
    g_strtod (
      const gchar* nptr,
      gchar** endptr
    )

#### Description

Converts a string to a floating point value.

It calls the standard `strtod()` function to handle the conversion, but if the string is not completely converted it attempts the conversion again with `g_ascii_strtod()`, and returns the best match.

This function should seldom be used. The normal situation when reading numbers not for human consumption is to use `g_ascii_strtod()`. Only when you know that you must expect both locale formatted and C formatted numbers should you use this. Make sure that you don’t pass strings such as comma separated lists of values, since the commas may be interpreted as a decimal point in some locales, causing unexpected results.

Available since: 2.0

#### Parameters

`nptr`

  Type: `const gchar*`

  The string to convert to a numeric value.

  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`endptr`

  Type: `gchar**`

  If non-`NULL`, it returns the character after the last character used in the conversion.

  The argument will be set by the function.
  The argument can be `NULL`.
  The data is owned by the function.
  The value is a NUL terminated UTF-8 string.

#### Return value

Type: `gdouble`

The converted value.