annotate Include/floatobject.h @ 24042:63fbbed10714 legacy-trunk

Simplify HTTPSConnection constructor. See discussion in SF bug 458463.
author Jeremy Hylton <jeremy@alum.mit.edu>
date Fri, 28 Jun 2002 23:38:14 +0000
parents 10f5927dbf05
children c1eb668525e1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
145
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 6
diff changeset
1
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2 /* Float object interface */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
3
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
4 /*
2129
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2058
diff changeset
5 PyFloatObject represents a (double precision) floating point number.
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
6 */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
7
13444
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
8 #ifndef Py_FLOATOBJECT_H
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
9 #define Py_FLOATOBJECT_H
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
10 #ifdef __cplusplus
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
11 extern "C" {
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
12 #endif
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
13
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
14 typedef struct {
13444
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
15 PyObject_HEAD
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
16 double ob_fval;
2129
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2058
diff changeset
17 } PyFloatObject;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
18
2436
fa98dda07877 make the type a parameter of the DL_IMPORT macro, for Borland C
Guido van Rossum <guido@python.org>
parents: 2129
diff changeset
19 extern DL_IMPORT(PyTypeObject) PyFloat_Type;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
20
19550
19d271f297dc Make the PyXXX_Check() macros for the numeric types inheritance-aware.
Guido van Rossum <guido@python.org>
parents: 17707
diff changeset
21 #define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type)
19839
10f5927dbf05 More for SF bug [#460020] bug or feature: unicode() and subclasses
Tim Peters <tim.peters@gmail.com>
parents: 19550
diff changeset
22 #define PyFloat_CheckExact(op) ((op)->ob_type == &PyFloat_Type)
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
23
17707
fe4c1034b480 SF bug #422177: Results from .pyc differs from .py
Tim Peters <tim.peters@gmail.com>
parents: 14375
diff changeset
24 /* Return Python float from string PyObject. Second argument ignored on
fe4c1034b480 SF bug #422177: Results from .pyc differs from .py
Tim Peters <tim.peters@gmail.com>
parents: 14375
diff changeset
25 input, and, if non-NULL, NULL is stored into *junk (this tried to serve a
fe4c1034b480 SF bug #422177: Results from .pyc differs from .py
Tim Peters <tim.peters@gmail.com>
parents: 14375
diff changeset
26 purpose once but can't be made to work as intended). */
fe4c1034b480 SF bug #422177: Results from .pyc differs from .py
Tim Peters <tim.peters@gmail.com>
parents: 14375
diff changeset
27 extern DL_IMPORT(PyObject *) PyFloat_FromString(PyObject*, char** junk);
fe4c1034b480 SF bug #422177: Results from .pyc differs from .py
Tim Peters <tim.peters@gmail.com>
parents: 14375
diff changeset
28
fe4c1034b480 SF bug #422177: Results from .pyc differs from .py
Tim Peters <tim.peters@gmail.com>
parents: 14375
diff changeset
29 /* Return Python float from C double. */
13444
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
30 extern DL_IMPORT(PyObject *) PyFloat_FromDouble(double);
17707
fe4c1034b480 SF bug #422177: Results from .pyc differs from .py
Tim Peters <tim.peters@gmail.com>
parents: 14375
diff changeset
31
fe4c1034b480 SF bug #422177: Results from .pyc differs from .py
Tim Peters <tim.peters@gmail.com>
parents: 14375
diff changeset
32 /* Extract C double from Python float. The macro version trades safety for
fe4c1034b480 SF bug #422177: Results from .pyc differs from .py
Tim Peters <tim.peters@gmail.com>
parents: 14375
diff changeset
33 speed. */
13444
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
34 extern DL_IMPORT(double) PyFloat_AsDouble(PyObject *);
17707
fe4c1034b480 SF bug #422177: Results from .pyc differs from .py
Tim Peters <tim.peters@gmail.com>
parents: 14375
diff changeset
35 #define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval)
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
36
17707
fe4c1034b480 SF bug #422177: Results from .pyc differs from .py
Tim Peters <tim.peters@gmail.com>
parents: 14375
diff changeset
37 /* Write repr(v) into the char buffer argument, followed by null byte. The
fe4c1034b480 SF bug #422177: Results from .pyc differs from .py
Tim Peters <tim.peters@gmail.com>
parents: 14375
diff changeset
38 buffer must be "big enough"; >= 100 is very safe.
fe4c1034b480 SF bug #422177: Results from .pyc differs from .py
Tim Peters <tim.peters@gmail.com>
parents: 14375
diff changeset
39 PyFloat_AsReprString(buf, x) strives to print enough digits so that
fe4c1034b480 SF bug #422177: Results from .pyc differs from .py
Tim Peters <tim.peters@gmail.com>
parents: 14375
diff changeset
40 PyFloat_FromString(buf) then reproduces x exactly. */
fe4c1034b480 SF bug #422177: Results from .pyc differs from .py
Tim Peters <tim.peters@gmail.com>
parents: 14375
diff changeset
41 extern DL_IMPORT(void) PyFloat_AsReprString(char*, PyFloatObject *v);
fe4c1034b480 SF bug #422177: Results from .pyc differs from .py
Tim Peters <tim.peters@gmail.com>
parents: 14375
diff changeset
42
fe4c1034b480 SF bug #422177: Results from .pyc differs from .py
Tim Peters <tim.peters@gmail.com>
parents: 14375
diff changeset
43 /* Write str(v) into the char buffer argument, followed by null byte. The
fe4c1034b480 SF bug #422177: Results from .pyc differs from .py
Tim Peters <tim.peters@gmail.com>
parents: 14375
diff changeset
44 buffer must be "big enough"; >= 100 is very safe. Note that it's
fe4c1034b480 SF bug #422177: Results from .pyc differs from .py
Tim Peters <tim.peters@gmail.com>
parents: 14375
diff changeset
45 unusual to be able to get back the float you started with from
fe4c1034b480 SF bug #422177: Results from .pyc differs from .py
Tim Peters <tim.peters@gmail.com>
parents: 14375
diff changeset
46 PyFloat_AsString's result -- use PyFloat_AsReprString() if you want to
fe4c1034b480 SF bug #422177: Results from .pyc differs from .py
Tim Peters <tim.peters@gmail.com>
parents: 14375
diff changeset
47 preserve precision across conversions. */
fe4c1034b480 SF bug #422177: Results from .pyc differs from .py
Tim Peters <tim.peters@gmail.com>
parents: 14375
diff changeset
48 extern DL_IMPORT(void) PyFloat_AsString(char*, PyFloatObject *v);
1329
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
49
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
50 #ifdef __cplusplus
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
51 }
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
52 #endif
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
53 #endif /* !Py_FLOATOBJECT_H */