Average Error: 4.4 → 2.1
Time: 1.5m
Precision: 64
Internal precision: 128
\[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\]
⬇
\[\begin{array}{l}
\mathbf{if}\;z \le -3.62875581368641 \cdot 10^{-69}:\\
\;\;\;\;x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\\
\mathbf{if}\;z \le 8.213176982230116 \cdot 10^{-77}:\\
\;\;\;\;x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\\
\end{array}\]
Target
| Original | 4.4 |
| Comparison | 2.1 |
| Herbie | 2.1 |
\[ x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right) \]
Derivation
- Split input into 2 regimes.
-
if z < -3.62875581368641e-69 or 8.213176982230116e-77 < z
Initial program 7.4
\[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\]
- Using strategy
rm
Applied associate-*l* 2.6
\[\leadsto x + \color{blue}{y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)}\]
if -3.62875581368641e-69 < z < 8.213176982230116e-77
Initial program 0.1
\[x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\]
- Using strategy
rm
Applied associate-*l* 1.4
\[\leadsto x + \color{blue}{y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)}\]
- Recombined 2 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie --seed '#(3124143094 2042590318 2678369467 1833894078 386016924 1737192109)'
(FPCore (x y z t)
:name "SynthBasics:moogVCF from YampaSynth-0.2"
:target
(+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y))))))
(+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))