Average Error: 2.8 → 0.3
Time: 34.7s
Precision: 64
Internal Precision: 384
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
↓
\[\begin{array}{l}
\mathbf{if}\;x \le -197.98382271840867:\\
\;\;\;\;\frac{1}{\frac{z}{x \cdot \frac{\sin y}{y}}}\\
\mathbf{if}\;x \le 1.1415449837537338 \cdot 10^{-08}:\\
\;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{z}{x \cdot \frac{\sin y}{y}}}\\
\end{array}\]
Target
| Original | 2.8 |
|---|
| Target | 0.3 |
|---|
| Herbie | 0.3 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \lt -4.2173720203427147 \cdot 10^{-29}:\\
\;\;\;\;\frac{x \cdot \frac{1}{\frac{y}{\sin y}}}{z}\\
\mathbf{if}\;z \lt 4.446702369113811 \cdot 10^{+64}:\\
\;\;\;\;\frac{x}{z \cdot \frac{y}{\sin y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{1}{\frac{y}{\sin y}}}{z}\\
\end{array}\]
Derivation
- Split input into 2 regimes
if x < -197.98382271840867 or 1.1415449837537338e-08 < x
Initial program 0.2
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
- Using strategy
rm Applied clear-num0.5
\[\leadsto \color{blue}{\frac{1}{\frac{z}{x \cdot \frac{\sin y}{y}}}}\]
if -197.98382271840867 < x < 1.1415449837537338e-08
Initial program 5.1
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
- Using strategy
rm Applied associate-/l*0.1
\[\leadsto \color{blue}{\frac{x}{\frac{z}{\frac{\sin y}{y}}}}\]
- 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)
:name "Linear.Quaternion:$ctanh from linear-1.19.1.3"
:herbie-target
(if (< z -4.2173720203427147e-29) (/ (* x (/ 1 (/ y (sin y)))) z) (if (< z 4.446702369113811e+64) (/ x (* z (/ y (sin y)))) (/ (* x (/ 1 (/ y (sin y)))) z)))
(/ (* x (/ (sin y) y)) z))