The sort is done according to numerical ordering and duplicates are retained as opposed to sort/2 which uses the standard ordering of terms and removes duplicates. See number_sort/4 for a discussion of the differences between numerical and standard ordering of numeric types.
Note number_sort(L1,L2) is equivalent to number_sort(0,=<,L1,L2).
Success: sort([3,1,6,7,2],S). (gives S=[1,2,3,6,7]). sort([1,3,2,3,4,1],S). (gives S=[1,1,2,3,3,4]). Fail: sort([2,1,3,4],[2,1,3,4]).