To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=69749
                 Issue #|69749
                 Summary|trunc() function returns incorrect answer 
               Component|Spreadsheet
                 Version|OOo 2.0.2
                Platform|PC
                     URL|
              OS/Version|Linux
                  Status|UNCONFIRMED
       Status whiteboard|
                Keywords|
              Resolution|
              Issue type|DEFECT
                Priority|P3
            Subcomponent|code
             Assigned to|spreadsheet
             Reported by|bdillow





------- Additional comments from [EMAIL PROTECTED] Thu Sep 21 11:46:41 -0700 
2006 -------
I encountered this problem making a spreadsheet to convert decimal angles to
angles in degrees, minutes, and seconds. If trunc() is passed a value that must
be calculated, and the answer passed to trunc() is a multiple of 6, trunc()
returns one less than the correct answer. 

Example:
Cell     Formula                Data Displayed        Correct Answer
------   --------               --------------        --------------
A1         -                     22.2                  -
B1       =trunc(A1)              22                    same
C1       =trunc((A1-B1)*60)      11                   12
D1       =(((A1-B1)*60)-C1)*60   60                   0

22.2 degrees is 22 degrees, 12 minutes, 0 seconds

Cell     Formula                Data Displayed        Correct Answer
------   --------               --------------        --------------
A2         -                     12.1                  -
B2       =trunc(A2)              12                    same
C2       =trunc((A2-B2)*60)      5                    6
D2       =(((A2-B2)*60)-C2)*60   60                   0

12.1 degrees is 12 degrees, 6 minutes, 0 seconds

Cell     Formula                Data Displayed        Correct Answer
------   --------               --------------        --------------
A3         -                     36.8                  -
B3       =trunc(A3)              36                    same
C3       =trunc((A3-B3)*60)      47                   48
D3       =(((A3-B3)*60)-C3)*60   60                   0

36.8 degrees is 36 degrees, 48 minutes, 0 seconds

BUT: 

Cell     Formula                Data Displayed        Correct Answer
------   --------               --------------        --------------
A4         -                     0.2                  -
B4       =trunc(A4)              0                    same
C4       =trunc((A4-B4)*60)      12                   12
D4       =(((A4-B4)*60)-C4)*60   0                   0

0.2 as a starting number works correctly

I started the first column at zero, incremented by 0.1 each row and dragged down
to 100.0 The following range of values cause trunc() to return incorrect values:

5.1 - 18.8 (not including whole numbers, which give correct answers)
75.3 - 100 (INCLUDING whole numbers)

I haven't been able to recreate this bug with any other formulas or uses of
trunc(). It has similarly strange reactions to numbers with more decimal places,
e.g. 1.05 causes incorrect values as well.

---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to