.NET Fiddle

CSharp · Console

/Program.cs

using System;
using System.Collections.Generic;
					
public class Program
{
	public static void Main()
	{
		var list = new List<double>();
		list.Add(0.32);
		list.Add(0.0);
		list.Add(-0.78);
		list.Add(-0.1);
		list.Add(0.25);
		list.Add(1.0);
		list.Add(0.84);
		list.Add(-1.0);
		list.Add(0.1);
		
		list.Sort((x,y) => Compare(x, y));
		foreach (var x in list)
			Console.WriteLine(x);
	}
	
	public static int Compare(double x, double y)
	{
		if (x >= 0.0 == y>=0.0)
			// same sign, compare by absolute value
			return Math.Abs(x).CompareTo(Math.Abs(y));
		
		if (x < 0.0)
			return 1;
		
		return -1;
	}

}
;