What is the difference between scale and precision




















It only takes a minute to sign up. Connect and share knowledge within a single location that is structured and easy to search. Precision is the number of digits in a number. Scale is the number of digits to the right of the decimal point in a number. For example, the number I would have expected it the other way round. Just to be clear: This is not a rant disguised as a question, and more than mere curiosity. I am convinced that there is a good reason for this terminology, and I think I can learn about databases by understanding the underlying thinking here.

If this question is considered too basic for here, I understand. Precision and Scale are based on the mathematical concept of Significant Figures. How does the total number of digits relate to the everyday concept of precision how 'exact' something is measured? First, you must remember that everything in computers is represented in binary; however not all numbers are easily represented using binary syntax, specifically when it comes to certain fractions.

However, it can get more precise e. Precision can therefore be thought of as how exact a number you want to represent.

The more digits used to define the number, the more precise that number becomes. Scale may best be explained with how we look at maps. A map of a state or province shows a much larger area with less detail, whereas a map of a city shows a smaller area at greater detail.

Scale can therefore be thought of as the amount of detail. The more detail we want to convey comes at the cost of showing less actual stuff. I don't know if that helps you at all, but hopefully that helps provide some context behind the definitions of these terms.

As noted in ypercube's Wikipedia link, precision is related to the concept of significant figures or significant digits. Example: If you have a scale that measures mass to the milligram, and you have a precision of eight digits three to the right of the decimal point, just for argument's sake , you can say something has a mass of The scale can range from to In your case, ID with precision 6 means it won't accept a number with 7 or more significant digits.

Precision is the total number of digits, can be between 1 and Scale is the number of digits after the decimal point, may also be set as negative for rounding. EX: If value is How are we doing? Please help us improve Stack Overflow.

Take our short survey. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. What is the difference between precision and scale? Ask Question. Asked 10 years, 7 months ago. Active 2 years ago. Viewed k times. What do precision and scale stand for?

J0e3gan 8, 9 9 gold badges 50 50 silver badges 77 77 bronze badges. Add a comment. Oracle guarantees the portability of numbers with precision ranging from 1 to Scale is the number of digits to the right positive or left negative of the decimal point. The scale can range from to In your case, ID with precision 6 means it won't accept a number with 7 or more significant digits. Precision is the total number of digits, can be between 1 and Scale is the number of digits after the decimal point, may also be set as negative for rounding.

EX: If value is



0コメント

  • 1000 / 1000