answersLogoWhite

0


Best Answer

You take 1245 and form the two's complement of it then add it to D257.

The two's complement of a number is defined as the 1's complement + 1. In signed two's complement arithmetic, the most significant bit is the "sign" bit. 1 indicates a negative number and 0 indicates a positive number. To find the magnitude of a negative number, take it's two's complement (ignoring carry bits).

To get the two's complement of 1245, take the 1's complement of 1245 and add 1. In binary 1245 is 0001001001000101. The one's complement is 1110110110111010 (in hex that's EDBA) . Adding 1 to this will give you the two's complement. That is EDBA+0001 (ignore the carry if any), is EDBB. Now you add EDBB to D257 and ignore any carry, so that will be 1C012 (throw away the carry bit), C012. C012 is a negative number (the sign bit, the most significant bit, is 1). To find its magnitude, apply the two's complement algorithm above, and you'll find it to be -16365.

Note: D257 is a negative number, and you're subracting a positive number, so you're going to end up with another negative number, i.e. adding the two's complement of a number is the same thing as subtracting the number.

You can check your result by doing the math in decimal to see if it adds up. D257 in decimal = -11688 (you apply the two's complement to the number to find the magnitude, and the sign is negative because the sign bit, the most signficant bit is 1). 1245 in decimal = 4677. -11688-4677 = -16365 (which in hex signed two's complement is C012).

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How to subtract the hexadecimal number 1245 from D257 using two's complement addition method?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is the difference between Mnemonics and hexadecimal representation?

Mnemonics is a method of remembering things by associascation. Hexadecimal is a number system. 0-9 are as usual and then a(10) b(11) c(12) d(13) e(14) f(15)


How do you write bytes in Turbo C plus plus header files?

Bytes can be written using hexadecimal, octal or decimal notation. A numeral with no prefix is always regarded as decimal. If prefixed with a leading zero it is deemed octal and if prefixed with 0x it is deemed hexadecimal. The following shows the three ways to write the decimal value 255: 255 (decimal) 0377 (octal) 0xff (hexadecimal) Hexadecimal is the generally the most convenient method of notation since each hexadecimal digit represents exactly 4-bits (a half byte or a nybble). An octal digit represents exactly 3 bits and is useful for notating bytes in groups of 3 bits. A 24-bit integer is both a multiple of 3 and 4 so it can be notated using 8 octal digits or 6 hexadecimal digits. Individual bytes are best stored using the uint8_t alias (defined in the <cstdint> standard library header) as this guarantees an 8-bit byte in the positive range 0 to 255 decimal. To store several contiguous bytes, use a vector of uint8_t: std::vector<uint8_t> bytes; bytes.push_back (255); bytes.push_back (0377); bytes.push_back (0xff); The above example pushes the value 255 onto the back of the vector three times, using decimal, octal and hexadecimal notation. You can also write contiguous bytes in multiples of 2, 4 and 8 bytes using uint16_t, uint32_t and uint64_t aliases respectively. Thus if you need a 64-bit value, use the uint64_t alias. uint64_t word = 0xffffffffffffffff; // maximum value


What is method declaration in Java?

A method declaration is the heading of a method containing the name of the method, its parameters, and its access level. The method heading in Java is organized as such: [access keywords] [return type] [method name] ( [parameters separated by commas] ) for instance: public String toString(); is public (accessible by any class), returns a String, is called toString, and takes no parameters. Other features could be added to the method declaration for a more specialized method such as static (method could be called without an object of that class), native (implemented using the native code, usually what C has already done, i.e. square root, power etc.).


What are the rules for overriding a method in Java?

Realistically, the only real rule is that you may NOT override a method which has been declared 'final' by a superclass. By inference, you of course cannot extended a class that has itself been declared 'final', so no method in a final class can be overridden.In addition to the above restriction on whether you are permitted to override a method, there are several restrictions which you must obey when creating an override method:The scope (visibility) of the method may not be more restrictive than the one being overridden. For example, a method which is declared 'public' cannot be overridden with one which is declared 'package' or 'private'The override method's declared exceptions must be a subset of the original (i.e. you can removed Exceptions to be handled, but never add new ones that aren't a subtype of already existing Exceptions).The return type must either stay the same, or be a subclass of the original method's return type.And, of course, the declaration of arguments (type and number) must not change; otherwise, you are writing an Overloaded method, not an Overridden method.


Differences between declaring a method and calling a method?

Declaring a method is when you code for what the method will perform. When you call a method, you are using the method you have written in another part of the program, (or inside the method if it is recursive).

Related questions

Subtract the hexadecimal number 5634 from DAB7 using two's complement addition method?

First, write each number in binary form:DAB7 = 1101 1010 1011 01115634 = 0101 0110 0011 0100Now take the two's complement of 5634 in two steps:1's complement: 1010 1001 1100 1011Add 1 to make the 2's complement: 1010 1001 1100 1100Now add to find your result:1101 1010 1011 0111 + 1010 1001 1100 1100 = 1000 0100 1000 0011And write the result in hex:8483This works because the two's complement is the negative of the original number.


Subtract the hexadecimal number 1234 from DA57 using twos complement addition method?

(1234)hex=(0001 0010 0011 0100)2 (DA57)hex=(1101 1010 0101 0111)2 Taking, (1234)hex=(0001 0010 0011 0100)2 =(1110 1101 1100 1011) -1s complement =(1110 1101 1100 1100) -2s complement Now ,add 2s complement of (1234)hex with (DA57)hex, we get 1110 1101 1100 1100 + 1101 1010 0101 0111 1 1100 1000 0010 0011 There is a Carry bit Since,carry is generated.so,no is negative Then take 2s complement of above no.Thus ,we get 0011 0111 1101 1101=(37DD)hex (1234)hex -(DA57)hex =37DD)hex


What is the shop keeper's method?

The shopkeeper's method, also known as the method of complements, is a technique used in mental math to subtract a number by adding the complement of that number to the next higher multiple of 10. This method is particularly useful for subtracting numbers close to multiples of 10.


How the procedure for sign modulus method and 2's complement method for storing positive and negative numbers?

explain the procedure for sign modulus method and 2's complement method for storing positive and negative numbers?


Solve this equation using addition method -8x plus 3y equals -5 and 8x subtract 2y equals 6?

x=1, y=1


How do you divide octal and hexadecimal nos?

If you mean, for example, divide one hexadecimal number by another: In any number base, you can use basically the same method you use with decimal numbers - in the case of division, the "long division". However, you have to use the corresponding multiplication table, for example, the multiplication table for multiplying two hexadecimal digits, with a hexadecimal result.


What are the steps of the winkler method in order?

Winkler Method is a classical method(titration method) for determine the dissolved oxygen(BOD).


What is the advantage of using 2's complement method for substraction?

it is subtraction not substraction


What is 6a - 5b equals 9 using addition method?

You need two equations to use the addition method.


What is the addition or subtraction method?

Column method can be used for both !


What is the triangle method addition?

365


What is the method used for adding?

Addition