protected static Ptg calcCorrel( Ptg[] operands ) throws CalculationException
	{
		// get the covariance
		PtgNumber pnum = (PtgNumber) calcCovar( operands );
		double covar = pnum.getVal();
		Ptg[] xPtg = new Ptg[1];
		xPtg[0] = operands[0];
		Ptg[] yPtg = new Ptg[1];
		yPtg[0] = operands[1];
		pnum = (PtgNumber) calcAverage( xPtg );
		double xMean = pnum.getVal();
		pnum = (PtgNumber) calcAverage( yPtg );
		double yMean = pnum.getVal();
		double[] xVals = PtgCalculator.getDoubleValueArray( xPtg );
		double[] yVals = PtgCalculator.getDoubleValueArray( yPtg );
		if( (xVals == null) || (yVals == null) )
		{
			return new PtgErr( PtgErr.ERROR_NA );//20090130 KSC: propagate error
		}
		double xstat = 0;
		for( double xVal : xVals )
		{
			xstat += Math.pow( (xVal - xMean), 2 );
		}
		xstat = xstat / xVals.length;
		xstat = Math.sqrt( xstat );
		double ystat = 0;
		for( double yVal : yVals )
		{
			ystat += Math.pow( (yVal - yMean), 2 );
		}
		ystat = ystat / yVals.length;
		ystat = Math.sqrt( ystat );
		double retval = covar / (ystat * xstat);
		return new PtgNumber( retval );
	}