为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

42 Boolean Logic:42布尔逻辑

2017-11-11 4页 doc 17KB 16阅读

用户头像

is_963767

暂无简介

举报
42 Boolean Logic:42布尔逻辑42 Boolean Logic:42布尔逻辑 IST/ICT/CSc/4.1 Name: 4.1 Number Systems Calculation In binary, , 0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 0 carry 1, or 102 , Note that these are the same rules as in decimal. , In decimal, 7 + 5 = 2 carry 1, or 12 , When doing additi...
42 Boolean Logic:42布尔逻辑
42 Boolean Logic:42布尔逻辑 IST/ICT/CSc/4.1 Name: 4.1 Number Systems Calculation In binary, , 0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 0 carry 1, or 102 , Note that these are the same rules as in decimal. , In decimal, 7 + 5 = 2 carry 1, or 12 , When doing addition, you always “carry” the overflow left i.e. add 1 into the column on the left. , Remember hexadecimal uses 0 1 2 3 4 5 6 7 8 9 A B C D E F before overflowing , In hexadecimal, 7 + 5 = C (no need to carry) 9 + A = 3 carry 1, or 1316 C + E = A carry 1, or 1A16 , Subtraction involves “borrowing” from the left column. If nothing is available, the answer is negative. , In decimal, 13 – 9 = -6 with a borrow of 10 = -6 + 10 = 4 , In binary, 0 - 0 = 0 1 - 1 = 0 1 - 0 = 1 10 - 1 = -1 borrow 10, or 1 , Of course if the last example were 0 – 1, the answer would be -1. , In hexadecimal, 9 - 3 = 6 D - 5 = 8 14 - 8 = -4 borrow 10, or C 16 10 - B = 5 Floating Point Numbers , Real numbers have a fractional part e.g. 3.142 , They can also be less than one or negative e.g. -0.00385 4 , 1966.0058 can be represented as 0.19660058 x 10(called scientific notation) , When there is nothing before the point, the number is normalised. ,3 -225.61 = -0.22561 x 10,-3 -0.000256 = -0.256 x 104, In 0.19660058 x 10, 0.19660058 is called the mantissa, 4 is called the exponent. , Move the decimal or binary point so there is 0 on its left (this becomes the mantissa) , The number of places moved becomes the exponent , N.B. works equally for decimal and (two’s complement) binary , Normalisation converts fixed point real numbers into floating point. - 1 - Dec 30, 2014 IST/ICT/CSc/4.1 Name: Integer versus Floating Point Format , Integers have a smaller range, so overflow errors can occur at least all the values inside their range can be stored accurately. overflow errors can be caught since the range of a data type is known (4 bytes for an int, 8 for a long). , Real numbers the range of numbers that can be represented is much greater. allow fractional values not all numbers within the range can be represented precisely (leading to possible truncation errors) More About Errors , Truncation errors can occur when a real number is assigned to an integer variable , Assigning 3.142 to an int will store 3 – the 0.142 is lost. , Overflow errors can occur when the number to be stored is larger than the available number of bits e.g. trying to put the number 1000 into a byte variable. , Floating point overflow errors occur if numbers with either the mantissa or exponent are too large to fit into the allocated bits. , Overflow errors can be caught and handled in Java. , Underflow errors can occur when an attempt is made to store a number that is too small to be represented - not reported as errors in Java and since they default to zero can cause run-time errors e.g. divide by zero - 2 - Dec 30, 2014
/
本文档为【42 Boolean Logic:42布尔逻辑】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索