Inconsistent Formatting and Rounding in .NET/.NET Core and .NET Framework
|Product||Progress® Telerik® Reporting|
|.Net Framework||.NET 6|
When rendering report in .NET environment, including the Standalone Report Designer for .NET 6, the formatting and rounding of float values is not consistent with the ones in the .NET Framework, including the Standalone Designer for .NET Framework. In the latter, the rounding and the formatting work as expected.
Here are some screenshots showing the difference when previewing the same report in the two designers:
Our code utilizes the System methods for formatting that come from the corresponding framework. The reason for the problem is a breaking change introduced in .NET/.NET Core as explained in the following threads:
- Double value to string conversion difference between netcore and netframework
- Floating-Point Parsing and Formatting improvements in .NET Core 3.0
You may create a custom user function that takes as an argument the float value and returns the formatted string as desired. For example, you may use the workaround suggested in the following comment from the above resource.