Best or closest match operator

Hi. Does NSB have a function or operater that will for example: 3 values stored, one in A, one in B and one in C.
B is a fixed value and I want to find the best or closeset match to B from either values in A or C.

Thanks
Will.

Would depend on what values you are storing? Probably just write a function to take care of ti? Really depends on what your are storing in A, B and C I think

Hi John, thanks for getting back to me. I’m just storing numbers up to three decimal places.

So you are just looking for the closest number between A or C to meet the value stored in B?

Yes. I know i could just subtract A and C from B and just use the one with the smalest value but I was just wondering if there was a nicer way to do this where I wouldn’t have to worry about the signs of the values (+ or -)

https://wiki.nsbasic.com/Abs

Absolute will help you out. Abs(-10) will return 10. Abs(10) will also return 10.