mirror of
https://github.com/johndoe6345789/typthon.git
synced 2026-04-24 13:45:05 +00:00
Massive automated renaming of all Py_/PyObject/etc. prefixes to Ty_/TyObject/etc. This includes: - All public API types (TyObject, TyTypeObject, etc.) - All public API functions (Ty_Initialize, Ty_BuildValue, etc.) - All internal API (_Ty_ prefixes) - Reference counting macros (Ty_INCREF, Ty_DECREF, etc.) - Type flags (Ty_TPFLAGS_*) - Debug flags (Ty_DEBUG, Ty_TRACE_REFS, etc.) - All object type APIs (TyList_, TyDict_, TyUnicode_, etc.) This changes over 60,000 occurrences across 1000+ files. Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
55 lines
1.5 KiB
C
55 lines
1.5 KiB
C
|
|
/* Float object interface */
|
|
|
|
/*
|
|
PyFloatObject represents a (double precision) floating-point number.
|
|
*/
|
|
|
|
#ifndef Ty_FLOATOBJECT_H
|
|
#define Ty_FLOATOBJECT_H
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
PyAPI_DATA(TyTypeObject) TyFloat_Type;
|
|
|
|
#define TyFloat_Check(op) PyObject_TypeCheck(op, &TyFloat_Type)
|
|
#define TyFloat_CheckExact(op) Ty_IS_TYPE((op), &TyFloat_Type)
|
|
|
|
#define Ty_RETURN_NAN return TyFloat_FromDouble(Ty_NAN)
|
|
|
|
#define Ty_RETURN_INF(sign) \
|
|
do { \
|
|
if (copysign(1., sign) == 1.) { \
|
|
return TyFloat_FromDouble(Ty_INFINITY); \
|
|
} \
|
|
else { \
|
|
return TyFloat_FromDouble(-Ty_INFINITY); \
|
|
} \
|
|
} while(0)
|
|
|
|
PyAPI_FUNC(double) TyFloat_GetMax(void);
|
|
PyAPI_FUNC(double) TyFloat_GetMin(void);
|
|
PyAPI_FUNC(TyObject*) TyFloat_GetInfo(void);
|
|
|
|
/* Return Python float from string TyObject. */
|
|
PyAPI_FUNC(TyObject*) TyFloat_FromString(TyObject*);
|
|
|
|
/* Return Python float from C double. */
|
|
PyAPI_FUNC(TyObject*) TyFloat_FromDouble(double);
|
|
|
|
/* Extract C double from Python float. The macro version trades safety for
|
|
speed. */
|
|
PyAPI_FUNC(double) TyFloat_AsDouble(TyObject*);
|
|
|
|
#ifndef Ty_LIMITED_API
|
|
# define Ty_CPYTHON_FLOATOBJECT_H
|
|
# include "cpython/floatobject.h"
|
|
# undef Ty_CPYTHON_FLOATOBJECT_H
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif /* !Ty_FLOATOBJECT_H */
|