Issue 72590 - ISEVEN_ADD, ISODD_ADD functions incorrect
Summary: ISEVEN_ADD, ISODD_ADD functions incorrect
Status: ACCEPTED
Alias: None
Product: Calc
Classification: Application
Component: programming (show other issues)
Version: OOo 2.0.4
Hardware: All All
: P4 Trivial (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords: oooqa
Depends on:
Blocks:
 
Reported: 2006-12-14 19:04 UTC by drking
Modified: 2013-08-07 15:12 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
iseven_add / odd review (10.35 KB, application/vnd.sun.xml.calc)
2006-12-17 18:03 UTC, drking
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
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
drking,
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 
formula =ISLOGICAL(ISEVEN_ADD(...)) returns FALSE - but =ISLOGICAL(ISEVEN
(...)) 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 
says:
"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
started
Comment 10 daniel.rentz 2007-01-10 10:59:36 UTC
target OOo Later, needs changing the ::com:.sun::star::sheet::addin::XAnalysis
interface.