ads = ads.Where(x => (x.Amount - x.Price) / (x.Amount / 100) >= filter.Persent);
if x.Amount == 0 I have error "Divide by zero error encountered."
like me in this request is to avoid?
update:
this helped, but I do not like the decision:
ads = ads.Where(x => (x.Amount - x.Price) / ((x.Amount / 100)==0?0.1:(x.Amount / 100)) >= filter.Persent);
there is another way?
Of course, you can always implement a generic safe division method and use it all the way
I have chosen decimal type because it addresses all non nullable numeric types that I am aware of.
Usage: