// Bubble sort an array of floats

void bubble_sort( float x[], const int n ) {
	int pass = 0, k, switches;
	float temp;

	switches = 1;

	while( switches ) {
	    switches = 0;
	    pass++;
	    for( k = 0; k < n - pass; k++ ) {
		if( x[k] > x[k+1] ) {
		    temp = x[k];
		    x[k] = x[k+1];
		    x[k+1] = temp;
		    switches = 1;
		}
	    }
	}

	return;
}
