Original URL: http://blog.sina.com.cn/s/blog_827d041701017ctm.htmlQuestions raised: 12.0f-11.9f=0.10000038, "Lose The Endless" why?An explanation from MSDN:Http://msdn.microsoft.com/zh-cn/c151dt3s.aspxWhy floating-point numbers may lose precision
In the project, the float type is used to define some columns, such as price, but many problems are found.1. When the number of bits on the value is greater than 6, the float type is converted to the varchar type, which is displayed in the
Today, I saw this code in a C # exercise 100 example:
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->1 float f_a = 2323.03f;2 double d_a = 2323.03d;3 bool b_a
Recently, due to programming needs, I have made some research on C # type conversion, the content involves C # Packing/unpacking/alias, mutual conversion between numeric types, ASCII and Unicode characters, conversion between numeric strings and
Document directory
GetBoost
When the full-text search module involves the weight, no matter how you set the weight, you can view that the retrieved weight is 1, and you think you have written an error, but the score of the document has changed.
Decimal (numeric) synonymous for precise storage of numeric valuesfloat and real cannot store values accuratelyThe decimal data type can store up to 38 digits, and all numbers can be placed to the right of the decimal point. The decimal data type
Always thought float subtraction operation is very simple, is to convert it to __float32_add and __float32_sub These two function calls, and then use software simulation to add and subtract operations. But is it really that simple? Is it still the
Cy163 note:In this article, "mysql_row pointer is a simple string array. All data types are converted to strings and sent to the client ." It makes sense. In additionArticleLearn how to useAtoi ()AndAtof ()Convert int and float values in the
Question: 12.0f-11.9f = 0.10000038, why?
Now let's take a closer look at why floating point operations cause loss of precision?
1. binary representation of decimals
First, we need to clarify the following two problems:
(1) how to convert a
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.