当前位置:网站首页>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 .
边栏推荐
- PCL之K-d树与八叉树
- Filtering of PCL
- 华为快应用中如何实现同时传递事件对象和自定义参数
- flink二開,實現了個 batch lookup join(附源碼)
- Is the account above changtou school safe?
- Oracle 笔记
- LabVIEW为什么浮点数会丢失精度
- Use Huawei performance management service to configure the sampling rate on demand
- [quick application] win7 system cannot run and debug projects using Huawei ide
- 【深入浅出玩转FPGA学习3-----基本语法】
猜你喜欢

flink二開,實現了個 batch lookup join(附源碼)

How to implement tabbar title bar with list component

Hdu1228 a + B (map mapping)

OpenMLDB Meetup No.4 会议纪要

二叉树专题--AcWing 3540. 二叉搜索树建树(实用板子 构建二叉搜索树 并输出前、中、后序遍历)

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

【AppLinking实战案例】通过AppLinking分享应用内图片
![Luogu p5536 [xr-3] core city (greed + tree DP looking for the center of the tree)](/img/dc/2aa55c9b3f23c292820a56ea72fedd.png)
Luogu p5536 [xr-3] core city (greed + tree DP looking for the center of the tree)

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

JVM之垃圾回收器
随机推荐
TIPC Cluster5
V2X-Sim数据集(上海交大&纽约大学)
Learn open62541 -- [66] UA_ Generation method of string
Summary of cases of players' disconnection and reconnection in Huawei online battle service
js数组常用方法
MySQL lethal serial question 4 -- are you familiar with MySQL logs?
Binary tree topic -- p1030 [noip2001 popularization group] find the first order
软件产品管理系统有哪些?12个最佳产品管理工具盘点
2. Hacking lab script off [detailed writeup]
PCL point cloud to depth image
Calculate the sum of sequences
MySQL environment configuration
[applinking practical case] share in app pictures through applinking
Primary key policy problem
The URL in the RTSP setup header of the axis device cannot take a parameter
nodejs+express+mysql简单博客搭建
The difference between self and static in PHP in methods
[ark UI] implementation of the startup page of harmonios ETS
[play with FPGA learning 2 in simple terms ----- design skills (basic grammar)]
【ARK UI】HarmonyOS ETS的启动页的实现