Closed MaceWindu closed 2 months ago
Version: latest (7.2.1)
// works property for decimal with 0 scale var d1 = new ClickHouseDecimal(1m); Console.WriteLine("{0}", (decimal)d1); // 1 Console.WriteLine("{0}", (int)d1); // 1 // works incorrectly for decimal with non-0 scale d1 = new ClickHouseDecimal(1.0m); Console.WriteLine("{0}", (decimal)d1); // 1.0 Console.WriteLine("{0}", (int)d1); // 100 - wrong! Console.WriteLine("{0}", (int)(decimal)d1); // 1 (workaround using intermediate decimal representation) d1 = new ClickHouseDecimal(1.1m); Console.WriteLine("{0}", (decimal)d1); // 1.1 Console.WriteLine("{0}", (int)d1); // 110 - wrong! Console.WriteLine("{0}", (int)(decimal)d1); // 1 (workaround using intermediate decimal representation)
Issue affects all integral types with conversion operator: int/uint/long/ulong
Thank you for reporting this - that's a bit embarassing, as it should have been covered by tests in theory. Fixed in release 7.2.2
Version: latest (7.2.1)