Skip to content

vector.fptrunc

← vector dialect

Lanewise floating-point precision truncation using round-to-nearest, ties-to-even. Source and result shapes match exactly; only the floating-point element type narrows. 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. Without flags, the conversion preserves subnormal inputs and results. daz permits replacing a subnormal input with its signed zero before conversion; ftz permits replacing a subnormal result with its signed zero.

Operation contract

Property Value
Semantic phase executable
Traits Pure, Elementwise, Decomposable, SafeToSpeculate

Signature

Kind Name Type Cardinality Description
Operand input vector required —
Result result vector required —
Attribute subnormal flags FloatConversionFlags optional —

Verification constraints

  • HasFloatElement(input)
  • HasFloatElement(result)
  • SameKind(input, result)
  • SameShape(input, result)
  • ElementWidthLessThan(result, input)

Examples

Note

A canonical source example has not been added for this operation yet.