machdep_ldisx.c revision 174204
1112163Sdas/*-
2112163Sdas * Copyright (c) 2003 David Schultz <das@FreeBSD.ORG>
3112163Sdas * All rights reserved.
4112163Sdas *
5112163Sdas * Redistribution and use in source and binary forms, with or without
6112163Sdas * modification, are permitted provided that the following conditions
7112163Sdas * are met:
8112163Sdas * 1. Redistributions of source code must retain the above copyright
9112163Sdas *    notice, this list of conditions and the following disclaimer.
10112163Sdas * 2. Redistributions in binary form must reproduce the above copyright
11112163Sdas *    notice, this list of conditions and the following disclaimer in the
12112163Sdas *    documentation and/or other materials provided with the distribution.
13112163Sdas *
14112163Sdas * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15112163Sdas * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16112163Sdas * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17112163Sdas * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18112163Sdas * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19112163Sdas * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20112163Sdas * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21112163Sdas * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22112163Sdas * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23112163Sdas * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24112163Sdas * SUCH DAMAGE.
25112163Sdas */
26112163Sdas
27112163Sdas/*
28112163Sdas * Machine-dependent glue to integrate David Gay's gdtoa
29112163Sdas * package into libc for architectures where a long double
30112163Sdas * is an IEEE extended precision number.
31112163Sdas */
32112163Sdas
33112163Sdas#include <sys/cdefs.h>
34112163Sdas__FBSDID("$FreeBSD: head/lib/libc/gdtoa/machdep_ldisx.c 174204 2007-12-03 07:17:33Z das $");
35112163Sdas
36174204Sdas#include <float.h>
37174204Sdas
38112163Sdas#include "gdtoaimp.h"
39112163Sdas
40112163Sdaslong double
41112163Sdasstrtold(const char * __restrict s, char ** __restrict sp)
42112163Sdas{
43112163Sdas	long double result;
44112163Sdas
45174204Sdas	strtorx(s, sp, FLT_ROUNDS, &result);
46112163Sdas	return result;
47112163Sdas}
48