# :precision =\>?

**URL:** <https://www.ruby-forum.com/t/precision/117665>\
**Category:** Rails\
**Created:** [October 19, 2007, 1:24am UTC](https://www.ruby-forum.com/t/precision/117665 "2007-10-19T01:24:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nuby2ruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/54ee81/32.png) [@nuby2ruby](https://www.ruby-forum.com/u/nuby2ruby)\
**Post date:** [October 19, 2007, 1:24am UTC](https://www.ruby-forum.com/t/precision/117665/1 "2007-10-19T01:24:27Z")

</div>

When putting a decimal into your DB, what does the precision mean and  
what does scale mean?

~Jeremy

---

<div class="post-metadata">

**Author:** ![nuby2ruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/54ee81/32.png) [@nuby2ruby](https://www.ruby-forum.com/u/nuby2ruby)\
**Post date:** [October 19, 2007, 1:43am UTC](https://www.ruby-forum.com/t/precision/117665/2 "2007-10-19T01:43:14Z")

</div>

Jeremy W. wrote:

> When putting a decimal into your DB, what does the precision mean and  
> what does scale mean?
> 
> ~Jeremy

ok, I got it. so precision is the total amount of digits to the left and  
right of the decimal that the number can contain, and the scale is the  
amount of digits to the right that the number can contain.

~Jeremy

---

<div class="post-metadata">

**Author:** ![nuby2ruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/54ee81/32.png) [@nuby2ruby](https://www.ruby-forum.com/u/nuby2ruby)\
**Post date:** [October 19, 2007, 1:45am UTC](https://www.ruby-forum.com/t/precision/117665/3 "2007-10-19T01:45:19Z")

</div>

> When putting a decimal into your DB, what does the precision mean and  
> what does scale mean?

> **[8.1. Numeric Types](https://www.postgresql.org/docs/8.2/datatype-numeric.html)**
>
> 8.1. Numeric Types 8.1.1. Integer Types 8.1.2. Arbitrary Precision Numbers 8.1.3. Floating-Point Types 8.1.4. Serial Types Numeric types consist of two-, …

section 8.1.2…

The scale of a numeric is the count of decimal digits in the fractional  
part, to the right of the decimal point. The precision of a numeric is  
the  
total count of significant digits in the whole number, that is, the  
number  
of digits to both sides of the decimal point. So the number 23.5141 has  
a  
precision of 6 and a scale of 4. Integers can be considered to have a  
scale of zero.

It’s the same for other databases as well…
