(FPCore (x y z t) :precision binary64 (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma z (- t x) x)))
(if (<= y -7.414154157345965e+168)
t_1
(if (<= y 1.0568740699100138e+135)
(fma (* y z) (- (tanh (/ t y)) (tanh (/ x y))) x)
t_1))))double code(double x, double y, double z, double t) {
return x + ((y * z) * (tanh((t / y)) - tanh((x / y))));
}
double code(double x, double y, double z, double t) {
double t_1 = fma(z, (t - x), x);
double tmp;
if (y <= -7.414154157345965e+168) {
tmp = t_1;
} else if (y <= 1.0568740699100138e+135) {
tmp = fma((y * z), (tanh((t / y)) - tanh((x / y))), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) return Float64(x + Float64(Float64(y * z) * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y))))) end
function code(x, y, z, t) t_1 = fma(z, Float64(t - x), x) tmp = 0.0 if (y <= -7.414154157345965e+168) tmp = t_1; elseif (y <= 1.0568740699100138e+135) tmp = fma(Float64(y * z), Float64(tanh(Float64(t / y)) - tanh(Float64(x / y))), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * z), $MachinePrecision] * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -7.414154157345965e+168], t$95$1, If[LessEqual[y, 1.0568740699100138e+135], N[(N[(y * z), $MachinePrecision] * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, t - x, x\right)\\
\mathbf{if}\;y \leq -7.414154157345965 \cdot 10^{+168}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.0568740699100138 \cdot 10^{+135}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot z, \tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 4.7 |
|---|---|
| Target | 2.1 |
| Herbie | 2.6 |
if y < -7.41415415734596486e168 or 1.0568740699100138e135 < y Initial program 15.8
Simplified15.8
Taylor expanded in y around inf 6.5
Simplified6.5
Taylor expanded in z around 0 6.5
Simplified6.5
if -7.41415415734596486e168 < y < 1.0568740699100138e135Initial program 1.4
Simplified1.4
Final simplification2.6
herbie shell --seed 2022131
(FPCore (x y z t)
:name "SynthBasics:moogVCF from YampaSynth-0.2"
:precision binary64
:herbie-target
(+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y))))))
(+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))