当前位置:网站首页>1.4 - 定点数与浮点数
1.4 - 定点数与浮点数
2022-06-30 06:12:00 【是李黏黏鸭】
目录
一、定点数
1、定义
小数点位置固定不变的数,叫做定点数;
2、定点数的分类
定点整数:约定小数点 固定在最低有效数位之后;
定点小数:约定小数点 固定在符号位之后,最高有效数位之前;
二、浮点数
1、理解
相当于生活中的科学计数法;例如生活中的10进制5000,可以写成以下几种形式;
由图可知,小数点的位置是可以不断变化的;且小数点位置的变化,不会影响表达式整体数值的大小;这就是浮点数;
所以如果想保存5000这个数,需要把两部分都保存起来才是一个完整的数;

2、定义
小数点位置不固定,可以发生变化;
小数点位置的变化,不会影响数值的大小;
3、表达式

M:尾数;
R:底数;生活中用十进制,R就是10;计算机中用二进制,R就是2;
e:指数部分;在计算机中叫做阶码;
4、计算机中存储浮点数
由于在计算集中,底数是2,所以就不需要保存了;
只需要保存尾数和指数(阶码),就能保存一个完整的数;
所以计算机中浮点数的表达格式由两个格式组成:阶码+尾数;
![]()
5、理解阶码和尾数
阶码:决定数值表示的范围,也就是这个浮点数最大能表示到哪个数;
尾数:决定数值表示的精度;尾数越大的话表示这个数值越精确;

注意:
由于计算机中约定固定长度的二进制位表示一个数,所以增加阶码的长度或尾数的长度,势必会导致另一部分的变化;
6、浮点数的运算
(1)运算步骤

(2)对阶:让数的阶码一致;
例如,一个科学计数法表示的数减去一个整数B,不能直接用科学计数法的底数直接去减整数,需把两个数调整成同一指数的格式再进行运算;


(3)尾数计算

(4)结果格式化
按照要求将结果转换成对应的格式即可。
![]()
三、考法1:定点数与浮点数的特点

边栏推荐
- 重构之美:当多线程批处理任务挑起大梁 - 万能脚手架
- 反编译正常回编译出现问题自己解决办法
- SHELL
- Prototype and prototype chain in JS
- PHP knowledge points
- Feisheng: Based on the Chinese word breaker ik-2 ways to build custom hot word separators Showcase & pit arrangement Showtime
- Notes of the first week of 2021 Chengdu Arts and Sciences cloud computing intensive training class
- ES6解构赋值
- Rhcsa day 1
- Simple example of class template
猜你喜欢

C language final experiment report (student achievement management system) source code

gazebo/set_ model_ State topic driving UAV model through posture

Verilog中case,casez,casex语句的用法

1.6 - CPU组成

1.7 - CPU的性能指标

Application of redis client list in practice

CompletableFuture从了解到精通,你想知道的这里都有

Use and principle of completionservice (source code analysis)

Idea run SQL file

圖像處理7-圖像增强
随机推荐
There is a group of students' score {99, 85, 82, 63, 60}. To add a student's score, insert it into the score sequence and keep the descending order
Zibll sub theme v6.4.1wordpress open source download_ Crack the original / use it directly / no tutorial required
Basic use of markdown
接口中方法详解
IO streams (common streams)
Unclear about glide loading picture
圖像處理7-圖像增强
Beauty of Refactoring: when multithreaded batch processing task lifts the beam - Universal scaffold
Ini parsing learning documents
JS prototype chain object function relationship
Intelligent question - horse racing question
Several commands not commonly used in MySQL
SHELL
HuaWei满级大牛首次分享出这份598页网络协议全彩手册
To: k210 realizes face recognition (code interpretation attached)
一个完整的性能测试流程
Docker is equipped with the latest MySQL image
Vscode configuration proxy
Altium designer creates multiple class networks to realize different lineweights of multiple networks
Learn fpga---ram IP core and key parameters from the bottom structure