
(FPCore (x y z t) :precision binary64 (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))
double code(double x, double y, double z, double t) {
return x + ((y * z) * (tanh((t / y)) - tanh((x / y))));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y * z) * (tanh((t / y)) - tanh((x / y))))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y * z) * (Math.tanh((t / y)) - Math.tanh((x / y))));
}
def code(x, y, z, t): return x + ((y * z) * (math.tanh((t / y)) - math.tanh((x / y))))
function code(x, y, z, t) return Float64(x + Float64(Float64(y * z) * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y))))) end
function tmp = code(x, y, z, t) tmp = x + ((y * z) * (tanh((t / y)) - tanh((x / y)))); 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]
\begin{array}{l}
\\
x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))
double code(double x, double y, double z, double t) {
return x + ((y * z) * (tanh((t / y)) - tanh((x / y))));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y * z) * (tanh((t / y)) - tanh((x / y))))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y * z) * (Math.tanh((t / y)) - Math.tanh((x / y))));
}
def code(x, y, z, t): return x + ((y * z) * (math.tanh((t / y)) - math.tanh((x / y))))
function code(x, y, z, t) return Float64(x + Float64(Float64(y * z) * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y))))) end
function tmp = code(x, y, z, t) tmp = x + ((y * z) * (tanh((t / y)) - tanh((x / y)))); 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]
\begin{array}{l}
\\
x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)
\end{array}
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* (- (tanh (/ t y)) (tanh (/ x y))) (* z y)))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 5e+295)))
(+ x (* z (- t x)))
t_1)))
double code(double x, double y, double z, double t) {
double t_1 = x + ((tanh((t / y)) - tanh((x / y))) * (z * y));
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 5e+295)) {
tmp = x + (z * (t - x));
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = x + ((Math.tanh((t / y)) - Math.tanh((x / y))) * (z * y));
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 5e+295)) {
tmp = x + (z * (t - x));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + ((math.tanh((t / y)) - math.tanh((x / y))) * (z * y)) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 5e+295): tmp = x + (z * (t - x)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(tanh(Float64(t / y)) - tanh(Float64(x / y))) * Float64(z * y))) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 5e+295)) tmp = Float64(x + Float64(z * Float64(t - x))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + ((tanh((t / y)) - tanh((x / y))) * (z * y)); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 5e+295))) tmp = x + (z * (t - x)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 5e+295]], $MachinePrecision]], N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot \left(z \cdot y\right)\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 5 \cdot 10^{+295}\right):\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < -inf.0 or 4.99999999999999991e295 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) Initial program 48.9%
Taylor expanded in y around inf 100.0%
if -inf.0 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 4.99999999999999991e295Initial program 99.7%
Final simplification99.7%
(FPCore (x y z t) :precision binary64 (fma z (* y (- (tanh (/ t y)) (tanh (/ x y)))) x))
double code(double x, double y, double z, double t) {
return fma(z, (y * (tanh((t / y)) - tanh((x / y)))), x);
}
function code(x, y, z, t) return fma(z, Float64(y * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))), x) end
code[x_, y_, z_, t_] := N[(z * N[(y * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)
\end{array}
Initial program 94.5%
+-commutative94.5%
*-commutative94.5%
associate-*l*98.2%
fma-def98.2%
Simplified98.2%
Final simplification98.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.5e-127) (not (<= t 0.115))) (fma z (* y (tanh (/ t y))) x) (fma z (* y (- (/ t y) (tanh (/ x y)))) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.5e-127) || !(t <= 0.115)) {
tmp = fma(z, (y * tanh((t / y))), x);
} else {
tmp = fma(z, (y * ((t / y) - tanh((x / y)))), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((t <= -3.5e-127) || !(t <= 0.115)) tmp = fma(z, Float64(y * tanh(Float64(t / y))), x); else tmp = fma(z, Float64(y * Float64(Float64(t / y) - tanh(Float64(x / y)))), x); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3.5e-127], N[Not[LessEqual[t, 0.115]], $MachinePrecision]], N[(z * N[(y * N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(z * N[(y * N[(N[(t / y), $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.5 \cdot 10^{-127} \lor \neg \left(t \leq 0.115\right):\\
\;\;\;\;\mathsf{fma}\left(z, y \cdot \tanh \left(\frac{t}{y}\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, y \cdot \left(\frac{t}{y} - \tanh \left(\frac{x}{y}\right)\right), x\right)\\
\end{array}
\end{array}
if t < -3.49999999999999989e-127 or 0.115000000000000005 < t Initial program 96.3%
+-commutative96.3%
*-commutative96.3%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in x around 0 9.9%
associate-/r*9.9%
div-sub9.9%
rec-exp9.9%
rec-exp9.9%
tanh-def-a91.2%
Simplified91.2%
if -3.49999999999999989e-127 < t < 0.115000000000000005Initial program 91.9%
+-commutative91.9%
*-commutative91.9%
associate-*l*95.7%
fma-def95.7%
Simplified95.7%
Taylor expanded in t around 0 91.1%
Final simplification91.2%
(FPCore (x y z t) :precision binary64 (if (<= y 2.6e+132) (fma z (* y (tanh (/ t y))) x) (+ x (* z (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.6e+132) {
tmp = fma(z, (y * tanh((t / y))), x);
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= 2.6e+132) tmp = fma(z, Float64(y * tanh(Float64(t / y))), x); else tmp = Float64(x + Float64(z * Float64(t - x))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, 2.6e+132], N[(z * N[(y * N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.6 \cdot 10^{+132}:\\
\;\;\;\;\mathsf{fma}\left(z, y \cdot \tanh \left(\frac{t}{y}\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 2.6e132Initial program 97.9%
+-commutative97.9%
*-commutative97.9%
associate-*l*98.8%
fma-def98.8%
Simplified98.8%
Taylor expanded in x around 0 26.4%
associate-/r*26.4%
div-sub26.4%
rec-exp26.4%
rec-exp26.4%
tanh-def-a85.5%
Simplified85.5%
if 2.6e132 < y Initial program 73.7%
Taylor expanded in y around inf 92.1%
Final simplification86.4%
(FPCore (x y z t) :precision binary64 (if (<= y 1.42e+137) (+ x (* (tanh (/ t y)) (* z y))) (+ x (* z (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.42e+137) {
tmp = x + (tanh((t / y)) * (z * y));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 1.42d+137) then
tmp = x + (tanh((t / y)) * (z * y))
else
tmp = x + (z * (t - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.42e+137) {
tmp = x + (Math.tanh((t / y)) * (z * y));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 1.42e+137: tmp = x + (math.tanh((t / y)) * (z * y)) else: tmp = x + (z * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 1.42e+137) tmp = Float64(x + Float64(tanh(Float64(t / y)) * Float64(z * y))); else tmp = Float64(x + Float64(z * Float64(t - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 1.42e+137) tmp = x + (tanh((t / y)) * (z * y)); else tmp = x + (z * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 1.42e+137], N[(x + N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.42 \cdot 10^{+137}:\\
\;\;\;\;x + \tanh \left(\frac{t}{y}\right) \cdot \left(z \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 1.42e137Initial program 97.9%
Taylor expanded in x around 0 26.4%
associate-*r*26.3%
associate-/r*26.3%
div-sub26.3%
rec-exp26.3%
rec-exp26.3%
tanh-def-a84.5%
Simplified84.5%
if 1.42e137 < y Initial program 73.7%
Taylor expanded in y around inf 92.1%
Final simplification85.6%
(FPCore (x y z t) :precision binary64 (if (<= x -3.9e-190) x (if (<= x 2.8e-233) (* z t) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.9e-190) {
tmp = x;
} else if (x <= 2.8e-233) {
tmp = z * t;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-3.9d-190)) then
tmp = x
else if (x <= 2.8d-233) then
tmp = z * t
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.9e-190) {
tmp = x;
} else if (x <= 2.8e-233) {
tmp = z * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.9e-190: tmp = x elif x <= 2.8e-233: tmp = z * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.9e-190) tmp = x; elseif (x <= 2.8e-233) tmp = Float64(z * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.9e-190) tmp = x; elseif (x <= 2.8e-233) tmp = z * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.9e-190], x, If[LessEqual[x, 2.8e-233], N[(z * t), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.9 \cdot 10^{-190}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-233}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.89999999999999995e-190 or 2.8000000000000001e-233 < x Initial program 95.7%
Taylor expanded in x around inf 71.2%
if -3.89999999999999995e-190 < x < 2.8000000000000001e-233Initial program 87.8%
Taylor expanded in y around inf 50.5%
Taylor expanded in t around inf 43.6%
Taylor expanded in x around 0 41.2%
Final simplification66.6%
(FPCore (x y z t) :precision binary64 (if (<= y 6.4e+115) x (+ x (* z (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 6.4e+115) {
tmp = x;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 6.4d+115) then
tmp = x
else
tmp = x + (z * (t - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 6.4e+115) {
tmp = x;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 6.4e+115: tmp = x else: tmp = x + (z * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 6.4e+115) tmp = x; else tmp = Float64(x + Float64(z * Float64(t - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 6.4e+115) tmp = x; else tmp = x + (z * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 6.4e+115], x, N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.4 \cdot 10^{+115}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 6.4e115Initial program 98.3%
Taylor expanded in x around inf 68.7%
if 6.4e115 < y Initial program 75.8%
Taylor expanded in y around inf 86.9%
Final simplification71.7%
(FPCore (x y z t) :precision binary64 (if (<= y 7.6e+116) x (* x (- 1.0 z))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 7.6e+116) {
tmp = x;
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 7.6d+116) then
tmp = x
else
tmp = x * (1.0d0 - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 7.6e+116) {
tmp = x;
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 7.6e+116: tmp = x else: tmp = x * (1.0 - z) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 7.6e+116) tmp = x; else tmp = Float64(x * Float64(1.0 - z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 7.6e+116) tmp = x; else tmp = x * (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 7.6e+116], x, N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.6 \cdot 10^{+116}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if y < 7.5999999999999998e116Initial program 97.8%
Taylor expanded in x around inf 68.4%
if 7.5999999999999998e116 < y Initial program 77.5%
Taylor expanded in x around 0 72.8%
Taylor expanded in x around inf 52.2%
mul-1-neg52.2%
unsub-neg52.2%
Simplified52.2%
Final simplification65.7%
(FPCore (x y z t) :precision binary64 (if (<= y 3.5e+115) x (+ x (* z t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3.5e+115) {
tmp = x;
} else {
tmp = x + (z * t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 3.5d+115) then
tmp = x
else
tmp = x + (z * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3.5e+115) {
tmp = x;
} else {
tmp = x + (z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 3.5e+115: tmp = x else: tmp = x + (z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 3.5e+115) tmp = x; else tmp = Float64(x + Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 3.5e+115) tmp = x; else tmp = x + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 3.5e+115], x, N[(x + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.5 \cdot 10^{+115}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot t\\
\end{array}
\end{array}
if y < 3.50000000000000005e115Initial program 98.3%
Taylor expanded in x around inf 68.7%
if 3.50000000000000005e115 < y Initial program 75.8%
Taylor expanded in y around inf 86.9%
Taylor expanded in t around inf 71.1%
Final simplification69.1%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 94.5%
Taylor expanded in x around inf 62.2%
Final simplification62.2%
(FPCore (x y z t) :precision binary64 (+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y)))))))
double code(double x, double y, double z, double t) {
return x + (y * (z * (tanh((t / y)) - tanh((x / y)))));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + (y * (z * (tanh((t / y)) - tanh((x / y)))))
end function
public static double code(double x, double y, double z, double t) {
return x + (y * (z * (Math.tanh((t / y)) - Math.tanh((x / y)))));
}
def code(x, y, z, t): return x + (y * (z * (math.tanh((t / y)) - math.tanh((x / y)))))
function code(x, y, z, t) return Float64(x + Float64(y * Float64(z * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))))) end
function tmp = code(x, y, z, t) tmp = x + (y * (z * (tanh((t / y)) - tanh((x / y))))); end
code[x_, y_, z_, t_] := N[(x + N[(y * N[(z * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)
\end{array}
herbie shell --seed 2024021
(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))))))