Average Error: 2.8 → 0.5
Time: 43.6s
Precision: 64
Internal Precision: 384
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
↓
\[\begin{array}{l}
\mathbf{if}\;z \le -5.118596280002755 \cdot 10^{+95}:\\
\;\;\;\;\frac{x \cdot \left(\sin y \cdot \frac{1}{y}\right)}{z}\\
\mathbf{if}\;z \le 1.0774220446440768 \cdot 10^{-83}:\\
\;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(\sin y \cdot \frac{1}{y}\right)}{z}\\
\end{array}\]
Target
| Original | 2.8 |
|---|
| Target | 0.3 |
|---|
| Herbie | 0.5 |
|---|
\[\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 z < -5.118596280002755e+95 or 1.0774220446440768e-83 < z
Initial program 0.4
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
- Using strategy
rm Applied div-inv0.4
\[\leadsto \frac{x \cdot \color{blue}{\left(\sin y \cdot \frac{1}{y}\right)}}{z}\]
if -5.118596280002755e+95 < z < 1.0774220446440768e-83
Initial program 5.7
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
- Using strategy
rm Applied associate-/l*0.6
\[\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))