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

Sergey Kaplun skaplun at tarantool.org
Mon Aug 21 12:36:05 MSK 2023


Hi, Maxim!
Thanks for the updates!
Fixed your comment, see the iterative patch below.
Branch is force-pushed.

On 21.08.23, Maxim Kokryashkin wrote:
> Hi, Sergey!
> Thanks for the patch!
> LGTM now, except for a single comment below.
> Also, see my answers too.

<snipped>

> > > >  
> > > > +-- -948388 ^ 3 = -0x1.7ad0e8ad7439dp+59.
> > > Same as in the previous patch, we need some additinal commentary for
> > > those magic numbers.
> > 
> > See my answer in the previous reply.
> I think the same commentary, as one I suggested in reply, will do.

Added.

===================================================================
diff --git a/test/tarantool-tests/lj-684-pow-inconsistencies.test.lua b/test/tarantool-tests/lj-684-pow-inconsistencies.test.lua
index 10984d33..c0c63cce 100644
--- a/test/tarantool-tests/lj-684-pow-inconsistencies.test.lua
+++ b/test/tarantool-tests/lj-684-pow-inconsistencies.test.lua
@@ -70,6 +70,9 @@ test:samevalues(res, ('consistent results for folding 2921 ^ 0.5'))
 
 -- -948388 ^ 3 = -0x1.7ad0e8ad7439dp+59.
 res = {}
+-- This number has no special meaning and is used as one that
+-- gives different results when its power of 3 is obtained with
+-- glibc's `pow()` and `x * x * x` operations.
 -- XXX: use local variable to prevent folding via parser.
 -- XXX: use stack slot out of trace to prevent constant folding.
 local corner_case_pow_3 = -948388
===================================================================

> > 

<snipped>

-- 
Best regards,
Sergey Kaplun


More information about the Tarantool-patches mailing list