Added more math consts (#404)
This commit is contained in:
parent
3f4245d962
commit
ecc3d9181e
2 changed files with 47 additions and 11 deletions
|
@ -18,6 +18,28 @@ math := import("math")
|
|||
- `ln10`
|
||||
- `ln10E`
|
||||
|
||||
Mathematical constants.
|
||||
|
||||
- `maxFloat32`
|
||||
- `smallestNonzeroFloat32`
|
||||
- `maxFloat64`
|
||||
- `smallestNonzeroFloat64`
|
||||
|
||||
Floating-point limit values. Max is the largest finite value representable by the type. SmallestNonzero is the smallest positive, non-zero value representable by the type.
|
||||
|
||||
- `maxInt`
|
||||
- `minInt`
|
||||
- `maxInt8`
|
||||
- `minInt8`
|
||||
- `maxInt16`
|
||||
- `minInt16`
|
||||
- `maxInt32`
|
||||
- `minInt32`
|
||||
- `maxInt64`
|
||||
- `minInt64`
|
||||
|
||||
Integer limit values.
|
||||
|
||||
## Functions
|
||||
|
||||
- `abs(x float) => float`: returns the absolute value of x.
|
||||
|
|
|
@ -7,17 +7,31 @@ import (
|
|||
)
|
||||
|
||||
var mathModule = map[string]tengo.Object{
|
||||
"e": &tengo.Float{Value: math.E},
|
||||
"pi": &tengo.Float{Value: math.Pi},
|
||||
"phi": &tengo.Float{Value: math.Phi},
|
||||
"sqrt2": &tengo.Float{Value: math.Sqrt2},
|
||||
"sqrtE": &tengo.Float{Value: math.SqrtE},
|
||||
"sqrtPi": &tengo.Float{Value: math.SqrtPi},
|
||||
"sqrtPhi": &tengo.Float{Value: math.SqrtPhi},
|
||||
"ln2": &tengo.Float{Value: math.Ln2},
|
||||
"log2E": &tengo.Float{Value: math.Log2E},
|
||||
"ln10": &tengo.Float{Value: math.Ln10},
|
||||
"log10E": &tengo.Float{Value: math.Log10E},
|
||||
"e": &tengo.Float{Value: math.E},
|
||||
"pi": &tengo.Float{Value: math.Pi},
|
||||
"phi": &tengo.Float{Value: math.Phi},
|
||||
"sqrt2": &tengo.Float{Value: math.Sqrt2},
|
||||
"sqrtE": &tengo.Float{Value: math.SqrtE},
|
||||
"sqrtPi": &tengo.Float{Value: math.SqrtPi},
|
||||
"sqrtPhi": &tengo.Float{Value: math.SqrtPhi},
|
||||
"ln2": &tengo.Float{Value: math.Ln2},
|
||||
"log2E": &tengo.Float{Value: math.Log2E},
|
||||
"ln10": &tengo.Float{Value: math.Ln10},
|
||||
"log10E": &tengo.Float{Value: math.Log10E},
|
||||
"maxFloat32": &tengo.Float{Value: math.MaxFloat32},
|
||||
"smallestNonzeroFloat32": &tengo.Float{Value: math.SmallestNonzeroFloat32},
|
||||
"maxFloat64": &tengo.Float{Value: math.MaxFloat64},
|
||||
"smallestNonzeroFloat64": &tengo.Float{Value: math.SmallestNonzeroFloat64},
|
||||
"maxInt": &tengo.Int{Value: math.MaxInt},
|
||||
"minInt": &tengo.Int{Value: math.MinInt},
|
||||
"maxInt8": &tengo.Int{Value: math.MaxInt8},
|
||||
"minInt8": &tengo.Int{Value: math.MinInt8},
|
||||
"maxInt16": &tengo.Int{Value: math.MaxInt16},
|
||||
"minInt16": &tengo.Int{Value: math.MinInt16},
|
||||
"maxInt32": &tengo.Int{Value: math.MaxInt32},
|
||||
"minInt32": &tengo.Int{Value: math.MinInt32},
|
||||
"maxInt64": &tengo.Int{Value: math.MaxInt64},
|
||||
"minInt64": &tengo.Int{Value: math.MinInt64},
|
||||
"abs": &tengo.UserFunction{
|
||||
Name: "abs",
|
||||
Value: FuncAFRF(math.Abs),
|
||||
|
|
Loading…
Reference in a new issue