cl: _testpy/gcd
This commit is contained in:
73
py/long.go
Normal file
73
py/long.go
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package py
|
||||
|
||||
import (
|
||||
_ "unsafe"
|
||||
|
||||
"github.com/goplus/llgo/c"
|
||||
)
|
||||
|
||||
// https://docs.python.org/3/c-api/long.html
|
||||
|
||||
//go:linkname Long C.PyLong_FromLong
|
||||
func Long(v c.Long) *Object
|
||||
|
||||
//go:linkname LongLong C.PyLong_FromLongLong
|
||||
func LongLong(v c.LongLong) *Object
|
||||
|
||||
//go:linkname Ulong C.PyLong_FromUnsignedLong
|
||||
func Ulong(v c.Ulong) *Object
|
||||
|
||||
//go:linkname UlongLong C.PyLong_FromUnsignedLongLong
|
||||
func UlongLong(v c.UlongLong) *Object
|
||||
|
||||
//go:linkname Uintptr C.PyLong_FromSize_t
|
||||
func Uintptr(v uintptr) *Object
|
||||
|
||||
//go:linkname LongFromFloat64 C.PyLong_FromDouble
|
||||
func LongFromFloat64(v float64) *Object
|
||||
|
||||
//go:linkname LongFromVoidPtr C.PyLong_FromVoidPtr
|
||||
func LongFromVoidPtr(v c.Pointer) *Object
|
||||
|
||||
//go:linkname LongFromCStr C.PyLong_FromString
|
||||
func LongFromCStr(v *c.Char, pend **c.Char, base c.Int) *Object
|
||||
|
||||
//go:linkname LongFromUnicode C.PyLong_FromUnicodeObject
|
||||
func LongFromUnicode(v *Object, base c.Int) *Object
|
||||
|
||||
// llgo:link (*Object).Long C.PyLong_AsLong
|
||||
func (l *Object) Long() c.Long { return 0 }
|
||||
|
||||
// llgo:link (*Object).LongLong C.PyLong_AsLongLong
|
||||
func (l *Object) LongLong() c.LongLong { return 0 }
|
||||
|
||||
// llgo:link (*Object).Ulong C.PyLong_AsUnsignedLong
|
||||
func (l *Object) Ulong() c.Ulong { return 0 }
|
||||
|
||||
// llgo:link (*Object).UlongLong C.PyLong_AsUnsignedLongLong
|
||||
func (l *Object) UlongLong() c.UlongLong { return 0 }
|
||||
|
||||
// llgo:link (*Object).Uintptr C.PyLong_AsSize_t
|
||||
func (l *Object) Uintptr() uintptr { return 0 }
|
||||
|
||||
// llgo:link (*Object).LongAsFloat64 C.PyLong_AsDouble
|
||||
func (l *Object) LongAsFloat64() float64 { return 0 }
|
||||
|
||||
// llgo:link (*Object).LongAsVoidPtr C.PyLong_AsVoidPtr
|
||||
func (l *Object) LongAsVoidPtr() c.Pointer { return nil }
|
||||
31
py/math/doc.txt
Normal file
31
py/math/doc.txt
Normal file
@@ -0,0 +1,31 @@
|
||||
// Unlike the built-in ** operator, math.pow() converts both its arguments to type
|
||||
// float. Use ** or the built-in pow() function for computing exact integer powers.
|
||||
//
|
||||
//go:linkname Pow py.pow
|
||||
func Pow(x, y *py.Object) *py.Object
|
||||
|
||||
// Return the sine of x radians.
|
||||
//
|
||||
//go:linkname Sin py.sin
|
||||
func Sin(x *py.Object) *py.Object
|
||||
|
||||
// Return the hyperbolic sine of x.
|
||||
//
|
||||
//go:linkname Sinh py.sinh
|
||||
func Sinh(x *py.Object) *py.Object
|
||||
|
||||
// Return the base-2 logarithm of x. This is usually more accurate than log(x, 2).
|
||||
//
|
||||
//go:linkname Log2 py.log2
|
||||
func Log2(x *py.Object) *py.Object
|
||||
|
||||
// Return the base-10 logarithm of x. This is usually more accurate than log(x, 10).
|
||||
//
|
||||
//go:linkname Log10 py.log10
|
||||
func Log10(x *py.Object) *py.Object
|
||||
|
||||
// Return the fractional and integer parts of x. Both results carry the sign of
|
||||
// x and are floats.
|
||||
//
|
||||
//go:linkname Modf py.modf
|
||||
func Modf(x *py.Object) *py.Object
|
||||
@@ -174,7 +174,90 @@ func Gamma(x *py.Object) *py.Object
|
||||
// Greatest Common Divisor.
|
||||
//
|
||||
//go:linkname Gcd py.gcd
|
||||
func Gcd(integers ...*py.Object) *py.Object
|
||||
func Gcd(__llgo_va_list ...interface{}) *py.Object
|
||||
|
||||
// Return True if x is neither an infinity nor a NaN, and False otherwise.
|
||||
//
|
||||
//go:linkname Isfinite py.isfinite
|
||||
func Isfinite(x *py.Object) *py.Object
|
||||
|
||||
// Return True if x is a positive or negative infinity, and False otherwise.
|
||||
//
|
||||
//go:linkname Isinf py.isinf
|
||||
func Isinf(x *py.Object) *py.Object
|
||||
|
||||
// Return True if x is a NaN (not a number), and False otherwise.
|
||||
//
|
||||
//go:linkname Isnan py.isnan
|
||||
func Isnan(x *py.Object) *py.Object
|
||||
|
||||
// Return the integer part of the square root of the input.
|
||||
//
|
||||
//go:linkname Isqrt py.isqrt
|
||||
func Isqrt(n *py.Object) *py.Object
|
||||
|
||||
// Least Common Multiple.
|
||||
//
|
||||
//go:linkname Lcm py.lcm
|
||||
func Lcm(__llgo_va_list ...interface{}) *py.Object
|
||||
|
||||
// Return x * (2**i).
|
||||
//
|
||||
// This is essentially the inverse of frexp().
|
||||
//
|
||||
//go:linkname Ldexp py.ldexp
|
||||
func Ldexp(x *py.Object, i *py.Object) *py.Object
|
||||
|
||||
// Natural logarithm of absolute value of Gamma function at x.
|
||||
//
|
||||
//go:linkname Lgamma py.lgamma
|
||||
func Lgamma(x *py.Object) *py.Object
|
||||
|
||||
// Return the base 10 logarithm of x.
|
||||
//
|
||||
//go:linkname Log10 py.log10
|
||||
func Log10(x *py.Object) *py.Object
|
||||
|
||||
// Return the base 2 logarithm of x.
|
||||
//
|
||||
//go:linkname Log2 py.log2
|
||||
func Log2(x *py.Object) *py.Object
|
||||
|
||||
// Return the fractional and integer parts of x.
|
||||
//
|
||||
// Both results carry the sign of x and are floats.
|
||||
//
|
||||
//go:linkname Modf py.modf
|
||||
func Modf(x *py.Object) *py.Object
|
||||
|
||||
// Return x**y (x to the power of y).
|
||||
//
|
||||
//go:linkname Pow py.pow
|
||||
func Pow(x *py.Object, y *py.Object) *py.Object
|
||||
|
||||
// Convert angle x from degrees to radians.
|
||||
//
|
||||
//go:linkname Radians py.radians
|
||||
func Radians(x *py.Object) *py.Object
|
||||
|
||||
// Difference between x and the closest integer multiple of y.
|
||||
//
|
||||
// Return x - n*y where n*y is the closest integer multiple of y.
|
||||
// In the case where x is exactly halfway between two multiples of
|
||||
// y, the nearest even value of n is used. The result is always exact.
|
||||
//
|
||||
//go:linkname Remainder py.remainder
|
||||
func Remainder(x *py.Object, y *py.Object) *py.Object
|
||||
|
||||
// Return the sine of x (measured in radians).
|
||||
//
|
||||
//go:linkname Sin py.sin
|
||||
func Sin(x *py.Object) *py.Object
|
||||
|
||||
// Return the hyperbolic sine of x.
|
||||
//
|
||||
//go:linkname Sinh py.sinh
|
||||
func Sinh(x *py.Object) *py.Object
|
||||
|
||||
// Return the square root of x.
|
||||
//
|
||||
|
||||
@@ -27,22 +27,6 @@ import (
|
||||
//go:linkname Pi py.pi
|
||||
var Pi *py.Object
|
||||
|
||||
// Unlike the built-in ** operator, math.pow() converts both its arguments to type
|
||||
// float. Use ** or the built-in pow() function for computing exact integer powers.
|
||||
//
|
||||
//go:linkname Pow py.pow
|
||||
func Pow(x, y *py.Object) *py.Object
|
||||
|
||||
// Return the sine of x radians.
|
||||
//
|
||||
//go:linkname Sin py.sin
|
||||
func Sin(x *py.Object) *py.Object
|
||||
|
||||
// Return the hyperbolic sine of x.
|
||||
//
|
||||
//go:linkname Sinh py.sinh
|
||||
func Sinh(x *py.Object) *py.Object
|
||||
|
||||
// With one argument, return the natural logarithm of x (to base e).
|
||||
//
|
||||
//go:linkname Log py.log
|
||||
@@ -60,22 +44,6 @@ func LogOf(x, base *py.Object) *py.Object
|
||||
//go:linkname Log1p py.log1p
|
||||
func Log1p(x *py.Object) *py.Object
|
||||
|
||||
// Return the base-2 logarithm of x. This is usually more accurate than log(x, 2).
|
||||
//
|
||||
//go:linkname Log2 py.log2
|
||||
func Log2(x *py.Object) *py.Object
|
||||
|
||||
// Return the base-10 logarithm of x. This is usually more accurate than log(x, 10).
|
||||
//
|
||||
//go:linkname Log10 py.log10
|
||||
func Log10(x *py.Object) *py.Object
|
||||
|
||||
// Return the fractional and integer parts of x. Both results carry the sign of
|
||||
// x and are floats.
|
||||
//
|
||||
//go:linkname Modf py.modf
|
||||
func Modf(x *py.Object) *py.Object
|
||||
|
||||
// Return the Euclidean norm, sqrt(sum(x**2 for x in coordinates)). This is the
|
||||
// length of the vector from the origin to the point given by the coordinates.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user