You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Timothy Spear <ts...@tangiblesoftware.com> on 2001/12/05 21:54:13 UTC

RE: BigDecimal problem

FYI:
	I have not looked at the guts of the code. However, Java has serious
rounding problems with decimal numbers. The only class that seemed to treat
the decimal values correctly when transforming data types was the BigDecimal
class. This meant that when retrieving the data from the database in jdbc, I
had to use the getBigDecimal method on the result set; the getFloat or
getDouble would leave me with rounding issue.  Also, you should verify the
information in the database (I sometimes would blame the retrieval of the
data, when it was put in incorrectly -- again because of the rounding
problem).

Tim

-----Original Message-----
From: Maciej Leks [mailto:mleks@zeus.polsl.gliwice.pl]
Sent: Wednesday, December 05, 2001 3:17 PM
To: turbine-user@jakarta.apache.org
Subject: BigDeciaml problem


Hi

  In my database scheme I use DECIMAL field type, i.e.
...
<column name="price" required="true" size="8,2" type="DECIMAL">
...
It is wrapped as a BigDeciaml object by the Peer.And here is a problem
because when I put this object into the Velocity context a value
(String) represted by this object is wrongly formated, i.e
Let's consider situation:
      In the databese we have: 123.23
      But in the Velocity context: 123.2309278382728378237476
Up to now I have to transform the object by hand before I put this
into the context, but it's not good solution!!!

My question is:
Has anyone walk round this problem?

Thanx

--

 Leksiu (mleks@zeus.polsl.gliwice.pl)


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>