Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Offline Destory  
#1 Posted : 23 May 2017 21:40:33(UTC)
Destory

Rank: Newbie

Groups: Registered
Joined: 23/05/2017(UTC)
Posts: 1
United States
Location: Texas

Thanks for all the work you have put into this software!

I was wondering if you could make a function to round the value up. So round 2.2 up to 3. Or a function to round down or round to nearest 5... etc. Would be helpful when I am calculating the required number of items required and get 2.2 back, I need it to be 3 when I cannot have a partial item.

Thanks!
Offline Jean Giraud  
#2 Posted : 23 May 2017 22:36:03(UTC)
Jean Giraud


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 1,885
Canada

Was thanked: 476 time(s) in 366 post(s)
Originally Posted by: Destory Go to Quoted Post
I was wondering if you could make a function to round the value up. So round 2.2 up to 3. Or a function to round down or round to nearest 5... etc. Would be helpful when I am calculating the required number of items required and get 2.2 back, I need it to be 3 when I cannot have a partial item.

Thanks!


How can maths invent that 2.2 could be/should be 5 ?
From the fx menu, scroll down to Ceil and plug your 2.2 in ... = 3
You could probably square the circle for 2.2 => 5
Offline csb531  
#3 Posted : 24 May 2017 00:10:52(UTC)
csb531


Rank: Member

Groups: Registered
Joined: 10/10/2012(UTC)
Posts: 21
Netherlands

Hello Destory,

Apart from the Ceil function, you can write your own function for this, i have made an example for you:
example

you can edit the function (extra if loop) if you want it to handle negative numbers differently.
ceil_and_roundup_to_5.sm (8kb) downloaded 19 time(s).

I hope this helps you.

regards,
csb

Edited by user 24 May 2017 00:14:45(UTC)  | Reason: sorry can't upload image?

Offline csb531  
#4 Posted : 24 May 2017 00:18:43(UTC)
csb531


Rank: Member

Groups: Registered
Joined: 10/10/2012(UTC)
Posts: 21
Netherlands

The image:
roundupto5.JPG

Offline Jean Giraud  
#5 Posted : 26 May 2017 04:43:25(UTC)
Jean Giraud


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 1,885
Canada

Was thanked: 476 time(s) in 366 post(s)
Here is the working program for n=5
A bit confusing for n ≠ 5

Jean

Utilities Matrix roundup_n.sm (11kb) downloaded 20 time(s).
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.