Kaydet (Commit) bb28285e authored tarafından Mark Dickinson's avatar Mark Dickinson

Issue #7117: Prepare for backport of py3k float repr.

Add the Python/dtoa.c file containing the main algorithms;
add corresponding include file and include in Python.h;
include license information for Python/dtoa.c;
add dtoa.c and dtoa.h to Makefile.
üst f98a267b
...@@ -708,3 +708,35 @@ The :mod:`select` and contains the following notice for the kqueue interface:: ...@@ -708,3 +708,35 @@ The :mod:`select` and contains the following notice for the kqueue interface::
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
strtod and dtoa
---------------
The file :file:`Python/dtoa.c`, which supplies C functions dtoa and
strtod for conversion of C doubles to and from strings, is derived
from the file of the same name by David M. Gay, currently available
from http://www.netlib.org/fp/. The original file, as retrieved on
March 16, 2009, contains the following copyright and licensing
notice::
/****************************************************************
*
* The author of this software is David M. Gay.
*
* Copyright (c) 1991, 2000, 2001 by Lucent Technologies.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose without fee is hereby granted, provided that this entire notice
* is included in all copies of any software which is or includes a copy
* or modification of this software and in all copies of the supporting
* documentation for such software.
*
* THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY
* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
*
***************************************************************/
...@@ -137,6 +137,7 @@ ...@@ -137,6 +137,7 @@
#include "pyctype.h" #include "pyctype.h"
#include "pystrtod.h" #include "pystrtod.h"
#include "pystrcmp.h" #include "pystrcmp.h"
#include "dtoa.h"
/* _Py_Mangle is defined in compile.c */ /* _Py_Mangle is defined in compile.c */
PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name); PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name);
......
#ifndef PY_NO_SHORT_FLOAT_REPR
#ifdef __cplusplus
extern "C" {
#endif
PyAPI_FUNC(double) _Py_dg_strtod(const char *str, char **ptr);
PyAPI_FUNC(char *) _Py_dg_dtoa(double d, int mode, int ndigits,
int *decpt, int *sign, char **rve);
PyAPI_FUNC(void) _Py_dg_freedtoa(char *s);
#ifdef __cplusplus
}
#endif
#endif
...@@ -290,6 +290,7 @@ PYTHON_OBJS= \ ...@@ -290,6 +290,7 @@ PYTHON_OBJS= \
Python/getopt.o \ Python/getopt.o \
Python/pystrcmp.o \ Python/pystrcmp.o \
Python/pystrtod.o \ Python/pystrtod.o \
Python/dtoa.o \
Python/formatter_unicode.o \ Python/formatter_unicode.o \
Python/formatter_string.o \ Python/formatter_string.o \
Python/$(DYNLOADFILE) \ Python/$(DYNLOADFILE) \
...@@ -606,6 +607,7 @@ PYTHON_HEADERS= \ ...@@ -606,6 +607,7 @@ PYTHON_HEADERS= \
Include/complexobject.h \ Include/complexobject.h \
Include/descrobject.h \ Include/descrobject.h \
Include/dictobject.h \ Include/dictobject.h \
Include/dtoa.h \
Include/enumobject.h \ Include/enumobject.h \
Include/errcode.h \ Include/errcode.h \
Include/eval.h \ Include/eval.h \
......
...@@ -902,6 +902,10 @@ ...@@ -902,6 +902,10 @@
RelativePath="..\Include\pystrtod.h" RelativePath="..\Include\pystrtod.h"
> >
</File> </File>
<File
RelativePath="..\Include\dtoa.h"
>
</File>
<File <File
RelativePath="..\Include\Python-ast.h" RelativePath="..\Include\Python-ast.h"
> >
...@@ -1798,6 +1802,10 @@ ...@@ -1798,6 +1802,10 @@
RelativePath="..\Python\pystrtod.c" RelativePath="..\Python\pystrtod.c"
> >
</File> </File>
<File
RelativePath="..\Python\dtoa.c"
>
</File>
<File <File
RelativePath="..\Python\Python-ast.c" RelativePath="..\Python\Python-ast.c"
> >
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment