Guitar
Static Public Member Functions | Static Private Member Functions | List of all members
strformat_ns::misc Class Reference

#include <strformat.h>

Static Public Member Functions

static double my_strtod (const char *nptr, char **endptr)
 Locale‑independent strtod clone. More...
 

Static Private Member Functions

static double pow10_int (int exp)
 Return 10 raised to an integer power. More...
 

Member Function Documentation

◆ my_strtod()

static double strformat_ns::misc::my_strtod ( const char *  nptr,
char **  endptr 
)
inlinestatic

Locale‑independent strtod clone.

Parses a floating‑point literal from a C‑string. Leading white‑space, an optional sign, fractional part (with a mandatory '.' as the decimal separator), and an optional exponent (e/E) are recognised.

The implementation ignores the current locale; the decimal point must be ‘’.'` and no thousands separators are accepted.

Parameters
nptrPointer to NUL‑terminated text to parse.
endptrIf non‑NULL, receives a pointer to the first character following the parsed number (or nptr on failure).
Returns
The parsed value.
Here is the call graph for this function:

◆ pow10_int()

static double strformat_ns::misc::pow10_int ( int  exp)
inlinestaticprivate

Return 10 raised to an integer power.

A small lookup table is used for the most common range to avoid calling the comparatively expensive pow() routine. Values outside the table range fall back to pow(10.0, exp).

Parameters
expDecimal exponent (positive or negative).
Returns
The value 10^exp as a double.

The documentation for this class was generated from the following file: