Issue 72590

Summary: ISEVEN_ADD, ISODD_ADD functions incorrect
Product: Calc Reporter: drking <openoffice>
Component: programmingAssignee: AOO issues mailing list <issues>
Status: ACCEPTED --- QA Contact:
Severity: Trivial    
Priority: P4 CC: issues, kpalagin
Version: OOo 2.0.4Keywords: oooqa
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Description Flags
iseven_add / odd review none

Description drking 2006-12-14 19:04:05 UTC
According to the Help these are supposed to be compatible with Excel. It would
therefore be useful if they returned a logical value not a number. Hmm.

As far as I can tell they produce the same results as Calc ISEVEN/ODD and Excel
ISEVEN/ODD for all numbers and empty cells, if you allow that 1 stands for TRUE.

But ISEVEN_ADD("dog") produces a different result from Excel. Same with ISODD_ADD.

All in all, not wonderful. Perhaps QA were having an off day....
Comment 1 kpalagin 2006-12-17 15:55:14 UTC
I can't find ISEVEN_ADD (ISODD_ADD) in the list of Excel functions. 
Comment 2 drking 2006-12-17 17:57:19 UTC
From the Help for ISEVEN in Calc:
"The functions whose names end with _ADD return the same results as the 
corresponding Microsoft Excel functions. Use the functions without _ADD to get 
results based on international standards. For example, the WEEKNUM function 
calculates the week number of a given date based on international standard ISO 
6801, while WEEKNUM_ADD returns the same week number as Microsoft Excel."

It's not very well worded, but what I think it means is that someone at OOo 
thought that the MS function ISEVEN did not do the job it should have. They 
implemented Calc ISEVEN 'properly', and provided ISEVEN_ADD to mimic what 
Excel does.
So you should be comparing Calc ISEVEN_ADD with MS ISEVEN.

Hope that is clearer, and thanks.

This has arisen because I am revising the Help wording. It's a bit glaring 
when every other Calc IS.. function returns TRUE or FALSE. Specifically the 
(...)) returns TRUE.

Comment 3 drking 2006-12-17 18:03:25 UTC
Created attachment 41492 [details]
iseven_add / odd review
Comment 4 dridgway 2007-01-02 02:07:48 UTC
Confirmed: return type of ISEVEN_ADD() differs from Excel.

Related documentation issues: documentation (English 2.1 anyway) does not make
clear what the distinction between ISEVEN() and ISEVEN_ADD() is supposed to be.
Also, ISEVEN() docs do not describe behavior for noninteger arguments. It
appears to truncate, like Excel, but this is not documented.
Comment 5 drking 2007-01-02 05:53:37 UTC
Thank you.

The proposed new HELP wording for ISEVEN / ISODD is at issue 71289. Part of it 
"If 'value' is not an integer any digits after the decimal point are ignored."

In fact this function should be moved to the Information Category of Help, 
alongside ISEVEN_ADD. My proposed wording in that Category (unpublished as yet) 
adds: "The sign of value is also ignored."

The proposed documentation for ISEVEN_ADD / ISODD_ADD rather skirts round the 
problem(!) - because the functions currently appear not to work as intended.
Comment 6 ooo 2007-01-08 13:30:31 UTC
Daniel, this is yours. With string arguments ISEVEN_ADD / ISODD_ADD need to
throw a different exception than lang::IllegalArgumentException to produce the
errNoValue error code.
Comment 7 drking 2007-01-08 15:49:14 UTC
drigdway said: "Also, ISEVEN() docs do not describe behavior for noninteger 
arguments. It appears to truncate, like Excel, but this is not documented."

The test appears to be:
( fmod( ::rtl::math::approxFloor( fabs( fVal ) ), 2.0 ) < 0.5 )

where fVal is being tested
so indeed it does ignore anything after the decimal point, and my proposed Help 
text is OK.
Comment 8 drking 2007-01-08 19:42:28 UTC
I can't find any other add-in function which returns a logical value (TRUE or 
FALSE). Of those that might:
ISLEAPYEAR() returns 1 or 0 (yuk), but this function is not implemented in Excel
GESTEP() and DELTA() return 1 or 0, which is the same as Excel.

Just thought that info might be helpful...

Comment 9 daniel.rentz 2007-01-09 12:50:58 UTC
Comment 10 daniel.rentz 2007-01-10 10:59:36 UTC
target OOo Later, needs changing the ::com:.sun::star::sheet::addin::XAnalysis