input: from typing import Union
  
  def convert_to_opposite_sign(x: Union[int, float]) -> Union[int, float]:
      """ Convert a positive integer or float to negative or vice versa using bitwise NOT operator.
      
      >>> convert_to_opposite_sign(10)
      -10
      >>> convert_to_opposite_sign(-10.5)
      10.5
      """
      if x > 0:
          return ~int(x) + 1 if isinstance(x, float) else ~x + 1
      else:
          return ~(int(x) - 1) if isinstance(x, float) else ~(x - 1)
output:     if x > 0:
          return -x
      else:
          return abs(x)