@@ -255,17 +255,27 @@ class DecimalV3Cast {
255
255
}
256
256
257
257
template <typename From, typename To>
258
- static inline bool to_float (DecimalType<From> const & value, DecimalType<From> const & scale_factor,
259
- FloatType<To>* to_value) {
260
- *to_value = static_cast <To>(static_cast <double >(value) / static_cast <double >(scale_factor));
261
- return false ;
262
- }
258
+ struct ToFloatHelper {
259
+ static bool convert (DecimalType<From> const & value, DecimalType<From> const & scale_factor,
260
+ FloatType<To>* to_value) {
261
+ *to_value = static_cast <To>(static_cast <double >(value) / static_cast <double >(scale_factor));
262
+ return false ;
263
+ }
264
+ };
263
265
264
266
template <typename To>
265
- static inline bool to_float (DecimalType<int128_t > const & value, DecimalType<int128_t > const & scale_factor,
267
+ struct ToFloatHelper <__int128, To> {
268
+ static bool convert (DecimalType<__int128> const & value, DecimalType<__int128> const & scale_factor,
269
+ FloatType<To>* to_value) {
270
+ *to_value = static_cast <To>(int128_to_double (value) / int128_to_double (scale_factor));
271
+ return false ;
272
+ }
273
+ };
274
+
275
+ template <typename From, typename To>
276
+ static inline bool to_float (DecimalType<From> const & value, DecimalType<From> const & scale_factor,
266
277
FloatType<To>* to_value) {
267
- *to_value = static_cast <To>(int128_to_double (value) / int128_to_double (scale_factor));
268
- return false ;
278
+ return ToFloatHelper<From, To>::convert (value, scale_factor, to_value);
269
279
}
270
280
271
281
template <typename From, typename To, bool check_overflow>
0 commit comments