# DeleteCases with a case as float?

Might the DeleteCases have issues in matching when the list is of floats (machine precision numbers)? E.g. in this code it might fail to match correctly because float==float is not a good operation:

ClearAll[a];
a = RandomReal[{0, 1}, 5]
DeleteCases[a, Max[a]]


How would you handle this type of situations? What is the robust way?

• In the posted example it will not fail because Max[a] is a member of a so it must match. Mar 29 '20 at 22:49
• But might there be rounding issues somewhere in the Max that would cause the matching to fail? Mar 29 '20 at 23:12
• No issues in this example. But if there were, the robust method is to allow some appropriate epsilon plus/minus. Mar 30 '20 at 14:28

Drop[a, Ordering[a, -1]]