Fixed-Point types (exact value)-decimal, numeric
Decimal (M, d)
The decimal and numeric types store exact numeric data values.These types are used when it is important to preserve (SAVE) exact precision (precision), for example with
Var sum = 0;For (var I = 0; I Sum ++ = 0.1;}Console. log (sum );Will the above program output 1?Among the 25 JavaScript interview questions that you need to know, the 8th questions briefly explain why JavaScript cannot correctly handle decimal
How to solve multiple decimal places in Javascript decimal operations? Multiple decimal places in js decimal operations
Share with you an interesting test:
0.1 + 0.2 = 0.3 // falseSuddenly depressed, okay! 0.1 + 0.2 changed to:
There are non-standard data types such as float,double in MySQL, as well as standard data types such as decimal. The difference is that non-standard types, such as float,double, hold approximate values in db, while decimal saves values as strings.
SQL Server 2005 books online (September 2007)
Precision, decimal places, and length (TRANSACT-SQL)
Precision is the number of digits in a number. The number of decimal places is the number to the right of the decimal point in the number. For
Have a development colleague after the validation environment for a table to change the int field to decimal (10,4), prompted 1264 out of the range value error, consult the DBA why this error, what impact on the data.When I received this question,
Float,double is prone to error, when precision requirements are higher, it is recommended to use decimal to save, decimal in the MySQL memory is stored as a string, used to define the currency requirements of high precision data.
Example
Creates a
Repeating decimalsThe decimal expansion of the fraction 1/33 is, where the was used to indicate that the cycle repeats indefinitely with No intervening digits. In fact, the decimal expansion of every rational number (fraction) had a repeating cycle
Chapter 23. Precision mathTable of contents
23.1. Types of numeric values23.2. decimal data type changes23.3. Expression handling23.4. Rounding Behavior23.5. Precision math examplesMySQL 5 introduces precision math, that is, numeric value handling
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.