当前位置:网站首页>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 .
边栏推荐
- Appgallery connect scenario development practice - image storage and sharing
- 【付费推广】常见问题合集,推荐榜单FAQ
- 二叉树专题--AcWing 3540. 二叉搜索树建树(实用板子 构建二叉搜索树 并输出前、中、后序遍历)
- 正则及常用公式
- LabVIEW为什么浮点数会丢失精度
- Static variables in static function
- [ark UI] implementation of the startup page of harmonios ETS
- TIPC协议
- 三.芯片启动和时钟系统
- In the face of uncertainty, the role of supply chain
猜你喜欢

二叉树专题--AcWing 18. 重建二叉树(利用前、中序遍历,构建二叉树)

【AGC】如何解决事件分析数据本地和AGC面板中显示不一致的问题?

Special topic of binary tree -- acwing 3384 Binary tree traversal (known preorder traversal, while building a tree, while outputting middle order traversal)

TIPC Cluster5

华为应用市场应用统计数据问题大揭秘
![[TS] 1368 seconds understand typescript generic tool types!](/img/2b/58a850b52ce8a9b2e6e7b6b72b0fe5.jpg)
[TS] 1368 seconds understand typescript generic tool types!

VSCode工具使用

Special topic of binary tree -- acwing 47 Path with a certain value in binary tree (preorder traversal)

Implement custom drawer component in quick application

TIPC messaging3
随机推荐
[ark UI] implementation of the startup page of harmonios ETS
【付费推广】常见问题合集,推荐榜单FAQ
Leetcode+ 76 - 80 storm search topic
集成学习概览
Huawei game failed to initialize init with error code 907135000
[in simple terms, play with FPGA learning 3 ----- basic grammar]
【AGC】构建服务3-认证服务示例
【深入浅出玩转FPGA学习3-----基本语法】
Record attributeerror: 'nonetype' object has no attribute 'nextcall‘
2022爱分析· 国央企数字化厂商全景报告
K-d tree and octree of PCL
二叉树专题--AcWing 18. 重建二叉树(利用前、中序遍历,构建二叉树)
[paid promotion] collection of frequently asked questions, recommended list FAQ
[TS] 1368 seconds understand typescript generic tool types!
Hdu1228 a + B (map mapping)
Point cloud projection picture
[play with FPGA learning 4 in simple terms ----- talk about state machine design]
PCL extracts a subset from a point cloud
【AGC】如何解决事件分析数据本地和AGC面板中显示不一致的问题?
Special topic of binary tree -- [deep base 16. Example 7] ordinary binary tree (simplified version) (multiset seeks the precursor and subsequent sentry Art)