sbinet / go-python

naive go bindings to the CPython2 C-API
Other
1.53k stars 138 forks source link

PyFloat_FromDouble should take a float64 #43

Closed zjb0807 closed 8 years ago

zjb0807 commented 8 years ago

// PyObject* PyFloat_FromDouble(double v) // Return value: New reference. // Create a PyFloatObject object from v, or NULL on failure. func PyFloat_FromDouble(v float32) *PyObject { return togo(C.PyFloat_FromDouble(C.double(v))) }

zjb0807 commented 8 years ago

another problem, when i use PyFloat_AsDouble function: err: cannot use python.PyFloat_AsDouble(rate) (type float64) as type float32 in assignment

sbinet commented 8 years ago

python.PyFloat_AsDouble now returns a float64. either change the type of the value being assigned to (from float32 to float64) or convert what python.PyFloat_AsDouble returns to a float32.