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
42a40976
Commit
42a40976
authored
Feb 02, 2008
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simpler solution to handling non-IEEE 754 environments.
parent
a0d9e93b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
13 deletions
+3
-13
Objects/floatobject.c
Objects/floatobject.c
+3
-13
No files found.
Objects/floatobject.c
View file @
42a40976
...
...
@@ -1173,13 +1173,6 @@ float_as_integer_ratio(PyObject *v, PyObject *unused)
obj = call; \
Py_DECREF(prev); \
#ifdef FLT_RADIX
if
(
FLT_RADIX
!=
2
)
{
/* This routine depends on base-2 floating_point. */
Py_INCREF
(
Py_NotImplemented
);
return
Py_NotImplemented
;
}
#endif
CONVERT_TO_DOUBLE
(
v
,
self
);
if
(
Py_IS_INFINITY
(
self
))
{
...
...
@@ -1202,13 +1195,10 @@ float_as_integer_ratio(PyObject *v, PyObject *unused)
for
(
i
=
0
;
i
<
300
&&
float_part
!=
floor
(
float_part
)
;
i
++
)
{
float_part
*=
2
.
0
;
exponent
--
;
}
if
(
i
==
300
)
{
/* Could not convert mantissa to an integer */
Py_INCREF
(
Py_NotImplemented
);
return
Py_NotImplemented
;
}
/* self == float_part * 2**exponent exactly and float_part is integral */
/* self == float_part * 2**exponent exactly and float_part is integral.
If FLT_RADIX != 2, the 300 steps may leave a tiny fractional part
to be truncated by PyLong_FromDouble(). */
numerator
=
PyLong_FromDouble
(
float_part
);
if
(
numerator
==
NULL
)
goto
error
;
...
...
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