actionscript 3 - Find closest number in range? -
what best way find closes value in range...
for example have array 0, 90, 180, 270, 360.. , number 46...
what best way find 90 in array?
(in actipnscript 3)
how want define closest?
if mean least difference, loop through each value, compute absolute value of difference, keep note of smallest value seen.
if list sorted magnitude, stop when see difference that's greater smallest found, esle loop through entire set.
Comments
Post a Comment