(extension version)
Signed Math Library 0.1.
(interface (signed positive $ $Y))
(interface (signed $Z))
(interface (signed $Z))
(interface (signed $Z))
(interface (signed $Z))
(signed positive [+ $N])
(number $N)
(signed negative [- $N])
(number $N)
(signed number $N)
(signed positive $N) (or) (signed negative $N)
(signed zero [+ 0])
(signed zero [- 0])
(signed $X = $X)
(signed $X = $Y)
(signed zero $X)
(signed zero $Y)
(signed $X > $Y)
(if) (signed positive $X) (then)
(if) (signed positive $Y) (then)
($X = [+ $XP])
($Y = [+ $YP])
($XP > $YP)
(elseif) (signed negative $Y) (then)
%% True
(else)
(par)
WARNING:
(line)
\( $X > $Y \) :
(line)
$Y not a signed number.
(par)
($Z = [])
(endif)
(elseif) (signed negative $X) (then)
(if) (signed positive $Y) (then)
(fail)
(elseif) (signed negative $Y) (then)
($X = [- $XN])
($Y = [- $YN])
($YN > $XN)
(else)
(par)
WARNING:
(line)
\( $X > $Y \) :
(line)
$Y not a signed number.
(par)
($Z = [])
(endif)
(else)
(par)
WARNING:
(line)
\( $X > $Y \) :
(line)
$X not a signed number.
(par)
($Z = [])
(endif)
(signed $X < $Y)
~(signed $X = $Y)
~(signed $X > $Y)
(signed negate [+ $N] into [- $N])
(signed negate [- $N] into [+ $N])
(signed $X plus $Y into $Z)
(if) (signed positive $X) (then)
($X = [+ $XP])
(if) (signed positive $Y) (then)
($Y = [+ $YP])
($XP plus $YP into $ZP)
($Z = [+ $ZP])
(elseif) (signed negative $Y) (then)
($Y = [- $YN])
(if) ($XP > $YN) (then)
($XP minus $YN into $ZP)
($Z = [+ $ZP])
(else)
($YN minus $XP into $ZN)
($Z = [- $ZN])
(endif)
(else)
(par)
WARNING:
(line)
\( signed $X plus $Y into \$ Z \) :
(line)
$Y not a signed number.
(par)
($Z = [])
(endif)
(elseif) (signed negative $X) (then)
($X = [- $XN])
(if) (signed positive $Y) (then)
($Y = [+ $YP])
(if) ($XN > $YP) (then)
($XN minus $YP into $ZN)
($Z = [- $ZN])
(else)
($YP minus $XN into $ZP)
($Z = [+ $ZP])
(endif)
(elseif) (signed negative $Y) (then)
($Y = [- $YN])
($XN plus $YN into $ZN)
($Z = [- $ZN])
(else)
(par)
WARNING:
(line)
\( signed $X plus $Y into \$ Z \) :
(line)
$Y not a signed number.
(par)
($Z = [])
(endif)
(else)
(par)
WARNING:
(line)
\( signed $X plus $Y into \$ Z \) :
(line)
$X not a signed number.
(par)
($Z = [])
(endif)
(signed $X minus $Y into $Z)
(signed negate $Y into $NY)
(signed $X plus $NY into $Z)
(signed [+ $X] times [+ $Y] into [+ $Z])
($X times $Y into $Z)
(signed [+ $X] times [- $Y] into [- $Z])
($X times $Y into $Z)
(signed [- $X] times [- $Y] into [+ $Z])
($X times $Y into $Z)
(signed [- $X] times [+ $Y] into [- $Z])
($X times $Y into $Z)
(signed [+ $X] divided by [+ $Y] into [+ $Z])
($X divided by $Y into $Z)
(signed [+ $X] divided by [- $Y] into [- $Z])
($X divided by $Y into $Z)
(signed [- $X] divided by [- $Y] into [+ $Z])
($X divided by $Y into $Z)
(signed [- $X] divided by [+ $Y] into [- $Z])
($X divided by $Y into $Z)