mirror of https://dicksdeathabove.xyz/~mia/psh-fractional synced 2024-11-09 16:54:18 +00:00

fix borrow()

This commit is contained in:
Mia T. Rain 2022-02-23 13:41:21 -05:00
parent aee9803e50
commit b6fb49a0b4
Signed by: Mia
GPG key ID: 5F40D66F94DECFE8

View file

@ -20,20 +20,24 @@ borrow(){
b="${1%$2}"; b="${b#${3%?}}"
[ "$b" -gt 0 ] && {
c1="$2";
o="${1%$b$2}"; #echo "++ ${o} $((b-1)) $((c1+90))/$c1"
[ "$b" -eq 10 ] && {
o="${1%$b$2}"; : $((b-=1)); o="${o}0${b}$c1" # eg 21 = 2090 10
: $((b-=1)); o="${o}0${b}$c1" # eg 21 = 2090 10
# tbh idk why this works; 2090 should acctually be 1 10 9 10
# which somehow becomes 209 10 ? I'm guessing a second borrow call is made
# and that somehow corrects it; but again idk; a second borrow call /is/ made
# but idk how it corrects it
} || {
o="${1%$b$2}"; : $((b-=1)); o="$o$b$c1"
: $((b-=1)); [ "$4" != ":" -a "$4" ] && {
o="$o$b$((c1+90))"
} || o="$o$b$c1"
}
: $((c1+=10))
echo "$o $c1"
} || { # otherwise use recusion
o="${1#${3%?}}"; o="${o%$2}"
borrow "$1" "$o" "${3%?}"
#echo "| $1 $o ${3%?}"
borrow "$1" "$o" "${3%?}" "${4}:"
}
}
[ -z "${1##*.*}" -o -z "${2##*.*}" ] && {