[PATCH v2 7/8] decimal: add conversions to (u)int64_t

Konstantin Osipov kostja at tarantool.org
Thu Aug 15 01:29:06 MSK 2019


* Konstantin Osipov <kostja at tarantool.org> [19/08/15 01:26]:
> > > Why do you think it's the best hint option? Why not keep 2-5 decimal
> > > digits in a hint, as most currencies use? Would it slow down the
> > > hing making process? You call decimalRescale anyway, it seems.
> > 
> > It wouldn’t slow down hint calculation (timing difference is tiny).
> > It will slow down decimal comparison with doubles and integers, though.
> > 
> > We will get faster comparison for decimals that differ in first 2-5 fractional
> > digits at the cost of having to cast every double and int to decimal for comparison
> > with decimals.
> > Is this worth it?
> 
> Please ask yourself this. How often do you think you will compare
> a decimal with another decimal, compared to a decimal with a
> float?

On the other hand, how often do you actually have distinct
fractional parts in a decimal... Decimal is mostly used to store
money/currency and most of the time fractional part is zero
nowadays, no matter what the currency is.

So I guess your approach is OK.

-- 
Konstantin Osipov, Moscow, Russia



More information about the Tarantool-patches mailing list