input: 
  from typing import Union
  
  def convert(x: Union[int, float]) -> Union[int, float]:
      """
      Converts a positive integer to negative and vice versa using bitwise NOT operator.
      >>> convert(5)
      -5
      >>> convert(-3.5)
      3.5
      """
      if x >= 0:
          return -abs(x)
      else:
          return abs(x)
  
output:     if isinstance(x, int):
          return ~x + 1
      else:
          return -x if x >= 0 else abs(x)