https://bugs.documentfoundation.org/show_bug.cgi?id=145617

            Bug ID: 145617
           Summary: Documentation for CINT%: inappropriate, incomplete and
                    misleading
           Product: LibreOffice
           Version: 7.3.0.0 alpha0+ Master
          Hardware: x86-64 (AMD64)
                OS: Linux (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Documentation
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]

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 >

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to