Главная » Просмотр файлов » Morgan - Numerical Methods

Morgan - Numerical Methods (523161), страница 16

Файл №523161 Morgan - Numerical Methods (Morgan - Numerical Methods) 16 страницаMorgan - Numerical Methods (523161) страница 162013-09-15СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 16)

In addition, computing with an erroneous valuewill propagate errors throughout the calculations in which it is used. If a singlecomputation contains several such values, errors can overwhelm the result andrender the result meaningless. For example, say you’re multipying two 8-bit wordsand you know that the last two bits of each word are dubious.

The result of thisoperation will be 16 bits, with two error bits in one operand plus two error bits in the89NUMERICAL METHODSother operand. That means the product will contain four erroneous bits.For this reason, internal calculations are best done with greater precision thanyou expect in the result. Perform the arithmetic in a precision greater than needed inthe result, then represent only the significant bits as the result. This helps eliminateerror in your arithmetic but presents another problem: What about the informationin the extra bits of precision? This brings us to the subject of rounding.You can always ignore the extra bits. This is called truncation or chop, and itsimply means that they are left behind. This method is fast, but it actually contributesto the overall error in the system because the representation can only approach thetrue result at exact integer multiples of the LSB.

For example, suppose we have adecimal value, 12345D, with extended bits for greater precision. Since 5 is the leastsignificant digit, these extended bits are some fraction thereof and the whole numbercan be viewed as:12345.XXXXDextendedbitsWhenever the result of a computation produces extended bits other than zero, theresult, 12345D, is not quite correct. As long as the bits are always less than one-halfthe LSB, it makes little difference. But what if they exceed one-half? A particularcalculation produces 12345.7543D.

The true value is closer to 12346D than to12345D, and if this number is truncated to 12345D the protection allowed by theextended bits is lost. The error from truncation ranges from zero to almost one in theLSB but is definitely biased below the true value.Another technique, called jamming, provides a symmetrical error that causes thetrue value or result to be approached with an almost equal bias from above and below.It entails almost no loss in speed over truncation.

With this technique, you simply setthe low-order bit of the significant bits to one. Using the numbers from the previousexample, 12345.0000D through 12345.9999D remain 12345.0000D.And if the result is even, such as 123456.0000D, the LSB is set to make it123457.0000D. The charm of this technique is that it is fast and is almost equallybiased in both directions. With this method, your results revolve symmetrically90REAL NUMBERSabout the ideal result as with jamming, but with a tighter tolerance (one half the LSB),and, at worst, only contributes a small positive bias.Perhaps the most common technique for rounding involves testing the extendedbits and, if they exceed one-half the value of the LSB, adding one to the LSB andpropagating the carry throughout the rest of the number.

In this case, the fractionalportion of 12345.5678D is compared with .5D. Because it is greater, a one is addedto 12345D to make it 12346D.If you choose this method of rounding to maintain the greatest possible accuracy,you must make still more choices. What do you do if the extended bits are equal toexactly one-half the LSB?In your application, it may make no difference. Some floating-point techniquesfor calculating the elementary functions call for a routine that returns an integerclosest to a given floating-point number, and it doesn’t matter whether that numberwas rounded up or down on exactly one-half LSB.

In this case the rounding techniqueis unimportant.If it is important, however, there are a number of options. One method commonlytaught in school is to round up and down alternately. This requires some sort of flagto indicate whether it is a positive or negative toggle. This form of roundingmaintains the symmetry of the operation but does little for any bias.Another method, one used as the default in most floating-point packages, isknown as round to nearest. Here, the extended bits are tested. If they are greater thanone-half the LSB, the significant bits are rounded up; if they are less, they are roundeddown; and if they are exactly one-half, they are rounded toward even.

For example,12345.5000D would become 12346.0000D and 12346.5000D would remain12346.0000D. This technique for rounding is probably the most often chosen, byusers of software mathematical packages. Round to nearest provides an overall highaccuracy with the least bias.Other rounding techniques involve always rounding up or always roundingdown. These are useful in interval arithmetic for assessing the influences of errorupon the calculations.

Each calculation is performed twice, once rounded up andonce rounded down and the results compared to derive the direction and scope of anyerror. This can be very important for calculations that might suddenly diverge.91NUMERICAL METHODSAt least one bit, aside from the significant bits of the result, is required forrounding. On some machines, this might be the carry flag.

This one bit can indicatewhether there is an excess of equal to or greater than one-half the LSB. For greaterprecision, it’s better to have at least two bits: one to indicate whether or not theoperation resulted in an excess of one-half the LSB, and another, the sticky bit, thatregisters whether or not the excess is actually greater than one-half. These bits areknown as guard bits.

Greater precision provides greater reliability and accuracy.This is especially true in floating point, where the extended bits are often shifted intothe significant bits when the radix points are aligned.Basic Fixed-Point OperationsFixed-point operations can be performed two ways. The first is used primarilyin applications that involve minimal number crunching. Here, scaled decimal valuesare translated into binary (we’ll use hex notation) and handled as though they weredecimal, with the result converted from hex to decimal.To illustrate, let’s look at a simple problem: finding the area of a circleIf the radius of the circle is 5 inches (and we use 3.14 to approximate it), the solutionis 3.14 * (5 * 5), or 78.5 square inches.

If we were to code this for the 8086 using thescaled decimal method, it might look like this:movmulmovmulax, 5aldx, 13aHdx;the radius;square the radius;314 = 3.14D * 100D;ax will now hold 1eaaHThe value leaaH converted to decimal is 7,850, which is 100D times the actualanswer because was multiplied by 100D to accommodate the fraction.

If you onlyneed the integer portion, divide this number by 100D. If you also need the fractionalpart, convert the remainder from this division to decimal.The second technique is binary. The difference between purely binary and scaleddecimal arithmetic is that instead of multiplying a fraction by a constant to make itan integer, perform the operation, then divide the result by the same constant for theresult.

We express a binary fraction as the sum of negative powers of two, perform92REAL NUMBERSthe operation, and then adjust the radix point. Addition, subtraction, multiplication,and division are done just as they are with the integer-only operation; the onlyadditional provision is that you pay attention to the placement of the radix point. Ifthe above solution to the area of a circle were written using binary fixed point, itwould look like this:movmulmovmulax, 5aldx, 324Hdx;the radius;square the radius;804D = 3.14D * 256D;ax will now hold 4e84HThe value 4eH is 78D, and 84H is .515D (132D/256D).Performing the process in base 10 is effective in the short term and easilyunderstood, but it has some drawbacks overall.

Both methods require that theprogram keep track of the radix point, but correcting the radix point in decimalrequires multiplies and divides by 10, while in binary these corrections are done byshifts. An added benefit is that the output of a routine using fixed-point fractions canbe used to drive D/A converters, counters, and other peripherals directly because thebinary fraction and the peripheral have the same base. Using binary arithmetic canlead to some very fast shortcuts; we’ll see several examples of these later in thischapter.Although generalized routines exist for fixed-point arithmetic, it is oftenpossible to replace them with task specific high-speed routines, when the exactboundaries of the input variables are known.

Характеристики

Тип файла
PDF-файл
Размер
1,7 Mb
Тип материала
Учебное заведение
Неизвестно

Список файлов книги

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