title: Determining if a 16 bit binary number is negative or positive
body: <p>I'm creating a library for a temperature sensor that has a 16-bit value in binary that is being returned. I'm trying to find the best way to check if that value returned is negative or positive. I'm curious as to whether or not I can check if the most significant bit is a 1 or a 0 and if that would be the best way to go about it, how to successfully implement it.  </p>
  
  <p>I know that I can convert it to decimal and check that way but I just was curious if there was an easier way. I've seen it implemented with shifting values but I don't fully understand that method. (I'm super new to c++)</p>
  
  <pre><code>float TMP117::readTempC(void)
  {
      int16_t digitalTemp;      // Temperature stored in the TMP117 register
  
      digitalTemp = readRegister(TEMP_RESULT); //Reads the temperature from the sensor
  
      // Check if the value is a negative number
      /*Insert code to check here*/
  
      // Returns the digital temperature value multiplied by the resolution
      // Resolution = .0078125
      return digitalTemp*0.0078125; 
  }
  </code></pre>
  
  <p>I'm not sure how to check if the code works and I haven't been able to compile it and run it on the device because the new PCB design and sensor has not come in the mail yet.</p>