electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

how to convert signed decimal to unsigned decimal?


Post new topic  Reply to topic    EDAboard.com Forum Index -> Mathematics & Physics -> how to convert signed decimal to unsigned decimal?
Author Message
quer



Joined: 17 Nov 2007
Posts: 15


Post20 Mar 2009 18:07   

signed decimal


please give me an example on how to do it..Neutral
Back to top
FvM



Joined: 22 Jan 2008
Posts: 5161
Helped: 767
Location: Bochum, Germany


Post20 Mar 2009 18:15   

unsigned decimal


The question isn't clear. Only positive numbers can be converted - without changing anything, just copy respectively typecast it. The bit pattern is identical.
Back to top
quer



Joined: 17 Nov 2007
Posts: 15


Post20 Mar 2009 18:27   

convert signed to unsigned


sorry i mean how to convert numbers like -.023 (decimal) to unsigned decimal (ranging from 0 t 255).. actually i don't know if there is such process...
Back to top
Aya2002



Joined: 12 Dec 2006
Posts: 1409
Helped: 254
Location: Iraq


Post20 Mar 2009 18:30   

convert unsigned to signed


i need it also but in matlab
Back to top
quer



Joined: 17 Nov 2007
Posts: 15


Post20 Mar 2009 19:00   

converting signed to unsigned


Aya2002 wrote:
i need it also but in matlab


yeah we are having the same problem Crying or Very sad
Back to top
Google
AdSense
Google Adsense




Post20 Mar 2009 19:00   

Ads




Back to top
FvM



Joined: 22 Jan 2008
Posts: 5161
Helped: 767
Location: Bochum, Germany


Post20 Mar 2009 19:37   

unsigned to signed converter


Two comments.
1. If an 8-bit integer (0..255) is representing a negative number like -0.023, it's not unsigned. It's e.g. a fixed point or fractional signed number. Of course you can display it as an unsigned, but it still contains a sign information.

2. You have to know the scaling of your target number format respectively the numeric range represented by it, than a conversion is easy. 0..255 may e.g. represent -1..+1. You can read it then as 2's complement signed value with a power of 2 scaling factor. (-128..127 *1/128). In this case, -0.023 converts to -3 respectively 253 or 0xfd when displayed as unsigned.
Back to top
Aya2002



Joined: 12 Dec 2006
Posts: 1409
Helped: 254
Location: Iraq


Post20 Mar 2009 19:40   

decimal to unsigned


explain more please with another example
Back to top
FvM



Joined: 22 Jan 2008
Posts: 5161
Helped: 767
Location: Bochum, Germany


Post21 Mar 2009 0:18   

signed to unsigned convert


I tried to give a sense to an unclear question by suggesting a number format and defining a range. I'd rather like to hear a complete question first.
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> Mathematics & Physics -> how to convert signed decimal to unsigned decimal?
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
How can i convert 16 bit number to decimal ? (5)
how to convert binary to BCD or decimal in assembly (4)
Need to convert hex to decimal (8051) (5)
convert from hexa to decimal in unix (1)
convert hex to decimal using proton picbasic (3)
How to set a decimal points in pads2007 (4)
decade BCD-decimal counter, how (2)
how to implement the decimal fraction in an equation (2)
how to write verilog coding for decimal value (4)
How do i display decimal point on the resulting temperature? (1)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS