strtold_subr.c revision 4fd606d1f5abe38e1f42c38de1d2e895166bd0f4
2N/A/* $NetBSD: strtold_subr.c,v 1.1 2006/03/15 17:35:18 kleink Exp $ */
2N/A
2N/A/*
2N/A * Written by Klaus Klein <kleink@NetBSD.org>, November 16, 2005.
2N/A * Public domain.
2N/A */
2N/A
2N/A/*
2N/A * NOTICE: This is not a standalone file. To use it, #include it in
2N/A * the format-specific strtold_*.c, like so:
2N/A *
2N/A * #define GDTOA_LD_FMT <gdtoa extended-precision format code>
2N/A * #include "strtold_subr.c"
2N/A */
2N/A#include <LibConfig.h>
2N/A#include <sys/EfiCdefs.h>
2N/A
2N/A#include "namespace.h"
2N/A#include <math.h>
2N/A#include <sys/stdint.h>
2N/A#include <stdlib.h>
2N/A#include "gdtoa.h"
2N/A
2N/A#ifdef __weak_alias
2N/A__weak_alias(strtold, _strtold)
2N/A#endif
2N/A
2N/A#ifndef __HAVE_LONG_DOUBLE
2N/A#error no extended-precision long double type
2N/A#endif
2N/A
2N/A#ifndef GDTOA_LD_FMT
2N/A#error GDTOA_LD_FMT must be defined by format-specific source file
2N/A#endif
2N/A
2N/A#define STRTOP(x) __CONCAT(strtop, x)
2N/A
2N/Along double
2N/Astrtold(const char *nptr, char **endptr)
2N/A{
2N/A long double ld;
2N/A
2N/A (void)STRTOP(GDTOA_LD_FMT)(nptr, endptr, &ld);
2N/A return ld;
2N/A}
2N/A