how to find the closest positve number from a variable?

  • Thread starter Thread starter Frankdot
  • Start date Start date
F

Frankdot

Guest
Hello,

I have this code i would like to modify. It return the closest number from my variable fibo1.

But it return any number positive or not.

I would like to know if any one could tell me how to modify it to get the closest positive number.

Thank you



double minDistance = list.Min(no => Math.Abs(fibo1- no));

double closest = list.First(no => Math.Abs(fibo1- no) == minDistance);

Continue reading...
 
Back
Top