ROUND function produces too many decimal places

Moderator: NorbertKrupa

Post Reply
debfawn
Beginner
Beginner
Posts: 47
Joined: Tue Jan 29, 2013 2:30 pm

ROUND function produces too many decimal places

Post by debfawn » Thu Dec 12, 2013 6:55 pm

Hello,

Why does the ROUND function return so many decimal places when I round to 1 decimal place?

Example:

Code: Select all

dbadmin=> select round(48/67, 1);
        round
----------------------
 0.700000000000000000
(1 row)
I want the result to be 0.7

User avatar
JimKnicely
Site Admin
Site Admin
Posts: 1825
Joined: Sat Jan 21, 2012 4:58 am
Contact:

Re: ROUND function produces too many decimal places

Post by JimKnicely » Thu Dec 12, 2013 7:08 pm

Check out the post:

http://www.vertica-forums.com/viewtopic.php?f=63&t=903

Code: Select all

dbadmin=> select round(48/67, 1.0);
 round
-------
   0.7
(1 row)
Jim Knicely

Image

Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.

debfawn
Beginner
Beginner
Posts: 47
Joined: Tue Jan 29, 2013 2:30 pm

Re: ROUND function produces too many decimal places

Post by debfawn » Tue Dec 17, 2013 4:46 pm

Thanks, Jim. Sorry, I should have searched the site before posting :oops:

Post Reply

Return to “Vertica SQL”