Capy-Bearer Documentation

f64

lib call

Capy

function f64(value : as string, opt : dval = {}) f64

f64() converts the exact text from value to a floating-point value. The value must contain a complete decimal number. opt.fallback is the result for empty text or text that does not parse. It defaults to 0.0.

value accepts scalar values through as string. The conversion keeps scalar text exact. Empty and missing dval values both convert to empty text. Use value? before conversion when presence matters. An empty value is present, but a missing value is not.

The options map accepts only fallback. An unknown key, including base, is an error.

Parameters

value : scalar value or text to convert

opt : options map with fallback

Return Values

An f64 value, or opt.fallback.

Example

Capy

print(f64("3.5"), "\n")
print(f64("not a number", {fallback: 9.0}), "\n")