Hi There!
Hoping someone can help with a strange problem I'm seeing. Hopefully something simple!
I'm using the floor function to thin a multislider value. It can be reproduced easily -
If I have a multislider that I would like to output values between 0-100 I use the following line in a script that is triggered by a change to the slider value (x):
test=floor(x*100);
Setting up 2 monitors - 1 for the slider value multiplied by 100 and another to monitor the test variable. The slider value will get to 100 but the test variable will never go higher than 99
Does anybody know why this is? It seems to be rounding 100.000 down to 99 which does doesnt make sense or am I missing something?
Thanks
R
Strange floor() problem-Please Help!
Re: Strange floor() problem-Please Help!
OK this is strange!!
I increased the precision of the multislider monitor from 3 to 9 and realised the issue is that the slider was not getting all the way to value 1
I then messed around with the sizing of the slider and now its working? Gets to value 1 and the floor function is returning the correct value.
The wierd thing is, I had the problem in the project I'm working on so I loaded a blank project and reproduced the error at which point I created this topic.
I've now just gone back to my project and confirmed that the slider is not reaching 1. I messed around with the size and hey presto - its working as it should now!
I increased the precision of the multislider monitor from 3 to 9 and realised the issue is that the slider was not getting all the way to value 1
I then messed around with the sizing of the slider and now its working? Gets to value 1 and the floor function is returning the correct value.
The wierd thing is, I had the problem in the project I'm working on so I loaded a blank project and reproduced the error at which point I created this topic.
I've now just gone back to my project and confirmed that the slider is not reaching 1. I messed around with the size and hey presto - its working as it should now!
Re: Strange floor() problem-Please Help!
It has to do with pixel resolution and detection and stuff.. Also rounding vs flooring ....
Try using round instead of floor.....
MM
Try using round instead of floor.....
MM
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
Re: Strange floor() problem-Please Help!
Round should work, but the truth is, a Multislider also should be able to reach x = 1. Which it doesnt on an iPad 2 here.
- Attachments
-
- image.jpg (23.4 KiB) Viewed 989 times