code: @Override
      protected Type getReturnType(final int mOp1, final int mOp2) throws TTXPathException {
  
          final Type mType1 = Type.getType(mOp1).getPrimitiveBaseType();
          final Type mType2 = Type.getType(mOp2).getPrimitiveBaseType();
  
          if (mType1.isNumericType() && mType2.isNumericType()) {
  
              // if both have the same numeric type, return it
              if (mType1 == mType2) {
                  return mType1;
              } else if (mType1 == Type.DOUBLE || mType2 == Type.DOUBLE) {
                  return Type.DOUBLE;
              } else if (mType1 == Type.FLOAT || mType2 == Type.FLOAT) {
                  return Type.FLOAT;
              } else {
                  assert (mType1 == Type.DECIMAL || mType2 == Type.DECIMAL);
                  return Type.DECIMAL;
              }
  
          } else {
  
              switch (mType1) {
              case DATE:
                  if (mType2 == Type.YEAR_MONTH_DURATION || mType2 == Type.DAY_TIME_DURATION) {
                      return mType1;
                  }
                  break;
              case TIME:
                  if (mType2 == Type.DAY_TIME_DURATION) {
                      return mType1;
                  }
                  break;
              case DATE_TIME:
                  if (mType2 == Type.YEAR_MONTH_DURATION || mType2 == Type.DAY_TIME_DURATION) {
                      return mType1;
                  }
                  break;
              case YEAR_MONTH_DURATION:
                  if (mType2 == Type.DATE || mType2 == Type.DATE_TIME || mType2 == Type.YEAR_MONTH_DURATION) {
                      return mType2;
                  }
                  break;
              case DAY_TIME_DURATION:
                  if (mType2 == Type.DATE || mType2 == Type.TIME || mType2 == Type.DATE_TIME
                      || mType2 == Type.DAY_TIME_DURATION) {
                      return mType2;
                  }
                  break;
              default:
                  throw EXPathError.XPTY0004.getEncapsulatedException();
              }
              throw EXPathError.XPTY0004.getEncapsulatedException();
          }
      }
docs: {@inheritDoc}