Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Glen Villar
  Where is Glen Villar?
 Palayan City
 Philippines
 Glen Villar
 To: barney guna
  Where is barney guna?
 BANALORE
 India
 barney guna
 Tags
Subject: RE: Rounding off to nearest 10
Thread ID: 394147 Message ID: 394149 # Views: 80 # Ratings: 3
Version: Visual FoxPro 6 Category: General VFP Topics
Date: Tuesday, December 31, 2013 1:16:20 AM         
   


> Dear all,
>
> Please help me with this one !
>
> I need to convert a figure (numeric) to the nearest 10, using round I suppose,
>
> For eg., I get an answer/total of 89,764 it should be converted to 89,770
>
> I have tried round(ggg,10) but it does not work...
>
> Thank you!
>
> Barney


Hi Barney,

Aside from what Stefan has given you, you could also do like,

a = 89764

Edit: This fails if a = 89760, the answer becomes 89770 (as pointed out by Vilhelm in his post)
? a + (10-MOD(a,10))

or

Edit: These do not but I believe Stefan and Vilhem's solution are better. 
:-)
? a + ABS(MOD(a,-10))

? a - MOD(a,-10)






My blog: http://thereportersassistant.blogspot.com

ENTIRE THREAD

Rounding off to nearest 10 Posted by barney guna @ 12/31/2013 12:17:13 AM
RE: Rounding off to nearest 10 Posted by Stefan Wuebbe @ 12/31/2013 1:01:45 AM
RE: Rounding off to nearest 10 Posted by barney guna @ 12/31/2013 3:05:47 AM
RE: Rounding off to nearest 10 Posted by barney guna @ 1/2/2014 8:13:00 AM
RE: Rounding off to nearest 10 Posted by Stefan Wuebbe @ 1/2/2014 8:25:14 AM
RE: Rounding off to nearest 10 Posted by David Mustakim @ 1/2/2014 8:25:52 AM
RE: Rounding off to nearest 10 Posted by Glen Villar @ 12/31/2013 1:16:20 AM
RE: Rounding off to nearest 10 Posted by barney guna @ 12/31/2013 3:13:10 AM
RE: Rounding off to nearest 10 Posted by Vilhelm-Ion Praisach @ 12/31/2013 12:12:34 PM
RE: Rounding off to nearest 10 Posted by barney guna @ 1/2/2014 8:13:34 AM
RE: Rounding off to nearest 10 Posted by barney guna @ 1/2/2014 8:13:20 AM
RE: Rounding off to nearest 10 Posted by Vilhelm-Ion Praisach @ 12/31/2013 4:24:16 AM
RE: Rounding off to nearest 10 Posted by Gene Wirchenko @ 12/31/2013 7:48:57 PM
RE: Rounding off to nearest 10 Posted by Vilhelm-Ion Praisach @ 12/31/2013 8:59:39 PM
RE: Rounding off to nearest 10 Posted by David Mustakim @ 12/31/2013 9:15:55 PM
RE: Rounding off to nearest 10 Posted by Vilhelm-Ion Praisach @ 12/31/2013 9:23:07 PM
RE: Rounding off to nearest 10 Posted by David Mustakim @ 12/31/2013 9:25:48 PM
RE: Rounding off to nearest 10 Posted by Anders Altberg @ 1/1/2014 3:35:51 PM
RE: Rounding off to nearest 10 Posted by Vilhelm-Ion Praisach @ 1/1/2014 4:31:45 PM
RE: Rounding off to nearest 10 Posted by barney guna @ 1/2/2014 8:14:11 AM
RE: Rounding off to nearest 10 Posted by Anders Altberg @ 1/4/2014 1:25:13 AM
RE: Rounding off to nearest 10 Posted by barney guna @ 1/2/2014 8:13:52 AM
RE: Rounding off to nearest 10 Posted by Gene Wirchenko @ 12/31/2013 10:59:47 PM
RE: Rounding off to nearest 10 Posted by barney guna @ 1/2/2014 8:12:46 AM
RE: Rounding off to nearest 10 Posted by David Mustakim @ 1/2/2014 9:45:35 AM
RE: Rounding off to nearest 10 Posted by Tore Bleken @ 1/2/2014 9:54:32 AM
RE: Rounding off to nearest 10 Posted by Luis Maria Guayan @ 1/6/2014 8:39:08 PM