Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Commit ac4579f

Browse files
committed
numeric: use float64 for PyFloat
Fixes #43.
1 parent 990e749 commit ac4579f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

numeric.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -389,20 +389,20 @@ func PyFloat_FromString(str *PyObject) *PyObject {
389389
// PyObject* PyFloat_FromDouble(double v)
390390
// Return value: New reference.
391391
// Create a PyFloatObject object from v, or NULL on failure.
392-
func PyFloat_FromDouble(v float32) *PyObject {
392+
func PyFloat_FromDouble(v float64) *PyObject {
393393
return togo(C.PyFloat_FromDouble(C.double(v)))
394394
}
395395

396396
// double PyFloat_AsDouble(PyObject *pyfloat)
397397
// Return a C double representation of the contents of pyfloat. If pyfloat is not a Python floating point object but has a __float__() method, this method will first be called to convert pyfloat into a float.
398-
func PyFloat_AsDouble(self *PyObject) float32 {
399-
return float32(C.PyFloat_AsDouble(topy(self)))
398+
func PyFloat_AsDouble(self *PyObject) float64 {
399+
return float64(C.PyFloat_AsDouble(topy(self)))
400400
}
401401

402402
// double PyFloat_AS_DOUBLE(PyObject *pyfloat)
403403
// Return a C double representation of the contents of pyfloat, but without error checking.
404-
func PyFloat_AS_DOUBLE(self *PyObject) float32 {
405-
return float32(C._gopy_PyFloat_AS_DOUBLE(topy(self)))
404+
func PyFloat_AS_DOUBLE(self *PyObject) float64 {
405+
return float64(C._gopy_PyFloat_AS_DOUBLE(topy(self)))
406406
}
407407

408408
// PyObject* PyFloat_GetInfo(void)
@@ -417,16 +417,16 @@ func PyFloat_GetInfo() *PyObject {
417417
// Return the maximum representable finite float DBL_MAX as C double.
418418
//
419419
// New in version 2.6.
420-
func PyFloat_GetMax() float32 {
421-
return float32(C.PyFloat_GetMax())
420+
func PyFloat_GetMax() float64 {
421+
return float64(C.PyFloat_GetMax())
422422
}
423423

424424
// double PyFloat_GetMin()
425425
// Return the minimum normalized positive float DBL_MIN as C double.
426426
//
427427
// New in version 2.6.
428-
func PyFloat_GetMin() float32 {
429-
return float32(C.PyFloat_GetMin())
428+
func PyFloat_GetMin() float64 {
429+
return float64(C.PyFloat_GetMin())
430430
}
431431

432432
// int PyFloat_ClearFreeList()

0 commit comments

Comments
 (0)