当前位置:网站首页>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 eigen introduction and simple use
- Uncover the secrets of Huawei application market application statistics
- Luogu p5536 [xr-3] core city (greed + tree DP looking for the center of the tree)
- V2X-Sim数据集(上海交大&纽约大学)
- Hdu1234 door opener and door closer (water question)
- 【深入浅出玩转FPGA学习2----设计技巧(基本语法)】
- flink二開,實現了個 batch lookup join(附源碼)
- 1287_ Implementation analysis of prvtaskistasksuspended() interface in FreeRTOS
- PCL extracts a subset from a point cloud
- One trick to quickly realize custom application titlebar
猜你喜欢

JSP webshell free -- webshell free

华为应用市场应用统计数据问题大揭秘

【AI应用】海康威视iVMS-4200软件安装

TIPC Cluster5

Kustomize user manual

Common methods of JS array

全网显示 IP 归属地,是怎么实现的?

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

js数组常用方法

618 what is the secret of dominating the list again? Nike's latest financial report gives the answer
随机推荐
Leetcode 182 Find duplicate email (2022.07.01)
Leetcode+ 76 - 80 storm search topic
The URL in the RTSP setup header of the axis device cannot take a parameter
Convert yv12 to rgb565 image conversion, with YUV to RGB test
【深入浅出玩转FPGA学习4----漫谈状态机设计】
JSP webshell free -- the basis of JSP
Point cloud projection picture
Appgallery connect scenario development practice - image storage and sharing
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 -- p1030 [noip2001 popularization group] find the first order
[AGC] build service 3 - authentication service example
TIPC messaging3
1287_ Implementation analysis of prvtaskistasksuspended() interface in FreeRTOS
Primary key policy problem
【AppLinking实战案例】通过AppLinking分享应用内图片
主键策略问题
Hdu1236 ranking (structure Sorting)
[play with FPGA learning 5 in simple terms ----- reset design]
JVM之垃圾回收器
VSCode工具使用