当前位置:网站首页>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 .
边栏推荐
- 一招快速实现自定义快应用titlebar
- Appgallery connect scenario development practice - image storage and sharing
- 全网显示 IP 归属地,是怎么实现的?
- Jsp webshell Free from killing - The Foundation of JSP
- TIPC 寻址2
- Overview of integrated learning
- 洛谷 P1892 [BOI2003]团伙(并查集变种 反集)
- Disassembling Meitu SaaS: driving the plane to change the engine
- The URL in the RTSP setup header of the axis device cannot take a parameter
- Analysis of hot spots in AI technology industry
猜你喜欢
Binary tree topic -- Luogu p3884 [jloi2009] binary tree problem (DFS for binary tree depth BFS for binary tree width Dijkstra for shortest path)
华为应用市场应用统计数据问题大揭秘
Matlab processing of distance measurement of experimental electron microscope
flink二开,实现了个 batch lookup join(附源码)
1287_ Implementation analysis of prvtaskistasksuspended() interface in FreeRTOS
[AI application] Hikvision ivms-4200 software installation
最详细MySql安装教程
[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
二叉树专题--AcWing 1589. 构建二叉搜索树
一招快速实现自定义快应用titlebar
随机推荐
The most detailed MySQL installation tutorial
Special topic of binary tree -- acwing 19 The next node of the binary tree (find the successor of the node in the tree)
How to transfer event objects and user-defined parameters simultaneously in Huawei express applications
Special topic of binary tree -- acwing 3384 Binary tree traversal (known preorder traversal, while building a tree, while outputting middle order traversal)
洛谷 P1892 [BOI2003]团伙(并查集变种 反集)
PCL Eigen介绍及简单使用
JSP webshell free -- webshell free
Uncover the secrets of Huawei application market application statistics
Easyexcel, a concise, fast and memory saving excel processing tool
Use of vscode tool
二叉树专题--AcWing 1497. 树的遍历(利用后、中序遍历,构建二叉树)
TIPC协议
2022 love analysis · panoramic report of digital manufacturers of state-owned enterprises
TIPC 寻址2
二叉树专题--AcWing 19. 二叉树的下一个节点(找树中节点的后继)
MySQL lethal serial question 4 -- are you familiar with MySQL logs?
Oracle 笔记
HDU1234 开门人和关门人(水题)
Jsp webshell Free from killing - The Foundation of JSP
洛谷 P3398 仓鼠找 sugar(树上倍增 lca 判断树中两条路径是否相交 结论)