Divide by 2 the input until it's below a given value (SOLVED)


#1

Hi everyone...
I'm trying to patch what the title says with no success.
I need to read an incoming integer value, and if it exceeds a constant divide it by two, and repeat until it's below that constant. Sound easy enough, but I can't get my head around it.
Any help appreciated.


#2

Are you trying to do this without writing code? It’s very easy to do in C/C++.

What would you want this for?


#3

yes, I'm trying to patch it, the reason being I don't know how to code... If it's not possible to do with standard objects I'd love some hint on how to write the code... I vaguely remember something like until or while loops from some BASH scripts I did, but it was a loooong ago.


#4

I have the sample length of a loop as an integer and I want sync a small delay by setting is length to the larger number (below the table length) that is an even fraction of the loop


#5

Probably indeed easier to do this in code, but just for kicks...

half till lower.axp (3.5 KB)

Note: this crucially relies on the order of the objects.


#6

Thanks Capt'n! I'll convert it to integers and I'm all set. Have a good day!


#7

That's great. As a C programmer (my job, for many years), this just hadn't occurred to me.

Can the order be protected by making this logic a subpatch?


#8

Well, that's why we're just users, while he is the Captain... :rofl: Cheers