Jump to content
Server Maintenance This Week. ×

Split a number but the result should be always


This topic is 1661 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Is there a way to do this? The difference should be as close as possible. I use even number because the number are by pairs. 2 4 6 8 10

Example

18 =  10 and 8

20 =  10 and 10

22 = 12 and 10

36 = 18 and 14

 

 

 

Link to comment
Share on other sites

14 minutes ago, comment said:

I am afraid I don't follow your logic. You split 20 into 10 and 10; they're equal and even. Why can't you split 36 into 18 and 18? They are also equal and even. OTOH, 18 + 14 = 32, not 36 - so this makes no sense to me at all.

 

Sorry the 20 = 10 + 10 is wrong it should be 12 + 8. Basically we have to split it 60% / 40% something like that. the difference should be as close as 1 to 2 pairs.

Edited by chadski021
Link to comment
Share on other sites

29 minutes ago, chadski021 said:

something like that

I am afraid that's not a good enough description. You are asking how to do something, but we don't know exactly what that something is. Maybe you should start by explaining why this is needed.

 

ADDED:

Maybe something like this could work for you::

Let ( [
a = 2 * Ceiling ( number / 4 ) ;
b = 2 * Floor ( number / 4 ) 
] ;
If ( a = b ; List ( a + 2 ; b - 2 ) ; List ( a ; b ) )
)

This returns:

18 = 10 + 8;
20 = 12 + 8;
22 = 12 + 10;
36 = 20 + 16.

 

Edited by comment
Link to comment
Share on other sites

2 minutes ago, comment said:

I am afraid that's not a good enough description. You are asking how to do something, but we don't know exactly what that something is. Maybe you should start by explaining why this is needed.

 

Ok, I try my best to explain this. We have a database called shutter. Shutter is installed to window/door and has blades by pairs. ex 20 = 10 pairs. We have scenario that a sliding door has 2 panels. 50% 1 panel can slide and 50% 1 cannot slide. Basically we install the shutter always 50% by 50% if the middle window is open and lock reachable in the middle. But in this case 50% of slide cant be open, So i need to increase at 1 to 2 pairs of blade so its still able to lock it inside. attached is my sample idea

sample.png

Link to comment
Share on other sites

This topic is 1661 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.