protected static Ptg calcPV( Ptg[] operands )
	{
		if( operands.length < 3 )
		{
			return new PtgErr( PtgErr.ERROR_NULL );
		}
			debugOperands( operands, "calcPV" );
		double rate = operands[0].getDoubleVal();
		double nper = operands[1].getDoubleVal();
		double pmt = 0;
		// TODO: No specified error trapping?
		if( !(operands[2] instanceof PtgMissArg) )
		{
			pmt = operands[2].getDoubleVal();
		}
		double fv = 0.0;
		int type = 0;
		if( (operands.length > 3) && !(operands[3] instanceof PtgMissArg) )
		{
			fv = operands[3].getDoubleVal();
		}
		if( operands.length > 4 )
		{
			type = operands[4].getIntVal();
		}

		double A = Math.pow( 1 + rate, nper );
		double B = pmt * (1 + (rate * type));
		B *= (A - 1) / rate;
		double result = (-fv - B) / A;

		//double testresults= (result * A + pmt*(1+rate*type) * (A-1)/rate + fv);
		//testresults must==0  for Pv to be correct

		PtgNumber pnum = new PtgNumber( result );
			log.debug( "Result from calcPV= " + result );
		return pnum;

	}