Skip to content

scalar.fptrunc

scalar dialect

Float precision truncation using round-to-nearest, ties-to-even. The result format must be strictly narrower than the input format. Special values follow the destination format: f8E4M3 saturates finite overflow and infinities to its signed maximum finite value while preserving NaNs; IEEE formats preserve infinities and NaNs.

Operation contract

Property Value
Semantic phase executable
Traits Pure

Signature

Kind Name Type Cardinality Description
Operand input float required
Result result float required

Verification constraints

  • ElementWidthLessThan(result, input)

Examples

%result = scalar.fptrunc %input : f32 to f16