Bug 151171 - Basic editor: Bad number from hexa value
Summary: Basic editor: Bad number from hexa value
Status: CLOSED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
6.4 all versions
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-25 09:28 UTC by Kamil Landa
Modified: 2022-09-25 10:59 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kamil Landa 2022-09-25 09:28:12 UTC
Try to set some number with 4 digits and more in hexa code, it returns bad decimal number. Example with macro:


Sub bugHexaNumber
	msgbox CLng("&hF000") '61440 OK
	msgbox &hF000 '-4096 BUG
End Sub


OK:
Verze: 6.3.0.1 (x64)
ID sestavení: 41ac97386aba908b6db860cfb4cfe2da871886ae
Vlákna CPU: 2; OS: Windows 6.1; Vykreslování UI: výchozí; VCL: win;
Národní prostředí: cs-CZ (cs_CZ); UI-Language: cs-CZ
Calc: CL


BUG:
Version: 7.0.0.1 (x64)
Build ID: 04ba7e3f1e51af6c5d653e543a620e36719083fd
Vlákna CPU: 2; OS: Windows 6.1 Service Pack 1 Build 7601; Vykreslování UI: Skia/rastr; VCL: win
Locale: cs-CZ (cs_CZ); UI: cs-CZ
Calc: CL

Version: 7.4.2.1 (x64) / LibreOffice Community
Build ID: 681d65acd9ede00dd724d6716f21cabfdcc95bd2
CPU threads: 8; OS: Windows 10.0 Build 17763; UI render: Skia/Raster; VCL: win
Locale: cs-CZ (cs_CZ); UI: cs-CZ
Calc: CL
Comment 1 Eike Rathke 2022-09-25 10:59:25 UTC
Not a bug.

In  msgbox &hF000  the &hF000 is a 16-bit (short) integer constant where the leading high bit is a sign bit and indicates a twos complement negative number. This was fixed in 6.4.0 for bug 62326.

Force a 32-bit (long) constant with  &hF000&