Numeric Data Type Rounding Up

From: Carlos Mennens <carlos(dot)mennens(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Numeric Data Type Rounding Up
Date: 2012-03-07 16:50:32
Message-ID: CAAQLLO77urJNRwbP6hyMgyYiFazRqjuoXT6wSUjA3+wTvQ__rQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I have a table called weight and this table is tracking weight for a
few people in a fitness program that just started. I created the table
as described below:

fitness=# \d weight
Table "public.weight"
Column | Type | Modifiers
--------+-----------------------+-----------------------------------------------------
id | integer | not null default
nextval('weight_id_seq'::regclass)
lbs | numeric(5,0) | not null
date | date | not null
dow | character varying(9) | not null
name | character varying(50) | not null
Indexes:
"weight_pkey" PRIMARY KEY, btree (id)

Now when I enter a value in the 'lbs' field / column of '172.80', it
rounds the value up to '173.00'. I looked on the documentation and
found a numeric data type called 'real'. I tried changing the data
type from 'NUMERIC' to 'REAL' but it didn't work. I honestly don't
know if that is even the correct numeric data type I want / need to
show exact values on something like tracking weight figures. Can
someone tell me if I'm way off here?

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2012-03-07 17:14:22 Re: Numeric Data Type Rounding Up
Previous Message DrYSG 2012-03-07 15:09:38 Re: Slow duplicate deletes