FloatAsDouble => Float64

This commit is contained in:
xushiwei
2024-05-11 06:55:57 +08:00
parent 1414853fce
commit 2560a333b6
3 changed files with 4 additions and 4 deletions

View File

@@ -8,5 +8,5 @@ import (
func main() {
x := math.Sqrt(py.Float(2))
c.Printf(c.Str("sqrt(2) = %f\n"), x.FloatAsDouble())
c.Printf(c.Str("sqrt(2) = %f\n"), x.Float64())
}

View File

@@ -11,7 +11,7 @@ func main() {
math := py.ImportModule(c.Str("math"))
sqrt := math.GetAttrString(c.Str("sqrt"))
sqrt2 := sqrt.CallOneArg(py.Float(2))
c.Printf(c.Str("sqrt(2) = %f\n"), sqrt2.FloatAsDouble())
c.Printf(c.Str("sqrt(2) = %f\n"), sqrt2.Float64())
sqrt2.DecRef()
sqrt.DecRef()
math.DecRef()

View File

@@ -28,5 +28,5 @@ func Float(v float64) *Object
//go:linkname FloatFromSring C.PyFloat_FromString
func FloatFromSring(v *Object) *Object
// llgo:link (*Object).FloatAsDouble C.PyFloat_AsDouble
func (o *Object) FloatAsDouble() float64 { panic("unreachable") }
// llgo:link (*Object).Float64 C.PyFloat_AsDouble
func (o *Object) Float64() float64 { panic("unreachable") }