Bug 54535

Summary: [PATCH] Bug in INTERCEPT and SLOPE
Product: POI Reporter: Johan Karlsteen <johan.karlsteen>
Component: POI OverallAssignee: POI Developers List <dev>
Severity: normal    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X 10.4   
Attachments: Bugfix
Additions to FormulaEvalTestData.xls

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