Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Kirill Smelkov
cpython
Commits
186c30b7
Commit
186c30b7
authored
Feb 05, 2016
by
Yury Selivanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #26288: Optimize PyLong_AsDouble.
parent
eb588a1d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
Misc/NEWS
Misc/NEWS
+1
-0
Objects/longobject.c
Objects/longobject.c
+7
-0
No files found.
Misc/NEWS
View file @
186c30b7
...
...
@@ -165,6 +165,7 @@ Core and Builtins
-
Issue
#
25660
:
Fix
TAB
key
behaviour
in
REPL
with
readline
.
-
Issue
#
26288
:
Optimize
PyLong_AsDouble
.
Library
-------
...
...
Objects/longobject.c
View file @
186c30b7
...
...
@@ -2769,6 +2769,13 @@ PyLong_AsDouble(PyObject *v)
PyErr_SetString
(
PyExc_TypeError
,
"an integer is required"
);
return
-
1
.
0
;
}
if
(
Py_ABS
(
Py_SIZE
(
v
))
<=
1
)
{
/* Fast path; single digit will always fit decimal.
This improves performance of FP/long operations by at
least 20%. This is even visible on macro-benchmarks.
*/
return
(
double
)
MEDIUM_VALUE
((
PyLongObject
*
)
v
);
}
x
=
_PyLong_Frexp
((
PyLongObject
*
)
v
,
&
exponent
);
if
((
x
==
-
1
.
0
&&
PyErr_Occurred
())
||
exponent
>
DBL_MAX_EXP
)
{
PyErr_SetString
(
PyExc_OverflowError
,
...
...
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