Lemonergy · Studio block

Numeric type conversion

Converts real, Boolean or 32-bit integer elements. Integer conversion truncates toward zero and saturates at the target bounds.

Implementation ID
native-type-conversion
Reviewed
2026-10-27

Behavior

integer output = clamp(trunc(input), target minimum, target maximum). Boolean output = (input ≠ 0).

Interface

Numeric type conversion interfaceInputs or arguments on the left, observed outputs on the right. Conserving terminals appear below the component. The tables give units and behavior.Numeric type conversionStudio blockin0out0
Original Lemonergy interface view. Lines identify ports; they are not a completed simulation circuit.
Ports and observed outputs
NameDirectionUnitMeaning
in0input1Input; real 3 array.
out0output1Integer output; i32 3 array.

Parameters

No configurable parameters for this component.

Equations and rules

  • integer output = clamp(trunc(input), target minimum, target maximum)
  • Boolean output = (input ≠ 0)

Worked example

Numeric type conversion — worked example

Input = [2.9,-4.9,6]. Integer output at 0 s = [2,-4,6].

Open Studio example after release →
Numerical checks for the bundled synthetic example
OutputTime (s)Expected valueUnitAbsolute tolerance
Integer output
out0
0[2, -4, 6]11e-09

Explore the recorded outputs

Numeric type conversion recorded example

Numeric type conversion [1]
Numeric type conversion [1] against timeRecorded synthetic simulation values. Time in seconds; output in —.1.501.750.2520.52.250.752.51—Time (s)
Numeric type conversion [1]: 2 — at 0 s

2 actual recorded samples. Lines are visual guides between samples. Synthetic example, not measured cell data.

Download the recorded samples (JSON) · Open this Studio example after release

Use in a workflow

Numeric type conversion — worked example

Converts real, Boolean or 32-bit integer elements. Integer conversion truncates toward zero and saturates at the target bounds.

  1. Numeric type conversion: integer output = clamp(trunc(input), target minimum, target maximum). Boolean output = (input ≠ 0).
    • Use the block reference for settings and connections.
    • Implementation tested locally; public release pending.
Open Studio example after release

Connected concepts

Limits and interpretation

  • Real, Boolean, signed32 and unsigned32 types only; complex and fixed-point scaling conversions are not supported.

Reference basis

This software operation is defined by its public contract and worked example; no external research result is claimed.

Implementation sources

This reference follows the public interface and locally verified numerical checks for an upcoming release.

Contract: Lemonergy Studio public contract · Verification record: verification-2026-10-27

  • docs/glossary/native-block-verification.json

This implementation and its workflow uses (JSON) · Knowledge graph (JSON-LD)