Bug 54535 - [PATCH] Bug in INTERCEPT and SLOPE
Summary: [PATCH] Bug in INTERCEPT and SLOPE
Alias: None
Product: POI
Classification: Unclassified
Component: POI Overall (show other bugs)
Version: unspecified
Hardware: PC Mac OS X 10.4
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2013-02-07 10:25 UTC by Johan Karlsteen
Modified: 2013-11-04 21:27 UTC (History)
0 users

Bugfix (3.94 KB, application/x-gzip)
2013-02-07 10:25 UTC, Johan Karlsteen
Bugfix (1.65 KB, patch)
2013-07-05 07:20 UTC, Johan Karlsteen
Details | Diff
Additions to FormulaEvalTestData.xls (172.00 KB, application/octet-stream)
2013-07-05 07:23 UTC, Johan Karlsteen

Note You need to log in before you can comment on or make changes to this bug.
Description Johan Karlsteen 2013-02-07 10:25:52 UTC
Created attachment 29931 [details]

Found a bug in INTERCEPT and SLOPE that makes them unusable.

They are flipping x and y values so the result is wrong.

Small fix in LinearRegressionFunction.java and the test cases.
Comment 1 Nick Burch 2013-02-13 14:54:23 UTC
Would you be able to suggest some entries for FormulaEvalTestData.xls to cover these two functions?
Comment 2 Nick Burch 2013-02-13 16:34:40 UTC
Also, any chance you could re-do the patch without the Java 1.6 @Overrides? POI currently only requires 1.5, and your patch therefore introduces compiler errors when built with JDK 1.5...
Comment 3 Johan Karlsteen 2013-07-04 09:45:49 UTC
Sorry for the incredible bad response on my part. 

I have checked out a fresh copy of the trunk and to my understanding the patch is already applied?

I'm happy to remove the @Overrides and create a test case in the XLS file, should I do it as a new patch?
Comment 4 Johan Karlsteen 2013-07-05 07:20:19 UTC
Created attachment 30537 [details]

New version of the patch without @Override.
Comment 5 Johan Karlsteen 2013-07-05 07:23:40 UTC
Created attachment 30538 [details]
Additions to FormulaEvalTestData.xls

Added the following test cases to FormulaEvalTestData.xls:

Slope	FORMULA	=SLOPE(K7:K10,L7:L10)	=SLOPE(L7:L10,K7:K10)
	EXPECTED VALUE	0.846451557	1.09971

Intercept	FORMULA	=INTERCEPT(K7:K10,L7:L10)	=INTERCEPT(L7:L10,K7:K10)
	EXPECTED VALUE	-0.039545124	0.25095
Comment 6 Nick Burch 2013-09-02 11:48:45 UTC
Looks like this was closed in error - the patch still needs to be reviewed and applied before the bug is considered "fixed"
Comment 7 Cédric Walter 2013-11-04 21:27:58 UTC
review and integration test added to FormulaEvalTestData.xls
merged in trunk revision 1538772