当前位置:网站首页>Why does LabVIEW lose precision in floating point numbers
Why does LabVIEW lose precision in floating point numbers
2022-07-02 11:07:00 【LabVIEW development】
LabVIEW Why floating point numbers lose precision
When using floating-point numbers or double precision floating-point numbers in the programming environment, I find that the value of numbers will change slightly . Such as input 2.4 It shows that 2.3999999999999999. Why does this inaccuracy happen to floating point numbers ?
answer : There are two main reasons for the imprecision of floating-point numbers :
The binary representation of decimal numbers may not be accurate
It is not uncommon that floating-point numbers or double precision floating-point numbers cannot be accurately represented . The reason why floating-point values cannot be accurately expressed in decimal is due to CPU The method of representing floating point numbers . In this case, some accuracy may be sacrificed , Some floating-point operations also introduce errors . Take the situation mentioned above as an example ,2.4 The binary representation of is not exactly 2.4. Instead, the closest binary representation is 2.3999999999999999. The reason is that floating point numbers consist of two parts : Index and mantissa . The value of a floating-point number is actually calculated by a specific mathematical formula .
If you want to get more information about this formula or mantissa , You can refer to “What is Mantissa?” article .
The accuracy loss encountered will be encountered in any operating system and programming environment .
Be careful : have access to BinaryCoded Decimal (BCD) Library to maintain accuracy .BCD Digital coding method will encode each decimal digit separately . If you want to know BCD More information about , You can refer to the article “What is Binary Coded Decimal(BCD)?”
For more information about this accuracy loss, please refer to IEEE/ANSI Standard 754-1985, This article includes Standardfor Binary Floating Point Arithmetic.
Type mismatch
Floating point number and double precision floating point number types may be mixed . Please make sure that all data types are the same when performing mathematical operations .
Be careful :float The only variables of type are 7 Bit accuracy , and double Variables of type are 15 Bit accuracy .

edit
Add picture comments , No more than 140 word ( Optional )
LabVIEW、LabVIEW Development 、LabVIEW Programming 、LabVIEW Program
Examples and information mentioned above , Both in word In the attachment in , Click to download . Learn more , Can you contact us .
边栏推荐
- 2022爱分析· 国央企数字化厂商全景报告
- TIPC介绍1
- Binary tree topic -- Luogu p3884 [jloi2009] binary tree problem (DFS for binary tree depth BFS for binary tree width Dijkstra for shortest path)
- 二叉树专题--AcWing 1589. 构建二叉搜索树
- C#中索引器
- How to use ide to automatically sign and debug Hongmeng application
- 【深入浅出玩转FPGA学习3-----基本语法】
- OpenMLDB Meetup No.4 会议纪要
- 洛谷 P1892 [BOI2003]团伙(并查集变种 反集)
- 主键策略问题
猜你喜欢

TIPC Cluster5
![[play with FPGA learning 5 in simple terms ----- reset design]](/img/57/816a59787259dc32b52897c069e1a6.png)
[play with FPGA learning 5 in simple terms ----- reset design]

TIPC Service and Topology Tracking4

VSCode工具使用

One trick to quickly realize custom application titlebar

Matlab processing of distance measurement of experimental electron microscope

Use Huawei performance management service to configure the sampling rate on demand

华为应用市场应用统计数据问题大揭秘
![[quick application] there are many words in the text component. How to solve the problem that the div style next to it will be stretched](/img/5c/b0030fd5fbc07eb94013f2699c2a04.png)
[quick application] there are many words in the text component. How to solve the problem that the div style next to it will be stretched

The most detailed MySQL installation tutorial
随机推荐
MySQL environment configuration
[AGC] build service 3 - authentication service example
Special topic of binary tree -- acwing 19 The next node of the binary tree (find the successor of the node in the tree)
[play with FPGA learning 5 in simple terms ----- reset design]
一招快速实现自定义快应用titlebar
Is the account above changtou school safe?
From Read and save in bag file Jpg pictures and PCD point cloud
The difference between self and static in PHP in methods
JSP webshell free -- webshell free
JVM garbage collector
洛谷 P5536 【XR-3】核心城市(贪心 + 树形 dp 寻找树的中心)
[SUCTF2018]followme
Kustomize user manual
【深入浅出玩转FPGA学习4----漫谈状态机设计】
【AGC】如何解决事件分析数据本地和AGC面板中显示不一致的问题?
Luogu p4281 [ahoi2008] emergency gathering / gathering (tree doubling LCA)
LabVIEW为什么浮点数会丢失精度
三.芯片启动和时钟系统
从.bag文件中读取并保存.jpg图片和.pcd点云
Special topic of binary tree -- acwing 3384 Binary tree traversal (known preorder traversal, while building a tree, while outputting middle order traversal)