Description: The documentation for the function CINT% is inappropriate, incomplete and misleading. Steps to Reproduce: 1. Examine the documentation for CInt Function. Actual Results: CInt Function Converts any string or numeric expression to an integer. Syntax: CInt (Expression) Return value: Integer Parameters: Expression: Any numeric expression that you want to convert. If the Expression exceeds the value range between -32768 and 32767, LibreOfficeDev Basic reports an overflow error. To convert a string expression, the number must be entered as normal text ("123.5") using the default number format of your operating system. This function always rounds the fractional part of a number to the nearest integer. Error codes: 5 Invalid procedure call Example: Sub ExampleCountryConvert MsgBox CDbl(1234.5678) MsgBox CInt(1234.5678) MsgBox CLng(1234.5678) End Sub Expected Results: CInt Function Converts any string or numeric expression to an integer. Syntax: CInt (Expression) Return value: Integer Parameters: Expression: Any numeric or string expression that you want to convert. If the Expression is a number that exceeds the value range between -32768 and 32767, LibreOfficeDev Basic reports an overflow error. A string parameter will be interpreted in a locale-specific way as specified in the operating system settings for floating-point number format. Initial blanks will be skipped and all trailing characters beginning with a non-digit will be ignored. Initial signs are allowed but any space following them will cause the string to be converted to 0. If the trimmed string begins with a base indicator &O or &H, the string will interpreted in the corresponding base using an universal integer format. Trailing letters that do not represent digits in the corresponding base (including ALL letters in base 8) immediately following the number will cause the function to unconditionally return 0. This function always rounds the fractional part of a number, if applicable, to the nearest integer. Error codes: 5 Invalid procedure call Example: Sub ExampleCountryConvert IF CINT% (" 1A ") <> 1 THEN STOP IF CINT% ("+ 1") <> 0 THEN STOP IF CINT% (" 1,235E2") <> 124 THEN STOP IF CINT% (" 1235E-1") <> 124 THEN STOP IF CINT% (" +&O10:A ") <> &O10 THEN STOP IF CINT% (" -&H10 ") <> -&H10 THEN STOP IF CINT% (" &O10A ") <> 0 THEN STOP IF CINT% (" -&H0A:X ") <> -&HA THEN STOP End Sub Reproducible: Always User Profile Reset: Yes OpenGL enabled: Yes Additional Info: <URL: https://help.libreoffice.org/7.3/en-US/text/sbasic/shared/03100500.html >
Hi Mike, Any opinion on this ?
I would like our documentation to be as complete and correct as possible. However, this proposal is unclear and partially incorrect to me. 1. It shows the existing text and proposed text verbatim, requiring me to inspect it carefully to find the difference (it would be nice if it just skipped unchanged parts, and suggested "change this: BLAH - to this: BLEH"). 2. It tells about operating system settings (and the older version did, too), which is wrong. What matters is LibreOffice configured locale settings, which *may* be (and by default is) defaulting to OS locale (but e.g. not to OS-configured custom separators - we have a issue for that). The proposal goes into details about as subtle matter as space between sign and following number, which I have never met in any reasonable programming language documentation (it's OK to mention trimming leading space). When mentioning hex/octal notation, we need to refer to an article about literals (do we have it yet?). Anyway, I fail where current help is "inappropriate" or "misleading". I would appreciate if users used appropriate wording trying to *not* demean the effort that others put into writing something that would simply not exist otherwise. Improving existing text is always easier than creating something new.
https://gerrit.libreoffice.org/c/help/+/125708 (it does not cover possible clarification of examples - I do not intend to improve that part, whoever wants to do it please assign the task to yourself and add the missing bits).
Hi Mike, thanks for looking into it
(In reply to Mike Kaganski from comment #3) > https://gerrit.libreoffice.org/c/help/+/125708 trinning?
claculating?
(In reply to Christopher Yeleighton from comment #5, comment #6) Thanks - fixed.
(In reply to Mike Kaganski from comment #2) > Anyway, I fail where current help is "inappropriate" or "misleading". I > would appreciate if users used appropriate wording trying to *not* demean > the effort that others put into writing something that would simply not > exist otherwise. Improving existing text is always easier than creating > something new. No, you succeeded in removing the offending parts just right, thank you very much. Also, I did not comment on anybody’s effort.
Mike Kaganski committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/help/commit/89f81cf2f81e2594a68956755114c733aeb041c5 tdf#145617: Mention an alternative exponent notation
Olivier Hallot committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/help/commit/b127658216cdbac1becdba794ea97f8f8b219e15 tdf#145617 break dense paragraph in bullets for CInt
Olivier Hallot committed a patch related to this issue. It has been pushed to "libreoffice-7-3": https://git.libreoffice.org/help/commit/18df2a92e4a63ca68e8479051d58d678daf70917 tdf#145617 break dense paragraph in bullets for CInt