代码拉取完成,页面将自动刷新
package main
import (
"github.com/Knetic/govaluate"
"math"
)
var functions = map[string]govaluate.ExpressionFunction{
// Trigonometrics
"sin": func(args ...interface{}) (interface{}, error) {
return (float64)(math.Sin(args[0].(float64))), nil
},
"cos": func(args ...interface{}) (interface{}, error) {
return (float64)(math.Cos(args[0].(float64))), nil
},
"tan": func(args ...interface{}) (interface{}, error) {
return (float64)(math.Tan(args[0].(float64))), nil
},
"sinh": func(args ...interface{}) (interface{}, error) {
return (float64)(math.Sinh(args[0].(float64))), nil
},
"cosh": func(args ...interface{}) (interface{}, error) {
return (float64)(math.Cosh(args[0].(float64))), nil
},
"tanh": func(args ...interface{}) (interface{}, error) {
return (float64)(math.Tanh(args[0].(float64))), nil
},
"arcsin": func(args ...interface{}) (interface{}, error) {
return (float64)(math.Asin(args[0].(float64))), nil
},
"arccos": func(args ...interface{}) (interface{}, error) {
return (float64)(math.Acos(args[0].(float64))), nil
},
"arctan": func(args ...interface{}) (interface{}, error) {
return (float64)(math.Atan(args[0].(float64))), nil
},
"arcsinh": func(args ...interface{}) (interface{}, error) {
return (float64)(math.Asinh(args[0].(float64))), nil
},
"arccosh": func(args ...interface{}) (interface{}, error) {
return (float64)(math.Acosh(args[0].(float64))), nil
},
"arctanh": func(args ...interface{}) (interface{}, error) {
return (float64)(math.Atanh(args[0].(float64))), nil
},
"hypot": func(args ...interface{}) (interface{}, error) {
return (float64)(math.Hypot(args[0].(float64), args[1].(float64))), nil
},
// Roots
"sqrt": func(args ...interface{}) (interface{}, error) {
return (float64)(math.Sqrt(args[0].(float64))), nil
},
"cbrt": func(args ...interface{}) (interface{}, error) {
return (float64)(math.Cbrt(args[0].(float64))), nil
},
// Logarithms
"lb": func(args ...interface{}) (interface{}, error) {
return (float64)(math.Log2(args[0].(float64))), nil
},
"ln": func(args ...interface{}) (interface{}, error) {
return (float64)(math.Log(args[0].(float64))), nil
},
"lg": func(args ...interface{}) (interface{}, error) {
return (float64)(math.Log10(args[0].(float64))), nil
},
// Exponentials
"pow10": func(args ...interface{}) (interface{}, error) {
return (float64)(math.Pow10(args[0].(int))), nil
},
"pow": func(args ...interface{}) (interface{}, error) {
return (float64)(math.Pow(args[0].(float64), args[1].(float64))), nil
},
// Others
"abs": func(args ...interface{}) (interface{}, error) {
return (float64)(math.Abs(args[0].(float64))), nil
},
"ceil": func(args ...interface{}) (interface{}, error) {
return (float64)(math.Ceil(args[0].(float64))), nil
},
"floor": func(args ...interface{}) (interface{}, error) {
return (float64)(math.Floor(args[0].(float64))), nil
},
"mod": func(args ...interface{}) (interface{}, error) {
return (float64)(math.Mod(args[0].(float64), args[1].(float64))), nil
},
"max": func(args ...interface{}) (interface{}, error) {
return (float64)(math.Max(args[0].(float64), args[1].(float64))), nil
},
"min": func(args ...interface{}) (interface{}, error) {
return (float64)(math.Min(args[0].(float64), args[1].(float64))), nil
},
"remainder": func(args ...interface{}) (interface{}, error) {
return (float64)(math.Remainder(args[0].(float64), args[1].(float64))), nil
},
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。