diff options
author | yenlin.lai <yenlin.lai@cobinhood.com> | 2019-03-25 16:25:46 +0800 |
---|---|---|
committer | yenlinlai <38415072+yenlinlai@users.noreply.github.com> | 2019-03-29 10:50:26 +0800 |
commit | aa8a495dd1acdcb6aac1fed13d2ed058cf3b5030 (patch) | |
tree | 2e5205ff0397436ec45106f63990dde1d17311fe | |
parent | 077dad5493da2935813e248241694f4a99837c3e (diff) | |
download | dexon-decimal-aa8a495dd1acdcb6aac1fed13d2ed058cf3b5030.tar.gz dexon-decimal-aa8a495dd1acdcb6aac1fed13d2ed058cf3b5030.tar.zst dexon-decimal-aa8a495dd1acdcb6aac1fed13d2ed058cf3b5030.zip |
misc: export rescale function
This will be useful when we are handling coefficients of decimals.
-rw-r--r-- | decimal.go | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -344,6 +344,14 @@ func NewFromFloatWithExponent(value float64, exp int32) Decimal { } } +// Rescale returns a rescaled version of the decimal. Returned +// decimal may be less precise if the given exponent is bigger +// than the initial exponent of the Decimal. +// NOTE: this will truncate, NOT round +func (d Decimal) Rescale(exp int32) Decimal { + return d.rescale(exp) +} + // rescale returns a rescaled version of the decimal. Returned // decimal may be less precise if the given exponent is bigger // than the initial exponent of the Decimal. |