MCPcopy Create free account
hub / github.com/bitfield/ftl-code / Sqrt

Function Sqrt

8.2/calculator.go:42–47  ·  view source on GitHub ↗

Sqrt returns the square root of its input, or an error for negative inputs.

(input float64)

Source from the content-addressed store, hash-verified

40// Sqrt returns the square root of its input,
41// or an error for negative inputs.
42func Sqrt(input float64) (float64, error) {
43 if input < 0 {
44 return 0, fmt.Errorf("square root of negative number not allowed: %f", input)
45 }
46 return math.Sqrt(input), nil
47}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected