Hi guys,
i need to round Room Area to a certain Scheme
0.00 to 0:15 = 0.1
0:16 to 0:65 = 0.5
0.66 to 0.99 = +1
I used String then extract the decimals but it sounds like i could do much better, any ideas?
Hi guys,
i need to round Room Area to a certain Scheme
0.00 to 0:15 = 0.1
0:16 to 0:65 = 0.5
0.66 to 0.99 = +1
I used String then extract the decimals but it sounds like i could do much better, any ideas?
looks good except that my input is a list of list and i like to keep the structure
Am i asking too much
input = IN[0]
result = []
for x in input:
numbers = []
for y in x:
numbers.append(int(y))
result.append(numbers)
OUT = result
Try using the Math.Round node to reduce the decimal places to say 5 digits, then try again.
It is because you cannot divide by zero
No it 0 but i didn’t think it would matter… turns out i was wrong lol
The Modulo operator could save you some nodes and unneeded python jumps here:
EndFragment:00000846 FullNumb =
val-val%1;
Remainders =
val%1;
Remainders <= 0.15?
FullNumb:
Remainders <= 0.65?
FullNumb+0.5:
FullNumb+1;
Note that I didn’t bother with the exception handling for ‘range cannot be specified’ here.
You could call the full number function and remainder test in line with the if statement if you were so inclined.
Very nice @jacob.small
Ok… this is damn sweet
Thanks a million guys
Glad I could help.