Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2007

Tip: Looking for answers? Try searching our database.

Rounding Issue

Thread view: 
srinivas.veeranki@gmail.com - 30 Oct 2007 06:01 GMT
Hi All,

 I am sending BigDecimal Value(Ex : 2.6000000000000000) to the
Databe. I am using the Sybase as Data Base. In the Data Base , the
corresponding column is declared as Number(18, 16). If I sent above
value from my prog. it storing as 2.6000000000000001 in the Databse.
Can u plz suggest the solution to store the same value in the databse.
What the max size allowed after the decimal point. As per the IEEE
standards , For Double precision it is 23 bits.

Thanks & Regards,

Srinivas.
GArlington - 30 Oct 2007 12:08 GMT
On 30 Oct, 05:01, srinivas.veera...@gmail.com wrote:
> Hi All,
>
[quoted text clipped - 9 lines]
>
> Srinivas.

It looks like your Number in DB is stored as binary representation ->
your rounding error, try Decimal(18, 16), if it does NOT help, you
might have to store your number as Integer and scale it down.
Lew - 30 Oct 2007 14:23 GMT
srinivas.veera...@gmail.com wrote:
>>   I am sending BigDecimal Value(Ex : 2.6000000000000000) to the
>> Databe. I am using the Sybase as Data Base. In the Data Base , the
[quoted text clipped - 3 lines]
>> What the max size allowed after the decimal point. As per the IEEE
>> standards , For Double precision it is 23 bits.

There is no (theoretical) maximum for java.math.BigDecimal

> It looks like your Number in DB is stored as binary representation ->
> your rounding error, try Decimal(18, 16), if it does NOT help, you
> might have to store your number as Integer and scale it down.

Signature

Lew

Roedy Green - 30 Oct 2007 19:50 GMT
>  I am sending BigDecimal Value(Ex : 2.6000000000000000) to the
>Databe. I am using the Sybase as Data Base.

You will have to read the Sybase docs to figure out if they have
something corresponding to big decimal, or perhaps a character
numeric, then declare your database that type.  

I find it odd that after all these years the datatypes, their names
and  behaviour are not defined in iron for SQL.

Then see if JDBC has something that won't wreck it in transmission. In
a pinch, use char or a byte blob.
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.