v.25.7Improvement
Improve the precision of conversion from Decimal
Improve the precision of conversion fromDecimaltoFloat32. Implement conversion fromDecimaltoBFloat16. Closes #82660. #82823 (Alexey Milovidov).
Why it matters
This feature enhances numerical accuracy when convertingDecimal types to floating-point representations, addressing precision loss issues. It also introduces the ability to convert Decimal values to BFloat16, enabling efficient storage and computation with reduced precision floating-point format.How to use it
Users can benefit from this improvement automatically when convertingDecimal columns to Float32 or BFloat16 types in queries or table definitions using CAST expressions, for example:SELECT CAST(decimal_column AS Float32) FROM table;
SELECT CAST(decimal_column AS BFloat16) FROM table;