手指关节肿胀是什么原因| 眼窝凹陷是什么原因| 脚起皮干裂是什么原因| 继发性肺结核是什么意思| 双脚浮肿是什么原因| 周杰伦是什么星座| 普陀山求什么最灵| 延年是什么意思| 输尿管结石挂什么科| 7点到9点是什么时辰| 翠字五行属什么| 班禅是什么意思| 小众是什么意思| 孩子打喷嚏流鼻涕吃什么药| 狗贫血吃什么补血最快| 四叶草的寓意是什么| 自言自语是什么| 孤僻的人给人什么感觉| 春考是什么| hpv16有什么症状| 蜂蜜对人体有什么好处和功效| 红烧鱼用什么鱼| 伤口换药挂什么科啊| 左眼皮老跳是什么原因| 长春有什么大学| 胃不消化吃什么药效果最好| 冷冻是什么意思| ca199是什么检查项目| 生地和熟地有什么区别| 艺术有什么用| 降头是什么意思| 藿香是什么| 阳历是什么意思| 肿瘤和囊肿有什么区别| 乌龟为什么会叫| 啖是什么意思| 内鬼是什么意思| 蚊子为什么不咬我| 蚕屎有什么作用和功效| 夜叉是什么| 肝囊肿吃什么药能消除| 哮喘吃什么食物好| 布朗是什么水果| 生扶什么意思| 手部湿疹用什么药膏| 十字架代表什么意思| 上车饺子下车面什么意思| 康复治疗技术是什么| 木棉是什么面料| 颈椎不好挂什么科| 男士戴什么手串好| 空调制冷效果差是什么原因| 什么鱼炖汤好喝又营养| hpv感染是什么症状| 疣是什么病毒| 频繁是什么意思| 玉如意什么属相不能戴| 有氧运动和无氧运动有什么区别| 辐照食品是什么意思| 难过美人关是什么生肖| aj是什么意思| 脱发用什么药最好| pmid是什么意思| 什么是空调病| 唐字五行属什么| 88是什么意思| 辅酶是什么| 抗生素是什么意思| 海带与什么食物相克| 射精无力吃什么药最佳| 囡是什么意思| 清华大学什么时候成立| 眼发花是什么病的征兆| 脸上长粉刺是什么原因引起的| 做梦梦到老婆出轨是什么意思| 石家庄有什么好玩的景点| 性格是什么意思| 孔雀蓝配什么颜色好看| 飞的第一笔是什么| ce是什么元素| 夏至是什么| 噗什么意思| 心水是什么意思| 山西属于什么地区| 什么是2B铅笔| 为什么减肥不掉秤| 芈月和秦始皇什么关系| 三月十八是什么星座| 善存什么时间吃比较好| 10015是什么电话| 热毒吃什么药好得快| 歹人是什么意思| 特应性皮炎是什么意思| 黄体可能是什么意思啊| 什么知什么明| 杨公忌日是什么意思| 日成念什么| 李子是什么颜色| 腮腺炎吃什么药最管用| 疤痕子宫什么意思| 胃酸恶心想吐什么原因| 坐月子适合吃什么水果| 太平鸟属于什么档次| 血压低会导致什么后果| 营救是什么意思| 1月1日什么星座| 胸部ct平扫能检查出什么| 外阴白斑有什么症状| 清远有什么好玩的| 岂是什么意思| 水痘疫苗叫什么| 桃园三结义是什么意思| 去三亚穿什么衣服合适| 504是什么错误| 部长是什么职位| 黑五是什么时候| 放养是什么意思| 甜虾是什么虾| 信必可是什么药| 指甲看什么科| 肠炎能吃什么水果| 蚩是什么意思| 肠炎吃什么| 五十而知天命是什么意思| 虬是什么动物| 为什么喜欢你| 大小休是什么意思| 来大姨妈吃什么水果| 梦见红鞋子是什么意思| 糖尿病人吃什么水果最好| 牛油果是什么味道的| 吃什么补叶酸| 自然人是什么意思| 产后吃什么对身体恢复好| 什么东西能吃能喝又能坐| 狗狗打疫苗前后要注意什么| 睡觉老做梦是什么原因| 嘴角周围长痘痘是什么原因| 艾条什么牌子好用| 自贸区是什么意思| 乌鸡炖什么好吃又有营养| 继发不孕什么意思| 女生适合养什么狗| 妈妈的姐姐的儿子叫什么| 外阴又疼又痒用什么药| 寒湿体质吃什么中成药| 什么食物防辐射| 嗓子发炎是什么原因引起的| 化作风化作雨是什么歌| 什么拜之交| 小便不利是什么意思| 鼻基底用什么填充最好| 鱿鱼属于什么类| 纳米是什么| 艾滋病皮肤有什么症状| 眼干是什么原因| 眼睛老是肿着是什么原因造成的| 草包是什么意思| 丝状疣长什么样| pct什么意思| 四个又念什么| 广州五行属什么| 西葫芦炒什么好吃| 呲牙咧嘴是什么意思| 痛经是什么引起的| 龟头炎用什么药膏好| 哺乳期可以喝什么茶| 豺狼虎豹为什么豺第一| 产褥热是什么病| 三月阳春好风光是什么生肖| 吃什么白头发变黑| 抄手是什么| 踏空是什么意思| 皿是什么意思| 世界上最多的动物是什么| 草木皆兵是什么意思| 芝麻开花节节高是什么意思| 胎停是什么意思| 拜土地公时要念什么好| 二尖瓣轻度反流是什么意思| 月球是地球的什么星| 压强是什么| 硬卧代硬座是什么意思| 左肺上叶钙化灶什么意思| 眼皮肿痛什么原因| 空调风扇不转是什么原因| 黄疸是什么原因引起的| 摇粒绒是什么面料| 为什么喉咙总感觉有东西堵着| 孕妇梦见洪水是什么意思| 道士是干什么的| 小孩急性肠胃炎吃什么药| 鑫字代表什么生肖| 殷是什么意思| 经期适合喝什么茶| 尿液发黄是什么病| 肉芽是什么| 一什么不什么的成语| 医院验光挂什么科| 门昌念什么| 泉州有什么特产| 屁多是什么病的前兆| 耽美剧是什么意思| 不建议什么意思| 活菩萨是什么意思| 咳嗽咳出血是什么原因| 猫需要打什么疫苗| 鼻炎会引起什么症状| 头油是什么原因引起的| 镜里观花是什么生肖| 身份证照片穿什么颜色衣服| 什么咖啡好喝| 拿手机手抖是什么原因| 手机充电发烫是什么原因| 槟榔吃多了有什么危害| 健康证需要检查什么| 看正月初一是什么生肖| 嘴麻是什么原因引起的| 多吃苹果有什么好处| 酒是什么时候发明的| 鸽子夏天喝什么水好| 竹节麻是什么面料| 海螵蛸是什么东西| 梦见腿断了是什么意思| 新生儿什么时候吃ad| 意什么深什么| 水瓶座后面是什么星座| 每天熬夜有什么危害| 菊花茶为什么会变绿色| 包皮炎用什么软膏| 今年是什么| 望周知是什么意思| 乐五行属性是什么| 属狗的本命佛是什么佛| 六七年属什么生肖| 检查尿常规挂什么科| 胆汁为什么会反流到胃里面| 吃猪血有什么好处和坏处| 张嘴睡觉是什么原因| 红薯是什么茎| 什么牌子皮带结实耐用| 润物细无声是什么意思| 身体肿是什么原因引起的| 苔藓是什么植物| 什么食物可以化解结石| hco3-是什么意思| 补中益气丸适合什么人吃| 沈阳六院主要治什么病| 尿蛋白是什么原因造成的| 什么牌子的手机好| 什么不迫| 糖类抗原125是什么意思| 副支队长是什么级别| 扁桃体发炎吃什么水果| 结缔组织病是什么病能治愈吗| 佑五行属什么| 吃芥末有什么好处| 水杉是什么植物| 吃烧烤后吃什么水果可以帮助排毒| 急性肠胃炎可以吃什么| 跨界是什么意思| 三尖瓣轻度反流说明什么| 什么是黑天鹅事件| 二聚体测定是什么| 百度Jump to content

沈阳国际广告节盛大开幕

From Wikibooks, open books for an open world
百度 “八婶,这房子不能拆。

Floating point numbers are ....

Like all information, floating point numbers are represented by bits.

Early computers used a variety of floating-point number formats. Each one required slightly different subroutines to add, subtract, and do other operations on them.

Because some computer applications use floating point numbers a lot, Intel standardized on one particular format, and designed floating-point hardware that calculated much more quickly than the software subroutines. The 80186 shipped with a floating-point co-processor dubbed the 80187. The 80187 was a floating point math unit that handled the floating point arithmetic functions. In newer processors, the floating point unit (FPU) has been integrated directly into the microprocessor.

Many small embedded systems, however, do not have an FPU (internal or external). Therefore, they manipulate floating-point numbers, when necessary, the old way. They use software subroutines, often called a "floating point emulation library".

However, floating-point numbers are not necessary in many embedded systems. Many embedded system programmers try to eliminate floating point numbers from their programs,[1] instead using fixed-point arithmetic. Such programs use less space (fixed-point subroutine libraries are far smaller than floating-point libraries, especially when just one or two routines are put into the system). On microprocessors without a floating-point unit, the fixed-point version of a program usually runs faster than floating-point version. However, these embedded system programmers must figure out exactly how much accuracy a particular application needs, and make sure their fixed-point routines maintain at least that much accuracy.

Math Routines

[edit | edit source]

(Is there a better place in this wikibook for this discussion? It doesn't even mention floating point.)

Low-end embedded microcontrollers typically don't even have integer multiply in their instruction set.[2] So on low-end CPUs, you must use routines that synthesize basic math operators (multiply, divide, square root, etc.) from even simpler steps. Practically all microprocessors have such routines, posted on the internet by their manufacturer or other users ("Multiplication and Division Made Easy" by Robert Ashby, "Novel Methods of Integer Multiplication and Division", "efficient bit twiddling methods", etc.).

Following the advice known as "Make It Work Make It Right Make It Fast" and "Make It Work Make It Small Make It Fast", many people pick one or two number resolutions that are adequate for the largest and most precise kind of data handled in a program, and use that resolution for everything. For desktop machines, often 32-bit integers and 64 bit "double precision floating point" numbers are more than adequate. For embedded systems, often 24-bit integers and 24-bit "fixed point" numbers are more than adequate. If the software fits in the microcontroller, and is plenty fast enough, it is a waste of valuable human time to try to "optimize" it further.

Alas, sometimes the software does not fit in the microcontroller.

  • If you run out of RAM, sometimes you only need 2 bytes or 1 byte or 4 bits or 1 bit to store a particular variable.
  • If you run out of time, sometimes you can add lower-precision math routines that quickly calculate the results needed for that inner loop, even though other parts of the code may need higher-precision math routines.
  • If you run out of ROM, sometimes you can trade time for ROM space. Rather than a collection of sets of math routines, each one customized to a slightly different width, you can use a single set of math routines that can handle the maximum possible width. If you have some variables less than that width (to save RAM), then you typically sign-extend variables into a full-size register or global buffer, do full-width calculations there, and then truncate and store the result to the small size.

Fixed-Point Arithmetic

[edit | edit source]

Some embedded microprocessors may have an external unit for performing floating point arithmetic(FPU), but most low-end embedded systems have no FPU. Most C compilers will provide software floating point support, but this is significantly slower than a hardware FPU. As a result, many embedded projects enforce a no floating point rule on their programmers.[3][4][5][6][7] This is in strong contrast to PCs, where the FPU has been integrated into all the major microprocessors, and programmers take fast floating point number calculations for granted. Many DSPs also do not have an FPU and require fixed-point arithmetic to obtain acceptable performance.[8]

A common technique used to avoid the need for floating point numbers is to change the magnitude of data stored in your variables so you can utilize fixed point mathematics. For example, if you are adding inches and only need to be accurate to the hundredth of an inch, you could store the data as hundredths rather than inches. This allows you to use normal fixed point arithmetic. This technique works so long as you know the magnitude of data you are adding ahead of time, and know the accuracy to which you need to store your data.

People use many tricks and techniques to speed up Fourier transform calculation. The fast Fourier transform (FFT) is the biggest speedup, but there are several other tricks on top of that that each can give another factor of two improvement.[9][10]

Many people do FFT using fixed-point arithmetic.[11][12][13][14][15][16]

The Fast Hartley Transform is an alternative that requires less resources than the FFT.[17]

DTMF decoders often use the Goertzel algorithm because, when only a few frequencies need to be analyzed, it is much faster than the FFT algorithm.

... more tips and hints here ...

Further reading

[edit | edit source]
  1. Avoiding floating point arithmetic on the iPhone
  2. Robert Ashby. "Simplifying Formulas". 2006. quote: "we still need to find ways to simplify complex problems before we can put them into our 50-cent micros. Hardware multiplication is rarely seen below $1.50 ... That leaves us with the target of reducing everything down to addition, subtraction, shifting bits, and comparisons."
  3. "Stop using floating point!". quote: "Please learn to use fixed-point arithmetic"
  4. "Writing efficient JavaScript (HTML)" quote: "Use integer arithmetic where possible"
  5. Erich Styger. "Adding/Removing Floating Point Format for S08 Projects". quote: "Usually I do *not* use floating point numbers in my projects."
  6. "Avoiding floating point math".
  7. "Avoid floating point in hash table implementation."
  8. Boris Lerner. "Fixed vs. floating point: a surprisingly hard choice".
  9. Douglas L. Jones. "Decimation-in-time (DIT) Radix-2 FFT". OpenStax-CNX. September 15, 2006.
  10. Douglas L. Jones. "Efficient FFT Algorithm and Programming Tricks". OpenStax-CNX. February 24, 2007
    • Kiss FFT library that can use either fixed or floating point data types.
  11. Simon Inns. "Fast Hartley Transformation Library for AVR microcontrollers".
塑料袋是什么材质 1972年属什么 霜降是什么季节 手脚脱皮吃什么维生素 脚踩按摩垫有什么好处
药剂师是干什么的 红薯什么时候成熟 甲状腺不均质改变是什么意思 肾虚吃什么补 什么狗不会咬人
肩膀酸痛是什么原因 小腿酸什么原因 中国的国球是什么球 伊朗用什么货币 莲藕什么时候种植最佳
心肌酶高是什么原因 孕早期吃什么 体外射精什么意思 梦见打麻将是什么意思 地瓜不能和什么一起吃
什么蛇没毒weuuu.com 头麻是什么病的前兆dayuxmw.com 心肌酶高有什么危害hcv9jop0ns9r.cn 政委什么级别hcv8jop3ns4r.cn 北极熊为什么不怕冷hcv7jop6ns4r.cn
总胆汁酸高吃什么药weuuu.com 痔疮是什么样子xianpinbao.com 身份证借给别人有什么危害性hcv9jop8ns0r.cn 葡萄糖偏高是什么原因hcv9jop2ns8r.cn com什么意思hcv8jop2ns5r.cn
增加骨密度吃什么药hcv9jop2ns6r.cn s和m是什么hcv8jop4ns4r.cn 打假是什么意思hcv8jop7ns1r.cn 饭后放屁多是什么原因hcv8jop5ns9r.cn 不是什么hcv7jop5ns6r.cn
11月11是什么星座hcv7jop5ns4r.cn 什么对雨1949doufunao.com 2月10号是什么星座hcv7jop6ns9r.cn 苯氧乙醇是什么hcv8jop8ns2r.cn 养病是什么意思hcv8jop2ns6r.cn
百度