MCPcopy Create free account
hub / github.com/cogentcore/core / CheckFloats

Function CheckFloats

plot/data.go:29–44  ·  view source on GitHub ↗

CheckFloats returns an error if any of the arguments are Infinity. or if there are no non-NaN data points available for plotting.

(fs ...float32)

Source from the content-addressed store, hash-verified

27// CheckFloats returns an error if any of the arguments are Infinity.
28// or if there are no non-NaN data points available for plotting.
29func CheckFloats(fs ...float32) error {
30 n := 0
31 for _, f := range fs {
32 switch {
33 case math32.IsNaN(f):
34 case math32.IsInf(f, 0):
35 return ErrInfinity
36 default:
37 n++
38 }
39 }
40 if n == 0 {
41 return ErrNoData
42 }
43 return nil
44}
45
46// CheckNaNs returns true if any of the floats are NaN
47func CheckNaNs(fs ...float32) bool {

Callers 5

NewYErrorBarsFunction · 0.92
NewXErrorBarsFunction · 0.92
CopyValuesFunction · 0.85
CopyXYsFunction · 0.85
CopyXYZsFunction · 0.85

Calls 2

IsNaNFunction · 0.92
IsInfFunction · 0.92

Tested by

no test coverage detected