<HTML><BODY><div class="cl-fnq5vsxe7h"><div>Hi, Sergey! Thanks for the patch!</div><div> </div><div>LGTM.<br> </div><div data-signature-widget="container"><div data-signature-widget="content"><div>--<br>Best regards,</div><div>Evgeniy Temirgaleev</div></div></div><br><div class="mail-quote-collapse"><blockquote style="border-left:1px solid #0857A6;margin:10px;padding:0 0 0 10px"><span>From: Sergey Kaplun <<a href="mailto:skaplun@tarantool.org">skaplun@tarantool.org</a>><br>To: Sergey Bronnikov <<a href="mailto:sergeyb@tarantool.org">sergeyb@tarantool.org</a>>, Evgeniy Temirgaleev <<a href="mailto:e.temirgaleev@tarantool.org">e.temirgaleev@tarantool.org</a>><br>Cc: tarantool-patches@dev.tarantool.org, Sergey Kaplun <<a href="mailto:skaplun@tarantool.org">skaplun@tarantool.org</a>><br>Date: Tuesday, July 21, 2026 5:53 PM +03:00</span><br> <div><div id=""><div class="cl-8w3zhw9kj5"><div class="js-helper_mr_css_attr js-readmsg-msg_mr_css_attr"><div id="style_17846456051176223138_mr_css_attr"><div id="style_17846456051176223138_BODY_mr_css_attr">From: Mike Pall <mike><br><br>Reported by Peter Cawley.<br><br>(cherry picked from commit 32a683d226a3b57adbfeabff17d1ae0f7676545d)<br><br>On the arm architecture, the `tobit()` function incorrectly truncates<br>instead of rounding to the nearest integer. This leads to inconsistency<br>between various VMs (comparing to x86/x64, for example) and between the<br>arm VM and JIT.<br><br>This patch uses an addition of 2^52 + 2^51 constant to the given<br>argument to convert it to the nearest integer value. After reading the<br>lowest 32 bits of the register, we get the expected result.<br><br>The test is the same as for the previous commit.<br><br>Sergey Kaplun:<br>* added the description for the problem<br><br>Part of tarantool/tarantool#12880<br>---<br>src/vm_arm.dasc | 13 ++++++++++++-<br>1 file changed, 12 insertions(+), 1 deletion(-)<br><br>diff --git a/src/vm_arm.dasc b/src/vm_arm.dasc<br>index 7ed555f8..139f7fed 100644<br>--- a/src/vm_arm.dasc<br>+++ b/src/vm_arm.dasc<br>@@ -1829,9 +1829,19 @@ static void build_subroutines(BuildCtx *ctx)<br>|<br>|//-- Bit library --------------------------------------------------------<br>|<br>- |// FP number to bit conversion for soft-float. Clobbers r0-r3.<br>|->vm_tobit_fb:<br>| bhi ->fff_fallback<br>+ |.if FPU<br>+ |// FP number to bit conversion for hard-float. Clobbers r0, d0-d1.<br>+ | vldr d1, >9<br>+ | vmov d0, CARG1, CARG2<br>+ | vadd.f64 d0, d0, d1<br>+ | vmov CARG1, s0<br>+ | bx lr<br>+ |9:<br>+ | .long 0, 0x43380000 // (double)(2^52 + 2^51).<br>+ |.else<br>+ |// FP number to bit conversion for soft-float. Clobbers r0-r3.<br>|->vm_tobit:<br>| lsl RB, CARG2, #1<br>| adds RB, RB, #0x00200000<br>@@ -1856,6 +1866,7 @@ static void build_subroutines(BuildCtx *ctx)<br>| orr CARG1, CARG4, CARG1, lsl RB<br>| rsblt CARG1, CARG1, #0<br>| bx lr<br>+ |.endif<br>|<br>|.macro .ffunc_bit, name<br>| .ffunc_1 bit_..name<br>--<br>2.55.0</div></div></div></div></div></div></blockquote></div></div></BODY></HTML>