15 lines
396 B
Plaintext
15 lines
396 B
Plaintext
|
#!/bin/sh
|
||
|
|
||
|
# science speak from wikipedia
|
||
|
! eq $# 2 && printf "Usage: $0 [minuend] [subtrahend]\n" >/dev/stderr && exit 1
|
||
|
|
||
|
! stris int "$1" && printf "$0: $1: Not an integer\n" >/dev/stderr && exit 1
|
||
|
! stris int "$2" && printf "$0: $2: Not an integer\n" >/dev/stderr && exit 1
|
||
|
|
||
|
minuend=$1
|
||
|
subtrahend=$2
|
||
|
|
||
|
# (- a b) == (+ a (* b -1))
|
||
|
printf "%b\n" $(add $minuend $(multiply $subtrahend -1))
|
||
|
exit 0
|