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

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

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

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

It is slower than fixed point, but if a mathcoprocessor is available or the application doesn’t demand speed, it can be the mostsatisfactory answer to arithmetic problems.The advantages of floating point do come with some problems. Floating-pointlibraries handle so much for the programmer, quietly and automatically generating8 to 15 decimal digits in response to input arguments, that it’s easy to forget that thosedigits may be in error. After all, floating point is just fixed point wrapped up with anexponent and a sign; it has all the proclivities of fixed point to produce erroneousresults due to rounding, loss of significance, or inexact representation.

But that’s trueof any form of finite expression-precautions must always be taken to avoid errors.Floating-point arithmetic is still a valuable tool, and you can use it safely if youunderstand the limitations of arithmetic in general and of floating-point format, inparticular.123NUMERICAL METHODSWhat To ExpectDo you know what kind of accuracy your application needs? What is theaccuracy of your input? Do you require only slide rule accuracy for fast plotting toscreen? Or do you need the greatest possible accuracy and precision for iterative ornonlinear calculation?These are important questions, and their answers can make the differencebetween calculations that succeed and those that fail.

Here are a few things to keepin mind when using floating-point arithmetic.No mathematical operation produces a result more accurate than its weakestinput. It’s fine to see a string of numbers following a decimal point, but if that’sthe result of multiplying pi by a number accurate to two decimal places, you havetwo decimal places of accuracy at best.Floating point suffers from some of the very conveniences it offers the developer.

Though most floating-point libraries use some form of extended precision,that’s still a finite number of significant bits and may not be enough to representthe input to or result of a calculation. In an iterative loop, you can lose a bit moreprecision each time through an operation, this is especially true of subtraction.Floating point’s ability to cover a wide range of values also leads to inaccuracies.Again, this is because the number of significant bits is finite: 24 for a short realand 53 for a long real.

That means a short real can only represent 223 possiblecombinations for every power of two.To get the greatest possible precision into the double- and quadword formats ofthe short and long real, the integer 1 that must always exist in a number coercedto a value between 1.0 and 2.0 is omitted. This is called the hidden bit, and usingits location for the LSB of the exponent byte allows an extra bit of precision. Bothsingle and double-precision formats include the hidden bit.Between 21(2D) and 22 (4D), 223 individual numbers are available in a short real.That leaves room for two cardinals (counting numbers, such as 1, 2, and 3) anda host of fractions-not an infinite number, as the number line allows, but stillquite a few. These powers of two increase (1, 2, 4, 8...) and decrease (.5, .25,.125...), but the number of significant bits remains the same (except for denormal124FLOATING-POINT ARITHMETICarithmetic); each power of two can only provide 223 individual numbers.

Thismeans that between two consecutive powers of two, such as 232 and 233, on thenumber line are 4,294,967,296 whole numbers and an infinite number offractions thereof. However, a single-precision float will only represent 223unique values. So what happens if your result isn’t one of those numbers? Itbecomes one of those that 23 bits can represent.Around 0.0 is a band that floating-point packages and coprocessors handledifferently. The smallest legal short real has an exponent of 2-126.

The significandis zero, with only the implied one remaining (the hidden bit). That still leaves8,388,607 numbers known as denormals to absolute zero. As the magnitude ofthese numbers decreases from 2-126 to 2-149, the implied one is gone and a bit ofprecision is lost for every power of two until the entire significand is zero.

Thisis described in the IEEE 854 specification as “gradual underflow” and isn’tsupported by all processors and packages. Use caution when using denormals;multiplication with them can result in so little significance that it may not beworth continuing, and division can blow up.It’s easy to lose significance with floating-point arithmetic, and the biggestoffender is subtraction. Subtracting two numbers that are close in value canremove most of the significance from your result, perhaps rendering your resultmeaningless as well. The lost information can be estimated according to theformula Significance_lost = -ln(1 -minuend/subtrahend)/ln(2), but this is oflittle value after the loss.’Assume for a moment that you’re using a floating-point format with sevensignificant decimal digits (a short real).

If you subtract. 1234567 from .1234000,the result is -5.67E-5. You have lost four decimal digits of significance.Instances of such loss are common in function calls involving transcendentals,where the operands are between 0.0 and 1.0.This loss of significance can occur in other settings as well, such as those thatinvolve modularity.

Sines and cosines have a modularity based onor 90degrees. Assuming a computation of harmonic displacement, x = L sin, ifgets very large, which can happen if we are dealing with a high enough frequency125NUMERICAL METHODSor a long enough time, very little significance will be left for calculating the sine.The equation x = L sin, with f being frequency and t being time, willcalculate the angular displacement of a reference on a sinusoid in a given periodof time. If the frequency of the sinusoid is 10 MHz and the time is 60 seconds,the result is an of 3769911184.31. If this is expressed as a short real withoutextended precision, however, we’ll have only enough bits to express the eightmost significant digits (3.769911lE9).

The very information necessary tocompute the sine and quadrant is truncated. The sine of 3769911184.31 is2.24811195116E-3, and the sine of 3.769911lE9 is -.492752198651. Computing with long reals will help, but it’s limited to 15 decimal digits.The normal associative laws of addition and multiplication don’t alwaysfunction as expected with floating point. The associative law states:(A+B)+C = A+(B+C)Look at the following seven-digit example of floating point:(7.654321 + (-1234567)) + 1234568 =-1234559 + 1234568 =9while7.654321 + (-1234567 + 1234568) =7.654321 + 1 =8.654321Note that the results aren’t the same. Of course, using double-precision arguments will minimize such problems, but it won’t eliminate them. The number ofsignificant bits available in each precision heavily affects the accuracy of whatyou’re representing.It is hard to find any true equalities in floating-point arithmetic.

It’s nearlyimpossible to find any exactitudes, without which there can be no equalities. D.E. Knuth suggested a new set of symbols for floating point.2 These symbols were126FLOATING-POINT ARITHMETIC“round” (because the arithmetic was only approximate) and included a roundplus, a round minus, a round multiply, and a round divide.

Following from thatset was a floating-point compare that assessed the relative values of the numbers.These operations included conditions in which one number was definitely lessthan, approximately equal to, or definitely greater than another.Most floating-point packages compare the arguments exactly. This usuallyworks in greater-than/less-than situations, depending on the amount of significance left in the number, but almost never works in equal-to comparisons.What this means is that the results of a computation depend on the precision andrange of the input and the kind of arithmetic performed. When you prepareoperations and operands, make sure the precision you choose is appropriate.Though single-precision arguments will be used in this discussion, the sameproblems exist in double precision.A Small Floating-Point PackageThe ability to perform floating-point arithmetic is a big advantage.

Without acoprocessor to accelerate the calculations it may never equal fixed points for speed,but the automatic scaling, convenient storage, standardized format, and the mathroutines are nice to have at your fingertips. Unfortunately, even in systems wherespeed isn’t a problem, code size can make the inclusion of a complete floating-pointpackage impossible.Your system may not require double-precision support-it might not need thetrigonometric or power functions—but could benefit from the ability to input andprocess real-world numbers that fixed point can’t handle comfortably. Unfortunately, most packages are like black boxes that require the entire library or nothing;this is especially true of the more exotic processors that have little third-partysupport.

It’s hard to justify an entire package when only a few routines are necessary.At times like this, you might consider developing your own.The rest of this chapter introduces the four basic arithmetic operations in floatingpoint. The routines do not conform to IEEE 754 in all ways-most notably thenumeric exceptions, many of which are a bit dubious in an embedded application—127NUMERICAL METHODSbut they do deliver the necessary accuracy and resolution and show the innerworkings of floating point. With the routines presented later in the book, they’re alsothe basis for a more complete library that can be tailored to the system designer’sneeds.The following procedures are single-precision (short real) floating-point routines written in 80x86 assembler, small model, with step-by-step pseudocode so youcan adapt them to other processors.Only the techniques of addition, subtraction, multiplication, and division will bedescribed in this chapter; refer to FPMATH.ASM for complementary and supportfunctions.The Elements of a Floating-Point NumberTo convert a standard fixed-point value to one of the two floating-point formats,you must first normalize it; that is, force it through successive shifts to a numberbetween 1.0 and 2.0.

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

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

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

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