Re: precision of numeric type
| От | Barry Lind |
|---|---|
| Тема | Re: precision of numeric type |
| Дата | |
| Msg-id | 3DBEBD04.7000503@xythos.com обсуждение исходный текст |
| Ответ на | precision of numeric type ("w.winter" <w.winter@logitags.com>) |
| Список | pgsql-jdbc |
Wolfgang, w.winter wrote: > Hi, > > on testing our auto-configuration persistence framework ACP against > PostgreSQL we found the following problem: > > I have a table with a column of type numeric(48,10). The PostgreSQL docs > say: "The type numeric can store numbers of practically unlimited size and > precision, while being able to store all numbers and carry out all > calculations exactly." This is true. > > I store the Double value 1212121234.5634349876 with a > PreparedStatement.setDouble() > But the problem is that java Double isn't able to perform calculations exactly. If you want exact precision you should be using the BigDecimal datatype (and getBigDecimal/setBigDecimal). BigDecimal is the logical java data type that corresponds to the numeric type in postgres. thanks, --Barry
В списке pgsql-jdbc по дате отправления: