protected static Ptg calcCoupNum( Ptg[] operands )
	{
		if( operands.length < 2 )
		{
			return new PtgErr( PtgErr.ERROR_NULL );
		}
			debugOperands( operands, "COUPNUM" );
		try
		{
			GregorianCalendar sDate = (GregorianCalendar) DateConverter.getCalendarFromNumber( operands[0].getValue() );
			GregorianCalendar mDate = (GregorianCalendar) DateConverter.getCalendarFromNumber( operands[1].getValue() );
			long settlementDate = (new Double( DateConverter.getXLSDateVal( sDate ) )).longValue();
			long maturityDate = (new Double( DateConverter.getXLSDateVal( mDate ) )).longValue();
			int frequency = operands[2].getIntVal();
			int basis = 0;
			if( operands.length > 3 )
			{
				basis = operands[3].getIntVal();
			}
			//	 TODO: if dates are not valid, return #VALUE! error
			if( (basis < 0) || (basis > 4) )
			{
				return new PtgErr( PtgErr.ERROR_NUM );
			}
			if( !((frequency == 1) || (frequency == 2) || (frequency == 4)) )
			{
				return new PtgErr( PtgErr.ERROR_NUM );
			}
			if( settlementDate > maturityDate )
			{
				return new PtgErr( PtgErr.ERROR_NUM );
			}
/*
		double result = getDaysFromBasis(basis, settlementDate, maturityDate)
				/ (getDaysInYearFromBasis(basis, settlementDate, maturityDate) / frequency);
		result = Math.ceil(result);
		double delta= maturityDate-settlementDate;
		double result= delta/calcCoupDays(operands));
*/
			double result = Math.ceil( yearFrac( basis, settlementDate, maturityDate ) * frequency );
				log.debug( "Result from calcCoupNUM= " + result );
			PtgNumber pnum = new PtgNumber( result );
			return pnum;
		}
		catch( Exception e )
		{
		}
		return new PtgErr( PtgErr.ERROR_VALUE );
	}