COMPSCI 1MD3 Lecture Notes - Lecture 10: Interval Arithmetic, Real Number

60 views3 pages

Document Summary

There are some rational numbers that cannot be written with a finite number of digits. All decimals without a finite decimal representation will not have a finite binary representation. Fractional numbers should never be compared for equality. And even if you format this, it wont amount to the right number, because the 1 gets lost in the fraction. Be careful when working with floating point numbers. Python uses 52 binary digits, approximately 16 decimal digits. Standard output gives only the first 16 decimal digits, even if conversion from binary results in more digits. ( approximate value is printed) With a finite number of digits, arithmetic operations will lead to rounding errors. In some cases, the error can get cancelled. Example of where it does not get cancelled: As a result, fractional numbers should never be compared for equality. Where the epsilon must not be too small. Consists of a fraction (mantissa) with the significant digits and an exponent.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents