Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

2 decimal points VS 1  RSS feed

 
Ronald Whalen
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Ran into a problem. I am using mySQL as DB. In one table I have 2 different decimals defined in the following way in the schema:
VAR1 DECIMAL(3,1)
VAR2 DECIMAL(5,2)
they are both stored correctly in the DB. Upon retrieval they are both pulled into float primitive vars. The VAR1 appears correctly ( if stored as 8.0 the primitive float value = 8.0) however, the VAR2 appears incorrectly (if stored as 8.00 it appears as 800.0. The code to pull them out of the resultset is identical, naturally different float primitive vars.)
Any help or comments would be appreciated.

thanks,

Ronald Whalen
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!