Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
407b2f95
Commit
407b2f95
authored
Nov 10, 2015
by
Boxiang Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add float_repr_style to sys module and enable test_strtod
parent
e912efed
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
2 deletions
+33
-2
from_cpython/Include/pyport.h
from_cpython/Include/pyport.h
+25
-0
from_cpython/Lib/test/test_strtod.py
from_cpython/Lib/test/test_strtod.py
+0
-1
src/runtime/builtin_modules/sys.cpp
src/runtime/builtin_modules/sys.cpp
+8
-0
test/CPYTHON_TEST_NOTES.md
test/CPYTHON_TEST_NOTES.md
+0
-1
No files found.
from_cpython/Include/pyport.h
View file @
407b2f95
...
...
@@ -458,3 +458,28 @@ typedef PY_LONG_LONG Py_intptr_t;
else if (errno == ERANGE) \
errno = 0; \
} while(0)
/* If we can't guarantee 53-bit precision, don't use the code
in Python/dtoa.c, but fall back to standard code. This
means that repr of a float will be long (17 sig digits).
Realistically, there are two things that could go wrong:
(1) doubles aren't IEEE 754 doubles, or
(2) we're on x86 with the rounding precision set to 64-bits
(extended precision), and we don't know how to change
the rounding precision.
*/
#if !defined(DOUBLE_IS_LITTLE_ENDIAN_IEEE754) && \
!defined(DOUBLE_IS_BIG_ENDIAN_IEEE754) && \
!defined(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754)
#define PY_NO_SHORT_FLOAT_REPR
#endif
/* double rounding is symptomatic of use of extended precision on x86. If
we're seeing double rounding, and we don't have any mechanism available for
changing the FPU rounding precision, then don't use Python/dtoa.c. */
#if defined(X87_DOUBLE_ROUNDING) && !defined(HAVE_PY_SET_53BIT_PRECISION)
#define PY_NO_SHORT_FLOAT_REPR
#endif
from_cpython/Lib/test/test_strtod.py
View file @
407b2f95
# expected: fail
# Tests for the correctly-rounded string -> float conversions
# introduced in Python 2.7 and 3.1.
...
...
src/runtime/builtin_modules/sys.cpp
View file @
407b2f95
...
...
@@ -721,6 +721,14 @@ void setupSys() {
#ifdef Py_USING_UNICODE
SET_SYS_FROM_STRING
(
"maxunicode"
,
PyInt_FromLong
(
PyUnicode_GetMax
()));
#endif
/* float repr style: 0.03 (short) vs 0.029999999999999999 (legacy) */
#ifndef PY_NO_SHORT_FLOAT_REPR
SET_SYS_FROM_STRING
(
"float_repr_style"
,
PyString_FromString
(
"short"
));
#else
SET_SYS_FROM_STRING
(
"float_repr_style"
,
PyString_FromString
(
"legacy"
));
#endif
sys_flags_cls
->
tp_mro
=
BoxedTuple
::
create
({
sys_flags_cls
,
object_cls
});
sys_flags_cls
->
freeze
();
...
...
test/CPYTHON_TEST_NOTES.md
View file @
407b2f95
...
...
@@ -198,7 +198,6 @@ test_sqlite [unknown]
test_ssl [unknown]
test_startfile [unknown]
test_str memory leak?
test_strtod [unknown]
test_structmembers [unknown]
test_struct [unknown]
test_subprocess exit code 141 [sigpipe?], no error message
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment