Hex to Decimal 2s Complement

Camm camm29 at tesco.net
Fri Apr 27 05:27:46 EDT 2018


Richmond ,

Yes , thanks

I have seen xor(Hex) +1 , but just asking if anyone has a solution ?

FFCC = -52

014A = 330

Anyone ?

Regards
Camm

----- Original Message -----
From: "Richmond via use-livecode" <use-livecode at lists.runrev.com>
To: "Camm via use-livecode" <use-livecode at lists.runrev.com>
Cc: "Richmond" <richmondmathewson at gmail.com>
Sent: Friday, 27 April, 2018 10:22:36 AM
Subject: Re: Hex to Decimal 2s Complement

I think you will have to perform several operations here:

1. convert Hex number to Binary number.

2. find Complement of Binary number.

3. convert Complement to Decimal number.

Your "main problem" is that YOU have to work out the algorhythm to

get the complement as LiveCode does not have that built-in to its system.

Richmond.


On 27.04.2018 12:17, Camm via use-livecode wrote:
> Two's complement is a mathematical operation on binary numbers, best known for its role in computing as a method of signed number representation. For this reason, it is the most important example of a radix complement.
>
> The two's complement of an N-bit number is defined as its complement with respect to 2N. For instance, for the three-bit number 010, the two's complement is 110, because 010 + 110 = 1000.
>
> Regards
> Camm
> ----- Original Message -----
> From: "Richmond via use-livecode" <use-livecode at lists.runrev.com>
> To: "Camm via use-livecode" <use-livecode at lists.runrev.com>
> Cc: "Richmond" <richmondmathewson at gmail.com>
> Sent: Friday, 27 April, 2018 10:11:19 AM
> Subject: Re: Hex to Decimal 2s Complement
>
> Well, unless you can explain to me what "2s Complement" means I cannot
> help you.
>
> Richmond.
>
>
> On 27.04.2018 12:06, Camm via use-livecode wrote:
>> Richmond ,
>>
>> Tried baseconvert but could not get the correct result for 2s Complement.
>>
>> Regards
>> Camm
>>
>> ----- Original Message -----
>> From: "Richmond via use-livecode" <use-livecode at lists.runrev.com>
>> To: "Camm via use-livecode" <use-livecode at lists.runrev.com>
>> Cc: "Richmond" <richmondmathewson at gmail.com>
>> Sent: Friday, 27 April, 2018 10:01:17 AM
>> Subject: Re: Hex to Decimal 2s Complement
>>
>> Check out *baseConvert* in the dictionary.
>>
>> Richmond.
>>
>>
>> On 27.04.2018 11:50, Camm via use-livecode wrote:
>>> Hi ,
>>>
>>>
>>> Help needed on the most efficient way to convert signed Hex to Decimal (2s Complement) range 0000 - FFFF
>>>
>>>
>>>
>>>
>>> Example :-
>>>
>>>
>>> FFCC = -52
>>>
>>>
>>> 014A = 330
>>>
>>>
>>> Kind Regards
>>> Camm
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list