@@ -34,6 +34,13 @@ namespace ignite {
3434 */
3535class big_decimal {
3636public:
37+
38+ enum class rounding_mode {
39+ // TODO support other rounding modes
40+ DOWN,
41+ HALF_UP
42+ };
43+
3744 // Default
3845 big_decimal () = default ;
3946
@@ -51,7 +58,7 @@ class big_decimal {
5158 */
5259 big_decimal (const std::int8_t *mag, std::int32_t len, std::int16_t scale, std::int8_t sign, bool big_endian = true )
5360 : m_scale(std::int16_t (scale & 0x7FFF ))
54- , m_magnitude(mag, len, sign, big_endian) {}
61+ , m_magnitude(mag, len, sign, big_endian) { }
5562
5663 /* *
5764 * Constructs a big decimal from the byte array.
@@ -67,7 +74,7 @@ class big_decimal {
6774 * @param val Integer value.
6875 */
6976 explicit big_decimal (int64_t val)
70- : m_magnitude(val) {}
77+ : m_magnitude(val) { }
7178
7279 /* *
7380 * Integer constructor with scale.
@@ -77,7 +84,7 @@ class big_decimal {
7784 */
7885 big_decimal (int64_t val, int16_t scale)
7986 : m_scale(scale)
80- , m_magnitude(val) {}
87+ , m_magnitude(val) { }
8188
8289 /* *
8390 * big_integer constructor with scale.
@@ -87,7 +94,7 @@ class big_decimal {
8794 */
8895 big_decimal (const big_integer &val, int16_t scale)
8996 : m_scale(scale)
90- , m_magnitude(val) {}
97+ , m_magnitude(val) { }
9198
9299 /* *
93100 * big_integer constructor with scale.
@@ -97,7 +104,7 @@ class big_decimal {
97104 */
98105 big_decimal (big_integer &&val, int16_t scale)
99106 : m_scale(scale)
100- , m_magnitude(std::forward<big_integer>(val)) {}
107+ , m_magnitude(std::forward<big_integer>(val)) { }
101108
102109 /* *
103110 * String constructor.
@@ -212,7 +219,7 @@ class big_decimal {
212219 * @param scale Scale to set.
213220 * @param res Result is placed here. Can be *this.
214221 */
215- void set_scale (std::int16_t new_scale, big_decimal &res) const ;
222+ void set_scale (std::int16_t new_scale, big_decimal &res, rounding_mode r_mode = rounding_mode::DOWN ) const ;
216223
217224 /* *
218225 * Get precision of the Decimal.
0 commit comments