github.com/MontFerret/ferret@v0.18.0/pkg/stdlib/math/asin.go (about) 1 package math 2 3 import ( 4 "context" 5 "math" 6 7 "github.com/MontFerret/ferret/pkg/runtime/core" 8 "github.com/MontFerret/ferret/pkg/runtime/values" 9 "github.com/MontFerret/ferret/pkg/runtime/values/types" 10 ) 11 12 // ASIN returns the arcsine, in radians, of a given number. 13 // @param {Int | Float} number - Input number. 14 // @return {Float} - The arcsine, in radians, of a given number. 15 func Asin(_ context.Context, args ...core.Value) (core.Value, error) { 16 err := core.ValidateArgs(args, 1, 1) 17 18 if err != nil { 19 return values.None, err 20 } 21 22 err = core.ValidateType(args[0], types.Int, types.Float) 23 24 if err != nil { 25 return values.None, err 26 } 27 28 return values.NewFloat(math.Asin(toFloat(args[0]))), nil 29 }