Skip to content

Commit

Permalink
Add a parentheses in SMOD definition
Browse files Browse the repository at this point in the history
This solves #190.  The other way of putting parentheses
did not make sense becasue `sign(x) * |x|` can immediately
be optimized into `x`.

Also, I checked one EVM implementation's behavior
```
evm --debug --code "60601960401907"
```
and saw SMOD returning a negative-looking number.
  • Loading branch information
pirapira committed Oct 5, 2016
1 parent fee354c commit b4d2261
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Paper.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1638,7 +1638,7 @@ \subsection{Instruction Set}
&&&& $\boldsymbol{\mu}'_\mathbf{s}[0] \equiv \begin{cases}0 & \text{if} \quad \boldsymbol{\mu}_\mathbf{s}[1] = 0\\ \boldsymbol{\mu}_\mathbf{s}[0] \bmod \boldsymbol{\mu}_\mathbf{s}[1] & \text{otherwise}\end{cases}$ \\
\midrule
0x07 & {\small SMOD} & 2 & 1 & Signed modulo remainder operation. \\
&&&& $\boldsymbol{\mu}'_\mathbf{s}[0] \equiv \begin{cases}0 & \text{if} \quad \boldsymbol{\mu}_\mathbf{s}[1] = 0\\ \mathbf{sgn} (\boldsymbol{\mu}_\mathbf{s}[0]) |\boldsymbol{\mu}_\mathbf{s}[0]| \bmod |\boldsymbol{\mu}_\mathbf{s}[1]| & \text{otherwise}\end{cases}$ \\
&&&& $\boldsymbol{\mu}'_\mathbf{s}[0] \equiv \begin{cases}0 & \text{if} \quad \boldsymbol{\mu}_\mathbf{s}[1] = 0\\ \mathbf{sgn} (\boldsymbol{\mu}_\mathbf{s}[0]) (|\boldsymbol{\mu}_\mathbf{s}[0]| \bmod |\boldsymbol{\mu}_\mathbf{s}[1]|) & \text{otherwise}\end{cases}$ \\
&&&& Where all values are treated as two's complement signed 256-bit integers. \\
\midrule
0x08 & {\small ADDMOD} & 3 & 1 & Modulo addition operation. \\
Expand Down

0 comments on commit b4d2261

Please # to comment.