Four is magic: Difference between revisions

Content added Content deleted
Line 2,194: Line 2,194:


# check for easy case first - exclude exact powers of 10
# check for easy case first - exclude exact powers of 10
# as we'll need to stick a "one" in front of those.
# above 10 as we'll need to stick a "one" in front of those.
if [[ $n != *00 && -n ${names[$n]} ]]; then
if [[ $n != *00 && -n ${names[$n]} ]]; then
printf '%s%s\n' "${names[$n]}" ${suffix:+" $suffix"}
printf '%s%s\n' "${names[$n]}" ${suffix:+" $suffix"}
Line 2,200: Line 2,200:
fi
fi


# find the largest power of 10 that n is smaller than n
# find the largest power of 10 that is smaller than n
local -i i=0
local -i i=0
local -i p=${powers_of_10[i]}
local -i p=${powers_of_10[i]}