cpy3/float.go

64 lines
1.9 KiB
Go
Raw Normal View History

2018-12-13 22:09:42 +00:00
/*
Unless explicitly stated otherwise all files in this repository are licensed
under the MIT License.
2018-12-13 22:09:42 +00:00
This product includes software developed at Datadog (https://www.datadoghq.com/).
Copyright 2018 Datadog, Inc.
*/
2018-12-06 17:24:59 +00:00
package python3
/*
#include "Python.h"
#include "macro.h"
*/
import "C"
2018-12-20 22:59:29 +00:00
import "unsafe"
2018-12-06 17:24:59 +00:00
2023-05-24 08:30:48 +00:00
// Float : https://docs.python.org/3/c-api/float.html#c.PyFloat_Type
2018-12-20 22:59:29 +00:00
var Float = togo((*C.PyObject)(unsafe.Pointer(&C.PyFloat_Type)))
2018-12-06 17:24:59 +00:00
2023-05-24 08:30:48 +00:00
// PyFloat_Check : https://docs.python.org/3/c-api/float.html#c.PyFloat_Check
2018-12-06 17:24:59 +00:00
func PyFloat_Check(p *PyObject) bool {
return C._go_PyFloat_Check(toc(p)) != 0
}
2023-05-24 08:30:48 +00:00
// PyFloat_CheckExact : https://docs.python.org/3/c-api/float.html#c.PyFloat_CheckExact
2018-12-06 17:24:59 +00:00
func PyFloat_CheckExact(p *PyObject) bool {
return C._go_PyFloat_CheckExact(toc(p)) != 0
}
2023-05-24 08:30:48 +00:00
// PyFloat_FromDouble : https://docs.python.org/3/c-api/float.html#c.PyFloat_FromDouble
2018-12-06 17:24:59 +00:00
func PyFloat_FromDouble(v float64) *PyObject {
return togo(C.PyFloat_FromDouble(C.double(v)))
}
2023-05-24 08:30:48 +00:00
// PyFloat_FromString : https://docs.python.org/3/c-api/float.html#c.PyFloat_FromString
2018-12-06 17:24:59 +00:00
func PyFloat_FromString(str *PyObject) *PyObject {
return togo(C.PyFloat_FromString(toc(str)))
}
2023-05-24 08:30:48 +00:00
// PyFloat_AsDouble : https://docs.python.org/3/c-api/float.html#c.PyFloat_AsDouble
2018-12-06 17:24:59 +00:00
func PyFloat_AsDouble(obj *PyObject) float64 {
return float64(C.PyFloat_AsDouble(toc(obj)))
}
2023-05-24 08:30:48 +00:00
// PyFloat_GetInfo : https://docs.python.org/3/c-api/float.html#c.PyFloat_GetInfo
2018-12-06 17:24:59 +00:00
func PyFloat_GetInfo() *PyObject {
return togo(C.PyFloat_GetInfo())
}
2023-05-24 08:30:48 +00:00
// PyFloat_GetMax : https://docs.python.org/3/c-api/float.html#c.PyFloat_GetMax
2018-12-06 17:24:59 +00:00
func PyFloat_GetMax() float64 {
return float64(C.PyFloat_GetMax())
}
2023-05-24 08:30:48 +00:00
// PyFloat_GetMin : https://docs.python.org/3/c-api/float.html#c.PyFloat_GetMin
2018-12-06 17:24:59 +00:00
func PyFloat_GetMin() float64 {
return float64(C.PyFloat_GetMin())
}
//PyFloat_ClearFreeList : https://docs.python.org/3/c-api/float.html#c.PyFloat_ClearFreeList
2023-05-24 08:30:48 +00:00
//func PyFloat_ClearFreeList() int {
// return int(C.PyFloat_ClearFreeList())
//}