Skip to content

Commit

Permalink
avoid sort -g
Browse files Browse the repository at this point in the history
scale the score so we can work with ints
  • Loading branch information
rupa committed Feb 15, 2020
1 parent 4f08e7f commit f1f113d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions z.sh
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ _z() {
function frecent(rank, time) {
# relate frequency and time
dx = t - time
return rank * (3.75/((0.0001 * dx + 1) + 0.25))
return int(10000 * rank * (3.75/((0.0001 * dx + 1) + 0.25)))
}
function output(matches, best_match, common) {
# list or return the desired directory
if( list ) {
cmd = "sort -g >&2"
cmd = "sort -n >&2"
for( x in matches ) {
if( matches[x] ) {
printf "%-10s %s\n", matches[x], x | cmd
Expand Down

0 comments on commit f1f113d

Please sign in to comment.