diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2020-10-30 17:23:53 +0100 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2020-10-30 17:23:53 +0100 |
commit | 794f66513967891520ec432123dcff8270871b93 (patch) | |
tree | da31ab80611c016e9dca9af28ffd65c4a838e2f5 /sql/my_decimal.h | |
parent | 14d43f4fa691e3af113195a3608f1fc401b85090 (diff) | |
parent | 72eea39d4c4a8bcadccfdac457e61abc7b618ff8 (diff) | |
download | mariadb-git-794f66513967891520ec432123dcff8270871b93.tar.gz |
Merge branch '10.2' into 10.3
Diffstat (limited to 'sql/my_decimal.h')
-rw-r--r-- | sql/my_decimal.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sql/my_decimal.h b/sql/my_decimal.h index b409a87bdd4..c6c6f4b55e3 100644 --- a/sql/my_decimal.h +++ b/sql/my_decimal.h @@ -304,6 +304,17 @@ bool my_decimal_is_zero(const my_decimal *decimal_value) inline +int my_decimal_round_if_needed(uint mask, my_decimal *dec, int scale, + bool truncate) +{ + if (scale >= dec->frac) + return E_DEC_OK; + return check_result(mask, decimal_round(dec, dec, scale, + (truncate ? TRUNCATE : HALF_UP))); +} + + +inline int my_decimal_round(uint mask, const my_decimal *from, int scale, bool truncate, my_decimal *to) { |