1. We will be in Read Only mode (no new threads, replies, registration) starting at 9:00 EDT for a number of hours as we migrate the forums to upgraded software.

signed to unsigned conversion

Discussion in 'General Electronics Chat' started by aamirali, Nov 6, 2012.

  1. aamirali

    Thread Starter Member

    Feb 2, 2012
    1. I have a signed int no with range -3000 to +3000. No I have to convert it to unsigned. so I have done:

    uint16_t x = (uint16_t)(temp + 4096);

    where temp is signed var with range -3000 to +3000. is it right method.
  2. spinnaker

    AAC Fanatic!

    Oct 29, 2009

    Look at the abs function. Look down the list of forums a bit.

    You know there is a specific forum for programming? This forum is General Electronics Chat.