github.com/MontFerret/ferret@v0.18.0/pkg/stdlib/math/pi.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  )
    10  
    11  // PI returns Pi value.
    12  // @return {Float} - Pi value.
    13  func Pi(_ context.Context, args ...core.Value) (core.Value, error) {
    14  	err := core.ValidateArgs(args, 0, 0)
    15  
    16  	if err != nil {
    17  		return values.None, err
    18  	}
    19  
    20  	return values.NewFloat(math.Pi), nil
    21  }