Run script for LO Basic and for VBA: Option VbaSupport 1 ' only LO Basic Sub Test Msgbox CLng(2.5) ' 3 in LO Basic, 2 in VBA Msgbox Round(2.5) ' 2 in LO Basic, 2 in VBA (correct) Msgbox Mid("abc", 2.5, 1) ' c in LO Basic, b in VBA End Sub Possible reason for different results: [1], 5.5.1.2.1 Let-coercion between numeric types. Source Value Type: Any floating point or fixed point type Destination Declared Type: Any integral type "If the source value is finite (not positive infinity, negative infinity or NaN) and is within the range of the destination type, the result is the value converted to an integer using Banker’s rounding (section 5.5.1.2.1.1)". [1]. [MS-VBAL] - v20240521. VBA Language Specification. Copyright © 2024 Microsoft Corporation. Release: May 21, 2024. https://learn.microsoft.com/en-us/openspecs/microsoft_general_purpose_programming_languages/ms-vbal/d5418146-0bd2-45eb-9c7a-fd9502722c74
I'm encountering Bug 162711, which states that in VBASupport mode, conversion to Integral type should utilize banker's rounding. If anyone has insights or workarounds for this issue, please share your experiences. It’s important to ensure accuracy in conversions, so any help would be appreciated! For additional information, check out https://dubaiinsights.ae.
Repro with macro. Arch Linux 64-bit Version: 25.8.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: cc65bec38ca26265ce8ecfd02110c26bcc62b79b CPU threads: 8; OS: Linux 6.12; UI render: default; VCL: kf6 (cairo+wayland) Locale: fi-FI (fi_FI.UTF-8); UI: en-US Calc: CL threaded Built on 11 December 2024