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
24070ca3
Commit
24070ca3
authored
Dec 09, 1996
by
Roger E. Masse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed Grandly
parent
3daddda1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
19 deletions
+19
-19
Modules/cmathmodule.c
Modules/cmathmodule.c
+19
-19
No files found.
Modules/cmathmodule.c
View file @
24070ca3
...
...
@@ -2,8 +2,7 @@
/* much code borrowed from mathmodule.c */
#include "allobjects.h"
#include "complexobject.h"
#include "Python.h"
#include <errno.h>
...
...
@@ -229,22 +228,22 @@ static Py_complex c_tanh(x)
/* And now the glue to make them available from Python: */
static
o
bject
*
static
PyO
bject
*
math_error
()
{
if
(
errno
==
EDOM
)
err_setstr
(
ValueError
,
"math domain error"
);
PyErr_SetString
(
PyExc_
ValueError
,
"math domain error"
);
else
if
(
errno
==
ERANGE
)
err_setstr
(
OverflowError
,
"math range error"
);
else
err_errno
(
ValueError
);
/* Unexpected math error */
PyErr_SetString
(
PyExc_
OverflowError
,
"math range error"
);
else
/* Unexpected math error */
PyErr_SetFromErrno
(
PyExc_ValueError
);
return
NULL
;
}
static
o
bject
*
static
PyO
bject
*
math_1
(
args
,
func
)
o
bject
*
args
;
Py_complex
(
*
func
)
FPROTO
((
Py_complex
));
PyO
bject
*
args
;
Py_complex
(
*
func
)
Py_
FPROTO
((
Py_complex
));
{
Py_complex
x
;
if
(
!
PyArg_ParseTuple
(
args
,
"D"
,
&
x
))
...
...
@@ -256,11 +255,11 @@ math_1(args, func)
if
(
errno
!=
0
)
return
math_error
();
else
return
newcomplexobject
(
x
);
return
PyComplex_FromCComplex
(
x
);
}
#define FUNC1(stubname, func) \
static
object * stubname(self, args) o
bject *self, *args; { \
static
PyObject * stubname(self, args) PyO
bject *self, *args; { \
return math_1(args, func); \
}
...
...
@@ -282,7 +281,7 @@ FUNC1(cmath_tan, c_tan)
FUNC1
(
cmath_tanh
,
c_tanh
)
static
struct
methodlist
cmath_methods
[]
=
{
static
PyMethodDef
cmath_methods
[]
=
{
{
"acos"
,
cmath_acos
,
1
},
{
"acosh"
,
cmath_acosh
,
1
},
{
"asin"
,
cmath_asin
,
1
},
...
...
@@ -305,12 +304,13 @@ static struct methodlist cmath_methods[] = {
void
initcmath
()
{
o
bject
*
m
,
*
d
,
*
v
;
PyO
bject
*
m
,
*
d
,
*
v
;
m
=
Py_InitModule
(
"cmath"
,
cmath_methods
);
d
=
getmoduledict
(
m
);
dictinsert
(
d
,
"pi"
,
v
=
newfloatobject
(
atan
(
1
.
0
)
*
4
.
0
));
DECREF
(
v
);
dictinsert
(
d
,
"e"
,
v
=
newfloatobject
(
exp
(
1
.
0
)));
DECREF
(
v
);
d
=
PyModule_GetDict
(
m
);
PyDict_SetItemString
(
d
,
"pi"
,
v
=
PyFloat_FromDouble
(
atan
(
1
.
0
)
*
4
.
0
));
Py_DECREF
(
v
);
PyDict_SetItemString
(
d
,
"e"
,
v
=
PyFloat_FromDouble
(
exp
(
1
.
0
)));
Py_DECREF
(
v
);
}
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