[Tarantool-patches] [PATCH luajit 5/5] Revert to trival pow() optimizations to prevent inaccuracies.

Sergey Kaplun skaplun at tarantool.org
Mon Aug 21 11:16:32 MSK 2023


Hi, Sergey!
Thanks for the review!
Fixed your comments and force-pushed the branch.

On 18.08.23, Sergey Bronnikov wrote:
> Hi, Sergey
> 
> 
> Thanks for the patch!
> 
> typo in subj: trival -> trivial, however seems it is not fixable because 
> a part of original commit
> 
> LGTM
> 
> 
> On 8/15/23 12:36, Sergey Kaplun wrote:
> > From: Mike Pall <mike>
> >
> > (cherry-picked from commit 96d6d5032098ea9f0002165394a8774dcaa0c0ce)
> >
> > This patch fixes different misbehaviour between JIT-compiled code and
> typo: misbehaviour -> misbehaviours

Fixed.

> > the interpreter for power operator with the following ways:
> > * Drop folding optimizations for base ^ n => base * base ..., as far as
> >    pow(base, n) isn't interchangeable with just multiplicity of numbers
> >    and depends on the <math.h> implementation.
> > * Since the internal power function is inaccurate for very big or small
> >    powers, it is dropped, and `pow()` from the standard library is used
> >    instead. To save consistency between JIT behaviour and the VM
> >    narrowing optimization is dropped, and only trivial folding
> >    optimizations are used. Also, `math_extern2` version with two
> >    parameters is dropped, since it's no more used.
> >
> > Also, this fixes failures of the [220/502] lib/string/format/num.lua
> > test [1] from LuaJIT-test suite.
> >
> > [1]: https://www.exploringbinary.com/incorrect-floating-point-to-decimal-conversions/
> >
> > Sergey Kaplun:
> > * added the description and the test for the problem
> >
> > Part of tarantool/tarantool#8825
> > ---

<snipped>

> >     return base ^ power

-- 
Best regards,
Sergey Kaplun


More information about the Tarantool-patches mailing list