protected static Ptg calcDec2Bin( Ptg[] operands )
	{
		if( operands.length < 1 )
		{
			return new PtgErr( PtgErr.ERROR_NULL );
		}
		debugOperands( operands, "DEC2BIN" );
		int dec = operands[0].getIntVal();
		int places = 0;
		if( operands.length > 1 )
		{
			places = operands[1].getIntVal();
		}

		if( (dec < -512) || (dec > 511) || (places < 0) )
		{
			return new PtgErr( PtgErr.ERROR_NUM );
		}

		String bString = Integer.toBinaryString( dec );
		if( dec < 0 )
		{    // truncate to 10 digits automatically (should already be two's complement)
			bString = bString.substring( Math.max( bString.length() - 10, 0 ) );
		}
		else if( places > 0 )
		{
			if( bString.length() > places )
			{
				return new PtgErr( PtgErr.ERROR_NUM );
			}
			bString = ("0000000000" + bString);    // maximum= 10 bits
			bString = bString.substring( bString.length() - places );
		}
		PtgStr pstr = new PtgStr( bString );
		log.debug( "Result from DEC2BIN= " + pstr.getString() );
		return pstr;
	}