Calculate in Processing

edited November 2013 in How To...

Hi! I work with Processing sinds 2 months for a school project. Now I have a calculation problem. This is the code:

output.println (round((abs((lul)-(lengthCompareLine[i])))*100/(lengthCompareLine[i])));

lengthCompareLine is an array with random length of lines, and lul is a user line which can be adjusted by the user. Now I want to compare these 2 lines to get a % value of the difference. Unfortunatly the code seems to work properly if the user line (lul) is shorter, but not if its longer. Than it gives out values of f.ex. 320 %, which cant be right. Can I calculate the difference of the lines independent from which line is longer.

Thanks for your help! numan21

Tagged:

Answers

Sign In or Register to comment.