no decimals – how to …
When Im for example are using the cv.jit.track object and are opening the helpfile an example comes up. the tracking number is very long and exact. how do I make this number not that exakt, without all the decimals?
for example a number can be very long like:
103.942093 98.861748 1.
what if I want to make this to only display the first two numbers like:
and skip the last part after the dot .
been searching the forum and in the tutorial but cant find any answer to this
Round up to the nearest 1 with the [round ] object, or truncate to an integer using the [i ] object.
now I get:
103. 94. 1.
how do I get rid of the last 1.
103.942093 98.861748 [1.]
or after using round
103. 94. [1.]
I’m assuming that these values are in a list? If so, just put them through [zl slice 2].
If you want a bit more precision: multiply the long decimal by 100. (WITH the dot so it’s a float calculation), use [round], then multiply by 0.01 to get back to the original range. This way you keep the next two digits, if you care…
Also, any list can be put through a message box which simply says $1 $2. this will keep only the first two elements. you have up to $9 only though, so if you need more, look to the almighty [zl].
Isn’t that the same as doing [round 0.01]?
one last question. how do I do if i want to change the span?
If Im by using the round object is getting the result:
the highest result that is possible to get here is:
so the span is between:
what if I want to make the span instead between
simply. How do I change tha span?
I couldnt find this in the tutorials. are there any site you can recommend that is going through these recalculations?
thanks once again?
Try the scale object. It’s all in the tutorials somewhere I think.
Although I recommend doing the scaling in floating point, and then rounding to int after you have the desired output range.
-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 502.3oc2VFsaCBBEF9Z8ofv0aM.ZU6tXOF6lklEpxZYQgFEy5Vyd2GfXmast Y2ZLs6FH9Cx4mO4bjs9dvExMrJH3Fv8.Ous9ddVIifm6YOXAcSZNsxNMXprn fITvqZFSw1nr5ExRFfllVWRULvssiKpKj0pblx91Hm5iRgph+JyngISZkWSU oq3hkOTxRUMlhLUOJ.GfrcXroinaAy+H.bQ65ich7LqmjKd5ZbDrSPEzBaPg 2wJynBJzLza99llqFHAdLWpC5g2fDmZij5k0rlsg4knZnAfKnhkvctuOPTxp zPlp3RQGXDDG0r+CMcHWytE6P3aFpC+lhNd7gN03SvdVuv6c9oJkly.XP.Ao awn3CCXbe.9mYZ+zA4NcM66wSz93Y1HQmRYsHCfO4LomyYI3FfbrmyhaNlE+ 8bjrOGS9+jjRl1TjhfFJ7vg+wjz3KQ5sOGhm1Ia7WfgnK7jw9OYf9s4Ugia0 6Ilx2SL85B3SFO.E6RfhN5B3AWfoN53wKzwPqFXqx7S3gbTYTZo1kGuaw6fL xPQlMLvbt3q2vz5Ti9m4XkrtLsEIt+tB9vrYrJEWXK21YNlKnzYRq3YYLQ26 ZVvyVK4BkyCf4G7i5PsTx.rzrQ0QjA3njQ0QgCvQwipiBFfihN69pEb1wnv+ fizO7l+6Z8SU5A -----------end_max5_patcher-----------
Forums > MaxMSP