Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
The 10 multiple immediately higher than a number
Message
From
17/12/2010 10:52:27
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01492886
Message ID:
01493108
Views:
71
>>>>>>How to find the 10 multiple immediately higher then a number.
>>>>>>
>>>>>>e.g.
>>>>>>
>>>>>>2 ---------- 10
>>>>>>15----------20
>>>>>>17----------20
>>>>>>21----------30
>>>>>>41----------50
>>>>>>
>>>>>>Seems simple but I cannot imagine a function to do it.
>>>>>
>>>>>Just for variety (and assuming no negative values):
x -MOD(x,10)+10
Works with values other than 10 as well :-}
>>>>
>>>>Another option, that does work with negative numbers, is:
>>>>
>>>>ceiling(x/10)*10
>>>>
>>>
>>>Hilmar, I tried your method with x = 80 and it returned 80 instead of the correct answer 90 ?
>>
>>Pete,
>>
>>are you having a bad day, or what's the logic? I thought the idea was to round up to the next whole 10, but rounding a whole 10 up to the next whole 10 does not sound reasonable to me.
>
>The original request:
>How to find the 10 multiple immediately *higher* then a number.

Ahhh! Sorry, I overlooked that. Unusual requirement, though.
Previous
Reply
Map
View

Click here to load this message in the networking platform