Average Error: 2.8 → 2.0
Time: 42.7s
Precision: 64
Internal Precision: 384
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
↓
\[\begin{array}{l}
\mathbf{if}\;x \le -5.7336804601369906 \cdot 10^{+181}:\\
\;\;\;\;\frac{\left(x \cdot \sin y\right) \cdot \frac{1}{y}}{z}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \left(\frac{x}{z} \cdot \frac{\sin y}{y}\right)\\
\end{array}\]
Target
| Original | 2.8 |
|---|
| Target | 0.3 |
|---|
| Herbie | 2.0 |
|---|
\[\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 < -5.7336804601369906e+181
Initial program 0.2
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
- Using strategy
rm Applied div-inv0.3
\[\leadsto \frac{x \cdot \color{blue}{\left(\sin y \cdot \frac{1}{y}\right)}}{z}\]
Applied associate-*r*0.4
\[\leadsto \frac{\color{blue}{\left(x \cdot \sin y\right) \cdot \frac{1}{y}}}{z}\]
if -5.7336804601369906e+181 < x
Initial program 3.0
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
- Using strategy
rm Applied clear-num3.6
\[\leadsto \color{blue}{\frac{1}{\frac{z}{x \cdot \frac{\sin y}{y}}}}\]
- Using strategy
rm Applied div-inv3.6
\[\leadsto \color{blue}{1 \cdot \frac{1}{\frac{z}{x \cdot \frac{\sin y}{y}}}}\]
Applied simplify2.1
\[\leadsto 1 \cdot \color{blue}{\left(\frac{x}{z} \cdot \frac{\sin y}{y}\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 +o reduce:binary-search
(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))