当前位置:网站首页>Data type - floating point (C language)
Data type - floating point (C language)
2022-07-07 08:30:00 【It's a dream, it's you!】
Catalog
1 Understand the representation and storage form of floating point numbers
1.1 Floating point classification
1.2 General representation of representation
1.3 Representation form — Exponential representation
1.4 Floating point storage format
2 Floating point variables and constants
3 Comparison between floating-point numbers and zero values
3.1 Floating point number none “ zero ”
3.2 Floating point “ Zero value ”
1 Understand the representation and storage form of floating point numbers
1.1 Floating point classification
C Language provides 3 There are specific floating-point types :(1)float- Single precision floating point(2)double- Double precision floating point(3)long double- Long double precision floating point1.2 General representation of representation
(1) General notation :[ Integral part ].[ Mantissa part ].The decimal point cannot be omitted , The integer part and mantissa part can be omitted , But you can't omit .1.3 Representation form — Exponential representation
Index method : [ Sign bit ][ Mantissa part ]e[ Index part ].Format requirements :e And front must There are numbers ,e and E All are OK Index The part can be positive or negative or 0, but Must be an integer .1.4 Floating point storage format
The storage format is divided into three parts : Symbol part 、 mantissa Part and Index part .
2 Floating point variables and constants
2.1 Floating point constants
The default is double type , Such as :3.5、4.0 And 3.5D、4.0d Equivalent .Single precision constant , You need to explicitly add a suffix after the value f or F Such as 3.5f or 4.0F etc. .2.2 Floating point variables
float f1=3.14F,f2;f2=9.8f;double d1;d1=3.2; Equivalent tod1=3.2d
3 Comparison between floating-point numbers and zero values
3.1 Floating point number none “ zero ”
3.2 Floating point “ Zero value ”
Floating point numbers x And 0 Of The distance is less than or equal to the set value , I think x by “ zero ”Illustrate with examples :math.h in fabs Find the absolute value of floating point numberconst float ESP=1E-6F;fabs(x-0)<=ESP Represents a floating point type x by zero value .Floating point numbers x And 0 Of The distance is less than or equal to the set value , I think x by “ zero ”
边栏推荐
- The use of generics and vararg variable parameters in kotlin
- Transformation function map and flatmap in kotlin
- Improve the delivery efficiency of enterprise products (1) -- one click installation and upgrade of enterprise applications
- Grpc, oauth2, OpenSSL, two-way authentication, one-way authentication and other column directories
- Use of out covariance and in inversion in kotlin
- Rainbow version 5.6 was released, adding a variety of installation methods and optimizing the topology operation experience
- POJ - 3616 Milking Time(DP+LIS)
- 字符串操作
- 下载和安装orcale database11.2.0.4
- Using nocalhost to develop microservice application on rainbow
猜你喜欢
Splunk子查询模糊匹配csv中字段值为*
The field value in Splunk subquery fuzzy matching CSV is*
Opencv learning note 5 - gradient calculation / edge detection
Train your dataset with swinunet
[untitled]
在Rainbond中实现数据库结构自动化升级
SSM integration
Practice of implementing cloud native Devops based on rainbow library app
2 - 3 arbre de recherche
Lua programming learning notes
随机推荐
Use of out covariance and in inversion in kotlin
Basic use of CTF web shrink template injection nmap
Several ways of lambda used in functions in kotlin (higher-order functions)
2-3查找樹
The field value in Splunk subquery fuzzy matching CSV is*
opencv学习笔记一——读取图像的几种方法
Using nocalhost to develop microservice application on rainbow
What is the function of paralleling a capacitor on the feedback resistance of the operational amplifier circuit
发挥创客教育空间的广泛实用性
Bisenet features
Deit learning notes
Train your dataset with swinunet
Infix keyword infix expression and the use of generic extension function in kotlin
2-3查找树
MES system is a necessary choice for enterprise production
接口作为参数(接口回调)
利用 Helm 在各类 Kubernetes 中安装 Rainbond
Golang 编译约束/条件编译 ( // +build <tags> )
[quick start of Digital IC Verification] 10. Verilog RTL design must know FIFO
一文了解如何源码编译Rainbond基础组件