I can't think of the Maths

Doh! I can’t think of the maths to figure out how to do this in vvvv.

First number range is:
0-15 (including 0 and 15)

…and then all the other number ranges after this ie:
Second: 16-31
Third: 32-47
Fourth: 48-63
Fifth: 64-79
etc forever…

So what I want to do is input a number and then have returned what number range this belongs to.

So if I enter 18 it will return 2 (ie the Second range 16-31)
If I enter 75 it will return 5 (ie the Fifth range 64-79)
If I enter 49 it will return 4 (ie the Fourth range 48-63)

And so on…

Any ideas? I’m sure it’s simple I just can’t figure it out!

My first thought is a Frac (Value) connected to an Equals (Value) and using the epsilon to define the range of your values.

Does this make sense? There may be a much better way to patch it, good luck!

Hmmmm, could you show me it in a quick patch?

wait sorry I didn’t really pay attention but can’t you solve this by just dividing by 16?

idividethingsby16thenadd1.v4p (2.7 kB)

This works

WhatRangeDoesANumberLieIn.v4p (3.3 kB)

Yeah, that’s simpler :) Thanks!

what about…

integ16.v4p (3.0 kB)

tzzz… :)

https://vvvv.org/sites/default/files/imagecache/large/images/Division%20(Math%20Tutorial)_2011.05.10-01.15.29.png

Division (Math Tutorial).v4p (6.8 kB)

Oh dear feel like I’m at school again :) Thanks!

You can also use dynamic plugins. It’s really fast to do math and logic calculations with it.

but as kalle said, this is really just a division and a frac…

using Answer = roundup(input + 1)/16)
Cheers

Using Answer = Roundup ((input+1)/16)

Using Answer = Roundup((input+1)/16)

I guess… no text …

May be like this, i’ve tested, it’s ok …cheers (4.0 kB)

try this… no text …

DividedRange.v4p (15.4 kB)