4
In the table that I am creating, I will have a column that will indicate the discount percentage, for example, "for a given agreement I will have 20% discount, for another agreement I will have 50% discount", and I will need to use it in calculations for final cost, would you like to know what kind of field should I use to save that percentage? I thought I’d use decimal
but I was in doubt.
Is the real type equal to the double type? What kind of problems occur?
– Andrew Alex
@Andrewalex Almost, the
real
has "less precision" but has the same kind of problem. For scientific calculations it works well but for monetary calculations it does not. See more on the subject at http://answall.com/a/38140/101. See the numerical types of Postgresql: http://www.postgresql.org/docs/9.4/static/datatype-numeric.html– Maniero