https://bugs.winehq.org/show_bug.cgi?id=55185
Bug ID: 55185 Summary: vbscript round does not handle numdecimalplaces argument Product: Wine Version: 8.11 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: vbscript Assignee: wine-bugs@winehq.org Reporter: jsm174@gmail.com Distribution: ---
We just found an issue where round wasn't returning expected values when using the `numdecimalplaces` argument.
After looking at `Global_Round`, the second argument is not even looked at.
As a test, I modified the code to use: `VarR8Round` which seems to work well:
``` int decimal_places = 0; double n; double n2; HRESULT hres; . . . if (args_cnt > 1) { if (V_VT(args+1) != VT_ERROR) { hres = to_int(args+1, &decimal_places); if (FAILED(hres)) return hres; } }
hres = VarR8Round(n, decimal_places, &n2); if(FAILED(hres)) return hres;
return return_double(res, n2); ```
https://bugs.winehq.org/show_bug.cgi?id=55185
--- Comment #1 from Nikolay Sivov bunglehead@gmail.com --- As it happens, VarR8Round() itself is broken, it returns -2.0 for {-3.5,0} input. We'll need to fix that first.
https://bugs.winehq.org/show_bug.cgi?id=55185
--- Comment #2 from Nikolay Sivov bunglehead@gmail.com --- Created attachment 75542 --> https://bugs.winehq.org/attachment.cgi?id=75542 tests
Attaching some tests.
https://bugs.winehq.org/show_bug.cgi?id=55185
Robert Wilhelm sloper42@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |sloper42@yahoo.com
--- Comment #3 from Robert Wilhelm sloper42@yahoo.com --- Created attachment 75547 --> https://bugs.winehq.org/attachment.cgi?id=75547 VarR8round: round -x.5 to next even number.
I think we have to change the sign for -0.5 case.
https://bugs.winehq.org/show_bug.cgi?id=55185
Robert Wilhelm sloper42@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1
--- Comment #4 from Robert Wilhelm sloper42@yahoo.com --- https://gitlab.winehq.org/wine/wine/-/merge_requests/4534
https://bugs.winehq.org/show_bug.cgi?id=55185
--- Comment #5 from Nikolay Sivov bunglehead@gmail.com --- (In reply to Robert Wilhelm from comment #4)
Thanks, Robert. This is merged now. Could you please submit the vbscript part too?
https://bugs.winehq.org/show_bug.cgi?id=55185
--- Comment #6 from Robert Wilhelm sloper42@yahoo.com --- OK, I will submit MR for vbscript part using JasonĀ“s and your work.
https://bugs.winehq.org/show_bug.cgi?id=55185
Robert Wilhelm sloper42@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch
--- Comment #7 from Robert Wilhelm sloper42@yahoo.com --- https://gitlab.winehq.org/wine/wine/-/merge_requests/4569
https://bugs.winehq.org/show_bug.cgi?id=55185
Robert Wilhelm sloper42@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED
--- Comment #8 from Robert Wilhelm sloper42@yahoo.com --- Fixed by 0d6c905add980db7902164d59576977d41b9230d and 369b540abf32869df8e9b28e283d795ae92b6a05.
https://bugs.winehq.org/show_bug.cgi?id=55185
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #9 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 9.0-rc1.