Average Error: 6.7 → 2.7
Time: 50.5s
Precision: 64
Internal Precision: 384
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
↓
\[\begin{array}{l}
\mathbf{if}\;y \le -28.696850627339362:\\
\;\;\;\;\left(t \cdot y\right) \cdot \left(x - z\right)\\
\mathbf{if}\;y \le 1.2704072794546793 \cdot 10^{-51}:\\
\;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t \cdot y\right) \cdot \left(x - z\right)\\
\end{array}\]
Target
| Original | 6.7 |
|---|
| Target | 2.9 |
|---|
| Herbie | 2.7 |
|---|
\[\begin{array}{l}
\mathbf{if}\;t \lt -9.231879582886777 \cdot 10^{-80}:\\
\;\;\;\;\left(y \cdot t\right) \cdot \left(x - z\right)\\
\mathbf{if}\;t \lt 2.543067051564877 \cdot 10^{+83}:\\
\;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot \left(x - z\right)\right) \cdot t\\
\end{array}\]
Derivation
- Split input into 2 regimes
if y < -28.696850627339362 or 1.2704072794546793e-51 < y
Initial program 13.0
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
Applied simplify3.4
\[\leadsto \color{blue}{\left(t \cdot y\right) \cdot \left(x - z\right)}\]
if -28.696850627339362 < y < 1.2704072794546793e-51
Initial program 2.2
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
Applied simplify9.0
\[\leadsto \color{blue}{\left(t \cdot y\right) \cdot \left(x - z\right)}\]
- Using strategy
rm Applied associate-*l*2.2
\[\leadsto \color{blue}{t \cdot \left(y \cdot \left(x - z\right)\right)}\]
- Recombined 2 regimes into one program.
- Removed slow
pow expressions.
Runtime
herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit
(FPCore (x y z t)
:name "Linear.Projection:inverseInfinitePerspective from linear-1.19.1.3"
:herbie-target
(if (< t -9.231879582886777e-80) (* (* y t) (- x z)) (if (< t 2.543067051564877e+83) (* y (* t (- x z))) (* (* y (- x z)) t)))
(* (- (* x y) (* z y)) t))