08-25-2020 09:54 AM - edited 08-25-2020 09:54 AM
Here, just modify the problem line in your formula node to this...
if(x>=100 && x<=200)
and delete all this...
if(x==100)
y=90;
elseif(x==200)
y=89;
As Yamaeda pointed out, you want every possible x to fit into a single if statement. Call your y function f(x) for now. Since f(100) = 90 and f(200) = 89, you just don't need those four lines to begin with.
Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.
08-25-2020 02:40 PM
@Viper wrote:
@Yamaeda wrote:
Since you used a Double for X, i assumed you'd have values as 100.12. In that case, the case selectors option of 100..200 isn't really an option. 🙂 That only works for integers.
For your example I would multiply X by 100 then cast it to an I32. Then I would adjust my case selectors as well to account for the multiplication.
Norm
I have values for X with Double data type. Formula node is working now, I just need to remove the redundant if statements. Thanks for the help 🙂
08-26-2020 01:42 AM
@Viper wrote:
@Yamaeda wrote:
Since you used a Double for X, i assumed you'd have values as 100.12. In that case, the case selectors option of 100..200 isn't really an option. 🙂 That only works for integers.
For your example I would multiply X by 100 then cast it to an I32. Then I would adjust my case selectors as well to account for the multiplication.
Norm
My comment was for OP, but your solution is good if you want it to 'work for 2 decimals', yes. 🙂