code: static Object doubleBinaryOperation(double lhs, double rhs, int kind)
          throws UtilEvalError
      {
          switch(kind)
          {
              // arithmetic
              case PLUS:
                  if ( lhs > 0d && (Double.MAX_VALUE - lhs) < rhs )
                      break;
                  return lhs + rhs;
  
              case MINUS:
                  if ( lhs < 0d && (-Double.MAX_VALUE - lhs) > -rhs )
                      break;
                  return lhs - rhs;
  
              case STAR:
                  if ( lhs != 0 && Double.MAX_VALUE / lhs < rhs )
                      break;
                  return lhs * rhs;
  
              case SLASH:
                  return lhs / rhs;
  
              case MOD:
              case MODX:
                  return lhs % rhs;
  
              case POWER:
              case POWERX:
                  double check = Math.pow(lhs, rhs);
                  if ( Double.isInfinite(check) )
                      break;
                  return check;
  
              // can't shift floating-point values
              case LSHIFT:
              case LSHIFTX:
              case RSIGNEDSHIFT:
              case RSIGNEDSHIFTX:
              case RUNSIGNEDSHIFT:
              case RUNSIGNEDSHIFTX:
                  throw new UtilEvalError("Can't shift floatingpoint values");
  
          }
          if ( OVERFLOW_OPS.contains(kind) )
              return bigDecimalBinaryOperation(BigDecimal.valueOf(lhs), BigDecimal.valueOf(rhs), kind);
  
          throw new InterpreterError(
                  "Unimplemented binary double operator");
      }
docs: returns Object covering both Double and Boolean return types