Skip to main content
Convert Value icon

Convert Value

1 Sürüm

Casts a primitive scalar stream from one numeric, character, or boolean type to another, tick-for-tick, following standard C++ conversion rules. Acts as a type bridge between mismatched primitive streams.

How it fits

{{type:t1}} -> {{component:convert_value}} -> {{type:t2}}

Both t1 and t2 are drawn from the same primitive set: Int32, Int64, UInt32, UInt64, Bool, Char, Float, Double. The surrounding graph fixes the input type and the consumer fixes the output type; convert_value casts each value from the former to the latter.

Type behaviour

  • Every value passes through static_cast-style conversion: int <-> float, narrow <-> wide, signed <-> unsigned, and bool/char are all handled by the underlying C++ rules — there is no custom rounding or saturation logic.
  • Widening (e.g. Int32 -> Int64, Float -> Double) is value-preserving.
  • Narrowing (e.g. Int64 -> Int32, Double -> Float) can lose precision or overflow; out-of-range integers wrap and out-of-range floats are undefined per C++ semantics — no error is raised.
  • Float -> integer truncates toward zero (the fractional part is dropped, not rounded).
  • Signed -> unsigned of a negative value wraps modulo the type width; Bool converts to/from 0/1; Char is treated as its integer code point.

Typical backends

  • Integer to float for thresholds: an integer counter -> {{component:convert_value}} -> {{component:evaluate_expression}}.
  • Float to integer for indexing: a {{type:Float}} score -> {{component:convert_value}} -> {{component:select_stream}}.
  • Boolean to integer for serialisation: a {{type:Bool}} flag -> {{component:convert_value}} -> {{component:output_json_http}}.
  • Down-narrowing for transport: {{type:Double}} -> {{component:convert_value}} -> {{type:Float}} -> {{component:output_browser_stream}}.

Caveats

  • Narrowing and signed/unsigned casts can silently lose precision or wrap — convert_value never clamps, rounds-to-nearest, or signals an error on overflow.
  • Primitive scalars only; record, tuple, or named shape changes belong in {{component:pack_record}} / {{component:unpack_record}} chains, not here.
  • Output cadence matches input cadence one-to-one; there is no buffering, batching, or rate change.

Sürümler

  • 8a100228defaultlatestlinuxDönüşüm