当前位置:网站首页>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 .
边栏推荐
- (5) Gear control setting of APA scene construction
- 一.STM32的开发环境,keil5/MDK5.14安装教程(附下载链接)
- 如何用list组件实现tabbar标题栏
- Special topic of binary tree -- [deep base 16. Example 7] ordinary binary tree (simplified version) (multiset seeks the precursor and subsequent sentry Art)
- Convert yv12 to rgb565 image conversion, with YUV to RGB test
- Special topic of binary tree -- Logu p1229 traversal problem (the number of traversals in the middle order is calculated when the pre and post order traversals of the multiplication principle are know
- Binary tree topic -- Luogu p3884 [jloi2009] binary tree problem (DFS for binary tree depth BFS for binary tree width Dijkstra for shortest path)
- Flick two open, realized a batch lookup join (with source code)
- MySQL keyword
- 二叉树专题--AcWing 19. 二叉树的下一个节点(找树中节点的后继)
猜你喜欢
js数组常用方法
[AGC] build service 3 - authentication service example
二叉树专题--AcWing 47. 二叉树中和为某一值的路径(前序遍历)
Jsp webshell Free from killing - The Foundation of JSP
Dialogue Wu Gang: why do I believe in the rise of "big country brands"?
Leetcode+ 76 - 80 storm search topic
Nodejs+express+mysql simple blog building
Flick two open, realized a batch lookup join (with source code)
Creation and use of unified links in Huawei applinking
[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
随机推荐
实验电镜距离测量之Matlab处理
Flick two open, realized a batch lookup join (with source code)
JSP webshell免殺——JSP的基礎
二叉树专题--AcWing 1497. 树的遍历(利用后、中序遍历,构建二叉树)
Easyexcel, a concise, fast and memory saving excel processing tool
软件产品管理系统有哪些?12个最佳产品管理工具盘点
【深入浅出玩转FPGA学习2----设计技巧(基本语法)】
TIPC Getting Started6
UWA report uses tips. Did you get it? (the fourth bullet)
2022-06-17
Leetcode+ 76 - 80 storm search topic
如何用list组件实现tabbar标题栏
The URL in the RTSP setup header of the axis device cannot take a parameter
Logu p3398 hamster looks for sugar (double LCA on the tree to judge whether the two paths in the tree intersect)
MySQL lethal serial question 3 -- are you familiar with MySQL locks?
二叉树专题--洛谷 P3884 [JLOI2009]二叉树问题(dfs求二叉树深度 bfs求二叉树宽度 dijkstra求最短路)
Static variables in static function
PCL之K-d树与八叉树
力扣(LeetCode)182. 查找重复的电子邮箱(2022.07.01)
使用华为性能管理服务,按需配置采样率