v.25.7Improvement

Improve the precision of conversion from Decimal

Improve the precision of conversion from Decimal to Float32. Implement conversion from Decimal to BFloat16. Closes #82660. #82823 (Alexey Milovidov).
Improves the precision of conversion from Decimal to Float32 and adds support for conversion from Decimal to BFloat16.

Why it matters

This feature enhances numerical accuracy when converting Decimal 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 converting Decimal 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;