MCPcopy Index your code
hub / github.com/expr-lang/expr / toFloat

Function toFloat

internal/testify/assert/assertions.go:1320–1356  ·  view source on GitHub ↗
(x interface{})

Source from the content-addressed store, hash-verified

1318}
1319
1320func toFloat(x interface{}) (float64, bool) {
1321 var xf float64
1322 xok := true
1323
1324 switch xn := x.(type) {
1325 case uint:
1326 xf = float64(xn)
1327 case uint8:
1328 xf = float64(xn)
1329 case uint16:
1330 xf = float64(xn)
1331 case uint32:
1332 xf = float64(xn)
1333 case uint64:
1334 xf = float64(xn)
1335 case int:
1336 xf = float64(xn)
1337 case int8:
1338 xf = float64(xn)
1339 case int16:
1340 xf = float64(xn)
1341 case int32:
1342 xf = float64(xn)
1343 case int64:
1344 xf = float64(xn)
1345 case float32:
1346 xf = float64(xn)
1347 case float64:
1348 xf = xn
1349 case time.Duration:
1350 xf = float64(xn)
1351 default:
1352 xok = false
1353 }
1354
1355 return xf, xok
1356}
1357
1358// InDelta asserts that the two numerals are within delta of each other.
1359//

Callers 2

InDeltaFunction · 0.70
calcRelativeErrorFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…