MCPcopy
hub / github.com/google/mtail / PopFloat

Method PopFloat

internal/runtime/vm/vm.go:152–169  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

150}
151
152func (t *thread) PopFloat() (float64, error) {
153 val := t.Pop()
154 switch n := val.(type) {
155 case float64:
156 return n, nil
157 case int:
158 return float64(n), nil
159 case string:
160 r, err := strconv.ParseFloat(n, 64)
161 if err != nil {
162 return 0, errors.Wrapf(err, "conversion of %q to float failed", val)
163 }
164 return r, nil
165 case datum.Datum:
166 return datum.GetFloat(n), nil
167 }
168 return 0, errors.Errorf("unexpected float type %T %q", val, val)
169}
170
171func (t *thread) PopString() (string, error) {
172 val := t.Pop()

Callers 2

TestDatumFetchInstrsFunction · 0.80
executeMethod · 0.80

Calls 2

PopMethod · 0.95
GetFloatFunction · 0.92

Tested by 1

TestDatumFetchInstrsFunction · 0.64