Morgan - Numerical Methods, страница 6

PDF-файл Morgan - Numerical Methods, страница 6 Численные методы (761): Книга - 6 семестрMorgan - Numerical Methods: Численные методы - PDF, страница 6 (761) - СтудИзба2013-09-15СтудИзба

Описание файла

PDF-файл из архива "Morgan - Numerical Methods", который расположен в категории "". Всё это находится в предмете "численные методы" из 6 семестр, которые можно найти в файловом архиве . Не смотря на прямую связь этого архива с , его также можно найти и в других разделах. Архив можно найти в разделе "книги и методические указания", в предмете "численные методы и алгоритмы" в общих файлах.

Просмотр PDF-файла онлайн

Текст 6 страницы из PDF

The number itselfis represented as usual—that is, the only difference between a positive and a negativerepresentation is the sign bit. For example, the positive value 4 might be expressedas 0l00B in a 4-bit binary format using sign magnitude, while -4 would berepresented as 1100B.This form of notation has two possible drawbacks. The first is something it hasin common with the diminished-radix complement method: It yields two forms ofzero, 0000B and 1000B (assuming three bits for the number and one for the sign).Second, adding sign-magnitude values with opposite signs requires that the magni-18NUMBERStudes of the numbers be consulted to determine the sign of the result.

An example ofsign magnitude can be found in the IEEE 754 specification for floating-pointrepresentation.The diminished-radix complement is also known as the one’s complement inbinary notation. The MSB contains the sign bit, as with sign magnitude, while the restof the number is either the absolute value of the number or its bit-by-bit complement.The decimal number 4 would appear as 0100 and -4 as 1011. As in the foregoingmethod, two forms of zero would result: 0000 and 1111.The radix complement, or two’s complement, is the most widely used notationin microprocessor arithmetic. It involves using the MSB to denote the sign, as in theother two methods, with zero indicating a positive value and one meaning negative.You derive it simply by adding one to the one’s-complement representation of thesame negative value. Using this method, 4 is still 0100, but -4 becomes 1100.

Recallthat one’s complement is a bit-by-bit complement, so that all ones become zeros andall zeros become ones. The two’s complement is obtained by adding a one to theone’s complement.This method eliminates the dual representation of zero-zero is only 0000(represented as a three-bit signed binary number)-but one quirk is that the range ofvalues that can be represented is slightly more negative than positive (see the chartbelow). That is not the case with the other two methods described.

For example, thelargest positive value that can be represented as a signed 4-bit number is 0111B, or7D, while the largest negative number is 1000B, or -8D.19NUMERICAL METHODSOne's complementTwo'scomplementSign complement011177701106660101555010044400113330010222000111100000001111-0-1-71110-1-2-61101-2-3-51100-3-4-41011-4-5-31010-5-6-21001-6-7-11000-7-8-0Table 1-1. Signed Numbers.Decimal integers require more storage and are far more complicated to workwith than binary; however, numeric I/O commonly occurs in decimal, a morefamiliar notation than binary.

For the three forms of signed representation alreadydiscussed, positive values are represented much the same as in binary (the leftmost20NUMBERSbit being zero). In sign-magnitude representation, however, the sign digit is ninefollowed by the absolute value of the number. For nine’s complement, the sign digitis nine and the value of the number is in nine’s complement. As you might expect,10’s complement is the same as nine’s complement except that a one is added to thelow-order (rightmost) digit.Fundamental Arithmetic PrinciplesSo far we’ve covered the basics of positional notation and bases.

While this bookis not about mathematics but about the implementation of basic arithmetic operationson a computer, we should take a brief look at those operations.1. Addition is defined as a + b = c and obeys the commutative rules describedbelow.2. Subtraction is the inverse of addition and is defined as b = c - a.3. Multiplication is defined as ab = c and conforms to the commutative,associative, and distributive rules described below.4. Division is the inverse of multiplication and is shown by b = c/a.5. A power is ba=c.6. A root is b =7 . A logarithm is a = logbc.Addition and subtraction must also satisfy the following rules:58. Commutative:a+b=b+aab = ba9 . Associative:a = (b + c) = (a + b) + ca(bc) = (ab)c10.

Distributive:a(b + c) = ab + acFrom these rules, we can derive the following relations:611. (ab)c = acbc21NUMERICAL METHODS12. abac = ac(b+c)13.14.15.16.17.(ab)c = a(bc)a+0=aa x 1= aa1 = aa/0 is undefinedThese agreements form the basis for the arithmetic we will be using in upcomingchapters.MicroprocessorsThe key to an application’s success is the person who writes it. This statementis no less true for arithmetic. But it’s also true that the functionality and power of theunderlying hardware can greatly affect the software development process.Table l-2 is a short list of processors and microcontrollers currently in use, alongwith some issues relevant to writing arithmetic code for them (such as the instructionset, and bus width).

Although any one of these devices, with some ingenuity andeffort, can be pushed through most common math functions, some are more capablethan others. These processors are only a sample of what is available. In the rest of thistext, we’ll be dealing primarily with 8086 code because of its broad familiarity.Examples from other processors on the list will be included where appropriate.Before we discuss the devices themselves, perhaps an explanation of thecategories would be helpful.BuswidthThe wider bus generally results in a processor with a wider bandwidth because it canaccess more data and instruction elements. Many popular microprocessors have awider internal bus than external, which puts a burden on the cache (storage internalto the microprocessor where data and code are kept before execution) to keep up withthe processing.

The 8088 is an example of this in operation, but improvements in the80x86 family (including larger cache sizes and pipelining to allow some parallelprocessing) have helped alleviate the problem.22NUMBERSTable 1-2. Instructions and flags.23NUMERICAL METHODSData typeThe larger the word size of your machine, the larger the numbers you can processwith single instructions. Adding two doubleword operands on an 8051 is amultiprecision operation requiring several steps.

It can be done with a single ADDon a TMS34010 or 80386. In division, the word size often dictates the maximum sizeof the quotient. A larger word size allows for larger quotients and dividends.FlagsThe effects of a processor’s operation on the flags can sometimes be subtle. Thefollowing comments are generally true, but it is always wise to study the data sheetsclosely for specific cases.Zero.

This flag is set to indicate that an operation has resulted in zero. This canoccur when two operands compare the same or when two equal values aresubtracted from one another. Simple move instructions generally do not affectthe state of the flag.Carry. Whether this flag is set or reset after a certain operation varies fromprocessor to processor. On the 8086, the carry will be set if an addition overflowsor a subtraction underflows.

On the 80C196, the carry will be set if that additionoverflows but cleared if the subtraction underflows. Be careful with this one.Logical instructions will usually reset the flag and arithmetic instructions as wellas those that use arithmetic elements (such as compare) will set it or reset it basedon the results.Sign. Sometimes known as the negative flag, it is set if the MSB of the data typeis set following an operation.Overflow. If the result of an arithmetic operation exceeds the data type meantto contain it, an overflow has occurred. This flag usually only works predictablywith addition and subtraction. The overflow flag is used to indicate that the resultof a signed arithmetic operation is too large for the destination operand. It willbe set if, after two numbers of like sign are added or subtracted, the sign of theresult changes or the carry into the MSB of an operand and the carry out don’tmatch.24NUMBERSOverflow Trap.

If an overflow occurred at any time during an arithmeticoperation, the overflow trap will be set if not already set. This flag bit must becleared explicitly. It allows you to check the validity of a series of operations.Auxiliary Carry. The decimal-adjust instructions use this flag to correct theaccumulator after a decimal addition or subtraction. This flag allows theprocessor to perform a limited amount of decimal arithmetic.Parity. The parity flag is set or reset according to the number of bits in the lowerbyte of the destination register after an operation.

Свежие статьи
Популярно сейчас
Зачем заказывать выполнение своего задания, если оно уже было выполнено много много раз? Его можно просто купить или даже скачать бесплатно на СтудИзбе. Найдите нужный учебный материал у нас!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
5209
Авторов
на СтудИзбе
430
Средний доход
с одного платного файла
Обучение Подробнее