Why is this list returned unchanged by Sort?
Sort[{0,-Pi/2}]
{0,-Pi/2}
While this list is returned reversed?
Sort[{0,-1}]
{-1,0}
Mathematica 11.0.0.0 MacOS
Why is this list returned unchanged by Sort?
Sort[{0,-Pi/2}]
{0,-Pi/2}
While this list is returned reversed?
Sort[{0,-1}]
{-1,0}
Mathematica 11.0.0.0 MacOS
The Wolfram Documentation says:
Sortby default orders integers, rational, and approximate real numbers by their numerical values.
It also says:
Sortusually orders expressions by putting shorter ones first, and then comparing parts in a depth‐first manner.
The phrase -Pi/2 is an expression, so this second definition is applying. i.e. if we convert each expression to 'atomic'/numerical values first...
Sort[{0 // N, -Pi/2 // N}]
> {-1.5708, 0.}
... then it behaves as expected. You can force it to sort by numerical value by explicitly specifying the method used to compare entries for Sorting:
Sort[{0, -Pi/2}, Less]
> {-Pi/2, 0}