Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
The question isn't clear. Only positive numbers can be converted - without changing anything, just copy respectively typecast it. The bit pattern is identical.
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...
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.