range = (long)(high-low)+1; high = low + (unsigned)((range * cum)/total_freq-1); low = low + (unsigned)((range * prev_cum)/total_freq);