火气旺盛有什么症状| 喝鲜牛奶有什么好处和坏处| 各什么己| 马女和什么属相最配| 坐月子送什么礼物好| 西洋参有什么作用和功效| 羊入虎口是什么生肖| 逍遥丸什么人不能吃| 菠菜什么时候种最合适| 宫颈肥大伴纳氏囊肿是什么意思| 三个直念什么| 胃疼发烧是什么原因| o型血和什么血型最配| 白条是什么| 退役和退伍有什么区别| 打坐有什么好处| 麦芽糖醇是什么| 矿泉水敷脸有什么作用| 绿色加蓝色是什么颜色| sma是什么病| 脚气用什么药膏最好| 11月1日什么星座| 肆无忌惮的意思是什么| 桂花代表什么生肖| 2楼五行属什么| shadow是什么意思| 尿葡萄糖阴性什么意思| 低血压吃什么食物| 眼睛发红是什么原因| 胃胀痛吃什么药| 腱鞘是什么| 告示是什么意思| 金贵肾气丸治什么病| 阴虱病是什么原因引起的| 生蚝和牡蛎有什么区别| 女性肾虚吃什么补最好最快| 什么是直男| 为什么夏天容易拉肚子| 什么贤什么能| 开窍是什么意思| 脸部麻木是什么原因引起的| 满族不吃什么肉| 劣迹斑斑是什么意思| 咽痛吃什么药| 什么是易孕体质| 一天吃一个苹果有什么好处| 鸡蛋炒什么好吃| 扁平苔藓有什么症状| 风湿性关节炎用什么药| 6月3号什么星座| 什么石头最值钱| 什么的云朵| 月经老提前是什么原因| 结梁子什么意思| 扩心病是什么病| 胃有问题挂什么科| 为什么门牙突然有缝了| 丙肝阳性是什么意思呢| 甲氧氯普胺片又叫什么| 什么的小虾| 什么的流水| 天秤座有什么特点| 什么原因会怀上葡萄胎| 八月三日是什么星座| 农历6月28日是什么星座| 蛋白石是什么石头| 马蜂泡酒有什么功效| 云南白药治什么| 上焦火吃什么药最有效| 梅毒是什么意思| 长焦是什么意思| 至字五行属什么| 鞋子上eur是什么意思| 三摩地是什么意思| 便秘用什么药好| A型血为什么是完美血型| 右侧卵巢多囊样改变是什么意思| 果粉是什么意思| 嘉字五行属什么| 什么心丧气| 泥鳅不能和什么一起吃| 迂回是什么意思| 墨水用什么能洗掉| 什么是岩茶| 什么是庞氏骗局| 浮生若梦是什么意思| 吃党参有什么好处| 明月几时有的下一句是什么| pu什么意思| 耍无赖是什么意思| 5月6日是什么星座| 脱轨是什么意思| 谨记教诲是什么意思| 乳腺彩超什么时候做最准确| 知进退明得失什么意思| 你要什么| 妇科ph值是什么意思| 教诲的意思是什么| 油菜花什么时候开| 脾大是什么原因| 打篮球对身体有什么好处| 隐翅虫长什么样| 黄体酮有什么副作用| 限购是什么意思| 盆腔积液吃什么药好| 新股配号数量是什么意思| 经常头昏是什么原因| 碱性磷酸酶偏高说明什么问题| 中国最贵的烟是什么烟| #NAME?| 六合是什么意思| 电轴不偏是什么意思| 夜不能寐什么意思| 什么叫血栓| 舞蹈考级有什么用| 螃蟹是什么季节吃的| 黄面是什么面| 中山大学是什么级别| 扩张是什么意思| 痔疮术后吃什么恢复快| 场面是什么意思| 脚趾痒用什么药| 京东自营店是什么意思| 自慰用什么| 为什么光放屁| 巴基斯坦是什么人种| 什么什么什么心| 猪肚炖什么| 血栓是什么症状| 塞屁股的退烧药叫什么| 手腕长痣代表什么意思| 急性胃炎吃什么药| 手脚发麻什么原因| 骨癌的前兆是什么症状| 上海曙光医院擅长什么| 穿山甲用什么中药代替| shit什么意思| 傍晚是什么时辰| 他克莫司是什么药| 炮灰是什么意思| 什么水果补血效果最好| 青柠是什么水果| 枳是什么意思| 婴幼儿吃什么奶粉好| 苹果是什么| 下眼袋发青是什么原因| 肚子咕咕叫是什么原因| 猫什么时候绝育| 梦见大狼狗是什么意思| 甲状腺实性结节什么意思| 常染色体是什么| 伶字五行属什么| 肝火旺是什么原因引起的| 两仪是什么意思| 鹰的天敌是什么动物| 脾胃不好有什么症状表现| 枣什么时候成熟| 胸外扩是什么样子| cob是什么意思| 肌张力高对宝宝有什么影响| 乌黑对什么| 买手店是什么意思| 风油精有什么作用| 麻烦是什么意思| 血糖高吃什么好| 认知障碍是什么意思| 姹什么嫣什么| 卵子是什么| 卵巢囊性结构是什么意思| 什么的骆驼| 痔疮嵌顿是什么意思| 0.5是什么意思| 喝酸奶有什么好处| 人为什么会缺钾| 糖耐是检查什么的| 月黑风高什么意思| 上海居住证积分有什么用| 咳嗽挂号挂什么科| 冥冥之中是什么意思| 尿检白细胞弱阳性是什么意思| 白芷是什么| 坛城是什么意思| 女生下体瘙痒用什么药| 吃坏东西肚子疼吃什么药| 英雄难过美人关是什么生肖| 人打嗝是什么原因| 病毒感冒吃什么消炎药| 风情万种的意思是什么| 尿路感染看什么科| 蜜蜂的天敌是什么| 神经衰弱吃什么好| 蒲公英和玫瑰花一起泡有什么功效| 谷氨酸是什么| 阴茎不硬吃什么药| 绿幽灵五行属什么| 饽饽是什么意思| 属猪的跟什么属相最配| 风化是什么意思| 一级亲属指的是什么| 什么粉可以代替木薯粉| 甲沟炎涂抹什么药膏最有效| 恶心反胃想吐吃什么药| 不宁腿综合症吃什么药| 白肉是指什么肉| 昝是什么意思| 喉咙干燥吃什么药| 阴道炎应该吃什么药| 孕妇补铁吃什么| 上火牙疼吃什么药| 补骨脂是什么东西| 蓝莓是什么味道| 冲蛇煞西是什么意思| 尿路感染需要做什么检查| 2043年是什么年| 湘潭市花是什么| 星芒是什么意思| 感统失调是什么意思| 宝诰是什么意思| 肺部结节灶是什么意思啊| 上大学需要准备什么| 一个月一个办念什么| 眼睛发蓝是什么原因| 男性阴囊潮湿是什么病| 苹果枸杞红枣煮水喝有什么功效| 眼睛有重影是什么原因| 熬夜到什么程度会猝死| 猫有什么品种| 201是什么意思| 蛋白尿吃什么食物好| 千年杀是什么| 羊配什么生肖最好| 胃出血是什么症状| 什么时候会怀孕| dic是什么病| 自残是什么心理| 为什么会孕酮低| 公主是什么意思| 便秘和腹泻交替出现是什么意思| 精英是什么意思| 为什么醋能让疣体脱落| 呼吸不顺畅是什么原因| 人是由什么组成的| 狗为什么怕猫| 1月13日是什么星座| 阴超能检查出什么| 7月11日什么星座| 九寨沟什么时候去最好| 蜜蜡什么样的成色最好| 内膜回声欠均匀是什么意思| pet一ct是一种什么检查| 元胡是什么| 初潮什么意思| 宝宝什么时候开始说话| 不造是什么意思| 止咳化痰吃什么药| 两面派是什么意思| 什么是肺大泡| 谷氨酰转肽酶高什么原因| 什么叫单反相机| 心跳过速是什么原因| fla是什么牌子| 脑内腔隙灶是什么意思| 晁盖的绰号是什么| 臣字五行属什么| 百度

一季度股票私募业绩亮眼 策略产品平均收益为负!

百度 上半场古德利爆射收获恒大首球,阿兰头槌破门完成传射。

The 'math package' is a reasonably discrete block of code that provides floating-point arithmetic capability for the rest of BASIC. It also includes some math functions, such as SQR (square root) and is probably the hardest part of BASIC to understand. There are three general reasons for this :


Maths Refresher

The Basics of Bases

Consider an everyday decimal number such as 317.25. The digits that make up this and every other decimal number represent multiples of powers of ten, all added together:

102 101 100 . 10-1 10-2
3 1 7 . 2 5

So writing 317.25 is basically just shorthand for 3*102 + 1*101 + 7*100 + 2*10-1 + 5*10-2. The shorthand form is far more readable, and that's why everybody uses it. At risk of labouring the point, the below table should clarify this.

Digit Position Digit Value for Position Decimal Number Digit value for this number
2 100 317.25 3 * 100 = 300
1 10 317.25 1 * 10 = 10
0 1 317.25 7 * 1 = 7
-1 1/10 317.25 2 * .1 = .2
-2 1/100 317.25 5 * .01 = .05
Total: = 317.25

Now consider the same number in binary (base two). The decimal number 317.25, expressed in binary, is :

28 27 26 25 24 23 22 21 20 . 2-1 2-2
1 0 0 1 1 1 1 0 1 . 0 1

And here's a table like the decimal one above, which should make it completely clear (remember 'bit' is short for 'binary digit') :

Bit Position Bit Value for Position Binary Number Bit value for this number
8 256 100111101.01 1 * 256 = 256
7 128 100111101.01 0 * 128 = 0
6 64 100111101.01 0 * 64 = 0
5 32 100111101.01 1 * 32 = 32
4 16 100111101.01 1 * 16 = 16
3 8 100111101.01 1 * 8 = 8
2 4 100111101.01 1 * 4 = 4
1 2 100111101.01 0 * 2 = 0
0 1 100111101.01 1 * 1 = 1
-1 1/2 100111101.01 0 * 1/2 = 0
-2 1/4 100111101.01 1 * 1/4 = 0.25
Total: = 317.25

Mantissas, Exponents, and Scientific Notation

Now let's think about decimal numbers again. Another way of representing the number 317.25 is like this : 3.1725 * 102. Yes we've split one number into two numbers - we've extracted the number's magnitude and written it seperately. Why is this useful? Well, consider a very small number such as 0.00000000000588. Looking at it now, precisely how small is that? That's a lot of zeros to work through. Also, let's pretend we're using very small numbers like this one in a pen+paper calculation - something like 0.00000000000588 + 0.000000000000291. You'd better be sure you don't miss out a zero when you're working the problem through, or your answer will be off by a factor of 10. It's much easier to have those numbers represented as 5.88 * 10-12 and 2.91* 10-13 (yes the second number had an extra zero - did you spot that?). The same principle applies for very large numbers like 100000000 - it's just easier and less human error prone to keep the magnitudes seperated out when working with such numbers.

It's the smallest of small steps to get from this form of number notation to proper scientific notation. The only difference is how the magnitude is written - in scientific notation we lose the magnitude's base and only write it's exponent part, thusly : 3.1725 E 2. The part that's left of the E, the 3.1725, is called the mantissa. The bit to the right of the E is the exponent.

Mantissas and Exponents in Binary

Let's go back to considering 317.25 in binary : 100111101.01. Using scientific notation, this is 1.0011110101 E 1000. Remember that both mantissa and exponent are written in binary that exponent value 1000 is a binary number, 8 in decimal.


Why floating point?

Consider the eternal problem of having a finite amount of computer memory. Not having infinate RAM means we cannot represent an infinite range of numbers. If we have eight bits of memory, we can represent the integers from 0 to 255 only. If we have sixteen, we can raise our range from 0 to 65535, and so on. The more bits we can play with, the larger the range of numbers we can represent. With fractional numbers there is a second problem : precision. Many fractions recur : eg one third in decimal is 0.33333 recurring. Likewise, one tenth is 0.1 in decimal but 0.0001100110011 last four bits recurring in binary.

So any method we choose for storing fractional numbers has to take these two problems into consideration. Bearing this in mind, consider the two possible approaches for storing fractional numbers :

Why is floating point better than fixed point? Let's say we have 32 bits to play with. Let's use fixed point and assign 16 bits for the integer part and 16 for the fractional part. This allows a range of 0 to 65535.9999 or so, which isn't very good value, range-wise, for 32 bits. OK, lets increase the range - we'll change to using 20 bits for the integer and 12 for the fraction. This gives us a range of 0 to 1,048,575.999ish . Still not a huge range, and since we've only got 12 bits for the fraction we're losing precision - numbers stored this way will be rounded to the nearest 1/4096th.

Now lets try floating point instead. Lets assign a whopping 24 bits for the mantissa and 8 bits for the exponent. 8 bits doesn't sound like much, but this is an exponent after all - with these 8 bits we get a range of -128 to +127 which is roughly 10-38 to to 1038. That's a nice big range! And we get 24 bits of precision too! It's clearly the better choice.

Floating point is not a perfect solution though... adding a very small number to a very large number is likely to produce an erroneous result. For example, go to the BASIC emulator and try PRINT 10000+.1. You get 10000.1 as expected. Now try PRINT 10000+.01 or PRINT 100000+.1. See?


Normalisation

Normalisation is the process of shifting the mantissa until it is between 0.5 and 1 and adjusting the exponent to compensate. For example, these binary numbers are unnormalised :

After normalisation these same binary numbers become :

blah


How Altair BASIC stored floating point numbers

There was no industry standard for floating-point number representation back in 1975, so Monte had to roll his own. He decided that 32 bits would allow an adequate range, and defined his floating-point number format like this :

Floating-point number representation in Altair BASIC

The 8-bit exponent field had a bias of 128. This just meant that the stored exponent was stored as 'exponent+128'.

Also, the mantissa was really 24 bits long, but squeezed into 23 bits. How did he save an extra bit of precision? By considering zero as a special case, indicated by exponent zero. Any non-zero number will always have a mantissa with a leading 1. And since the first bit is always going to be 1, why bother storing it?

The intermediate storage of unpacked fp numbers is undefined and seems to be generally done on the fly.

fixme: put example of normalising and denormalising.


 

八月十五什么星座 粉红粉红的什么 碘伏是什么 观音菩萨是属什么生肖 磁共振是检查什么的
淋巴结肿大是什么样子 喝牛奶不能和什么一起吃 怀孕脚浮肿是什么原因引起的 撩 是什么意思 排骨汤用什么排骨
鸡头米是什么东西 花红是什么意思 什么的爱心 3月21日什么星座 什么样的人容易抑郁
sad是什么意思 吃什么养肝护肝最好 规则是什么意思 什么是热量 什么颜色加什么颜色等于紫色
什么奶不能喝huizhijixie.com 25羟维生素d测定是什么jinxinzhichuang.com hp值是什么意思hcv9jop0ns7r.cn 脂膜炎是什么病fenrenren.com 红和绿混合是什么颜色ff14chat.com
空调有异味是什么原因hcv9jop3ns5r.cn bzd是什么意思hcv7jop5ns2r.cn 精神分裂症吃什么药hcv7jop9ns0r.cn 咖啡有什么作用cl108k.com 咽喉炎吃什么药能治好hcv9jop1ns3r.cn
雅漾属于什么档次beikeqingting.com 什么地赶来520myf.com 小苏打和食用碱有什么区别youbangsi.com 谷草转氨酶高吃什么药hcv9jop5ns2r.cn 爱情公寓6什么时候上映hcv9jop5ns9r.cn
卡粉是什么原因引起的xinmaowt.com sanag是什么牌子dayuxmw.com 空调的几匹是什么意思hcv8jop5ns7r.cn 刘备的马叫什么名字hcv9jop3ns7r.cn 左后背发麻是什么原因hcv9jop3ns9r.cn
百度