protected static Ptg calcSlope( Ptg[] operands ) throws CalculationException
	{
		if( operands.length != 2 )
		{
			return new PtgErr( PtgErr.ERROR_VALUE );
		}
		double[] yvals = PtgCalculator.getDoubleValueArray( operands[0] );
		double[] xvals = PtgCalculator.getDoubleValueArray( operands[1] );
		if( (xvals == null) || (yvals == null) )
		{
			return new PtgErr( PtgErr.ERROR_NA );//20090130 KSC: propagate error
		}
		double sumXVals = 0;
		for( double xval1 : xvals )
		{
			sumXVals += xval1;
		}
		double sumYVals = 0;
		for( double yval : yvals )
		{
			sumYVals += yval;
		}
		double sumXYVals = 0;
		for( int i = 0; i < yvals.length; i++ )
		{
			sumXYVals += xvals[i] * yvals[i];
		}
		double sqrXVals = 0;
		for( double xval : xvals )
		{
			sqrXVals += xval * xval;
		}
		double toparg = (sumXVals * sumYVals) - (sumXYVals * yvals.length);
		double bottomarg = (sumXVals * sumXVals) - (sqrXVals * xvals.length);
		double res = toparg / bottomarg;
		return new PtgNumber( res );
	}