visualdatatools.com Forum Index visualdatatools.com
Discussion for DataTank and DataGraph
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

round function

 
Post new topic   Reply to topic    visualdatatools.com Forum Index -> Getting Started
View previous topic :: View next topic  
Author Message
khickey



Joined: 13 Jul 2011
Posts: 20

PostPosted: Wed Mar 22, 2017 6:56 pm    Post subject: round function Reply with quote

Hey

How ds the round function work?
I want to round a number off to 6 decimal places. I tried;
round(x,6)
but I got an error saying the argument was incorrect

thanks
Ken
Back to top
View user's profile Send private message
David
Site Admin


Joined: 25 Nov 2006
Posts: 1938
Location: Chapel Hill, NC

PostPosted: Fri Mar 24, 2017 10:38 pm    Post subject: Reply with quote

round takes only a single argument and rounds to the nearest integer. So what you would have to do is

round(x*10^6)/10^6

It is an interesting idea though to allow round() to take two arguments. I will look into adding that function. It looks like a number of languages (Excel as well as Python) do this.

If you only want to display the value, the simplest way is to adjust the formatter when you display it.

David
Back to top
View user's profile Send private message Send e-mail
khickey



Joined: 13 Jul 2011
Posts: 20

PostPosted: Thu Mar 30, 2017 7:32 pm    Post subject: Reply with quote

Thanks David - that worked. It would be nice to have the extra argument though!

Cheers
Ken
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    visualdatatools.com Forum Index -> Getting Started All times are GMT - 3 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group