Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

types bettween mysql and java

 
Jorge Pinho
Greenhorn
Posts: 25
MySQL Database PHP Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

I�m using a field in mysql that has a DECIMAL data type, the mysql docs tell that this is the best for currency, so, I would like to know if it�s better to use float or double in java.

any help ?

thankx
Jorge
 
Paul Wright
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure it really matters. I would imagine that the Java double would cover the MySQL decimal( in decimal places) whereas float would be more extensive if you get my drift.
Like float goes to alot more decimal places than double and probably more than the MySQL decimal format.
Plus double is a smaller value. I think its only 16 or 32 whereas float is 32 or 64. One of the two i cant remember which.

You can see my knowledge on the subject is quite extensive.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65338
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd check to see if BigDecimal suits your purposes.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic