
(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))) (* y z))))) (if (<= t_1 4e+300) t_1 (+ x (* z (- t x))))))
double code(double x, double y, double z, double t) {
double t_1 = x + ((tanh((t / y)) - tanh((x / y))) * (y * z));
double tmp;
if (t_1 <= 4e+300) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = x + ((tanh((t / y)) - tanh((x / y))) * (y * z))
if (t_1 <= 4d+300) then
tmp = t_1
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 t_1 = x + ((Math.tanh((t / y)) - Math.tanh((x / y))) * (y * z));
double tmp;
if (t_1 <= 4e+300) {
tmp = t_1;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
def code(x, y, z, t): t_1 = x + ((math.tanh((t / y)) - math.tanh((x / y))) * (y * z)) tmp = 0 if t_1 <= 4e+300: tmp = t_1 else: tmp = x + (z * (t - x)) return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(tanh(Float64(t / y)) - tanh(Float64(x / y))) * Float64(y * z))) tmp = 0.0 if (t_1 <= 4e+300) tmp = t_1; else tmp = Float64(x + Float64(z * Float64(t - x))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + ((tanh((t / y)) - tanh((x / y))) * (y * z)); tmp = 0.0; if (t_1 <= 4e+300) tmp = t_1; else tmp = x + (z * (t - x)); 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[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 4e+300], t$95$1, N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\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(y \cdot z\right)\\
\mathbf{if}\;t\_1 \leq 4 \cdot 10^{+300}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 4.0000000000000002e300Initial program 99.0%
if 4.0000000000000002e300 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) Initial program 53.9%
Taylor expanded in y around inf 100.0%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (fma y (* z (- (tanh (/ t y)) (tanh (/ x y)))) x))
double code(double x, double y, double z, double t) {
return fma(y, (z * (tanh((t / y)) - tanh((x / y)))), x);
}
function code(x, y, z, t) return fma(y, Float64(z * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))), x) end
code[x_, y_, z_, t_] := N[(y * N[(z * 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(y, z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)
\end{array}
Initial program 97.3%
+-commutative97.3%
associate-*l*98.6%
fma-define98.6%
Simplified98.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.26e-164) (not (<= t 2.45e-88))) (fma y (* z (tanh (/ t y))) x) (+ x (* (* y z) (- (/ t y) (tanh (/ x y)))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.26e-164) || !(t <= 2.45e-88)) {
tmp = fma(y, (z * tanh((t / y))), x);
} else {
tmp = x + ((y * z) * ((t / y) - tanh((x / y))));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.26e-164) || !(t <= 2.45e-88)) tmp = fma(y, Float64(z * tanh(Float64(t / y))), x); else tmp = Float64(x + Float64(Float64(y * z) * Float64(Float64(t / y) - tanh(Float64(x / y))))); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.26e-164], N[Not[LessEqual[t, 2.45e-88]], $MachinePrecision]], N[(y * N[(z * N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] * N[(N[(t / y), $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.26 \cdot 10^{-164} \lor \neg \left(t \leq 2.45 \cdot 10^{-88}\right):\\
\;\;\;\;\mathsf{fma}\left(y, z \cdot \tanh \left(\frac{t}{y}\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y \cdot z\right) \cdot \left(\frac{t}{y} - \tanh \left(\frac{x}{y}\right)\right)\\
\end{array}
\end{array}
if t < -1.26e-164 or 2.45000000000000014e-88 < t Initial program 96.3%
+-commutative96.3%
associate-*l*98.8%
fma-define98.8%
Simplified98.8%
Taylor expanded in x around 0 13.7%
associate-/r*13.7%
div-sub13.7%
rec-exp13.8%
rec-exp13.8%
tanh-def-a88.1%
Simplified88.1%
if -1.26e-164 < t < 2.45000000000000014e-88Initial program 99.5%
Taylor expanded in t around 0 95.8%
Final simplification90.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -5.2e-164) (not (<= t 1.85e-88))) (+ x (* (tanh (/ t y)) (* y z))) (+ x (* (* y z) (- (/ t y) (tanh (/ x y)))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.2e-164) || !(t <= 1.85e-88)) {
tmp = x + (tanh((t / y)) * (y * z));
} else {
tmp = x + ((y * z) * ((t / y) - tanh((x / y))));
}
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 ((t <= (-5.2d-164)) .or. (.not. (t <= 1.85d-88))) then
tmp = x + (tanh((t / y)) * (y * z))
else
tmp = x + ((y * z) * ((t / y) - tanh((x / y))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.2e-164) || !(t <= 1.85e-88)) {
tmp = x + (Math.tanh((t / y)) * (y * z));
} else {
tmp = x + ((y * z) * ((t / y) - Math.tanh((x / y))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -5.2e-164) or not (t <= 1.85e-88): tmp = x + (math.tanh((t / y)) * (y * z)) else: tmp = x + ((y * z) * ((t / y) - math.tanh((x / y)))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -5.2e-164) || !(t <= 1.85e-88)) tmp = Float64(x + Float64(tanh(Float64(t / y)) * Float64(y * z))); else tmp = Float64(x + Float64(Float64(y * z) * Float64(Float64(t / y) - tanh(Float64(x / y))))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -5.2e-164) || ~((t <= 1.85e-88))) tmp = x + (tanh((t / y)) * (y * z)); else tmp = x + ((y * z) * ((t / y) - tanh((x / y)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -5.2e-164], N[Not[LessEqual[t, 1.85e-88]], $MachinePrecision]], N[(x + N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] * N[(N[(t / y), $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.2 \cdot 10^{-164} \lor \neg \left(t \leq 1.85 \cdot 10^{-88}\right):\\
\;\;\;\;x + \tanh \left(\frac{t}{y}\right) \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y \cdot z\right) \cdot \left(\frac{t}{y} - \tanh \left(\frac{x}{y}\right)\right)\\
\end{array}
\end{array}
if t < -5.2000000000000003e-164 or 1.8499999999999999e-88 < t Initial program 96.3%
Taylor expanded in x around 0 13.7%
associate-*r*13.7%
associate-/r*13.7%
div-sub13.6%
rec-exp13.7%
rec-exp13.7%
tanh-def-a86.6%
Simplified86.6%
if -5.2000000000000003e-164 < t < 1.8499999999999999e-88Initial program 99.5%
Taylor expanded in t around 0 95.8%
Final simplification89.4%
(FPCore (x y z t) :precision binary64 (if (<= y 9.5e+105) (+ x (* (tanh (/ t y)) (* y z))) (fma z (- t x) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 9.5e+105) {
tmp = x + (tanh((t / y)) * (y * z));
} else {
tmp = fma(z, (t - x), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= 9.5e+105) tmp = Float64(x + Float64(tanh(Float64(t / y)) * Float64(y * z))); else tmp = fma(z, Float64(t - x), x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, 9.5e+105], N[(x + N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9.5 \cdot 10^{+105}:\\
\;\;\;\;x + \tanh \left(\frac{t}{y}\right) \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\
\end{array}
\end{array}
if y < 9.4999999999999995e105Initial program 99.3%
Taylor expanded in x around 0 23.0%
associate-*r*23.0%
associate-/r*22.9%
div-sub22.9%
rec-exp23.0%
rec-exp23.0%
tanh-def-a84.4%
Simplified84.4%
if 9.4999999999999995e105 < y Initial program 85.3%
+-commutative85.3%
associate-*l*92.3%
fma-define92.2%
Simplified92.2%
Taylor expanded in y around inf 90.2%
+-commutative90.2%
fma-define90.2%
Simplified90.2%
Final simplification85.2%
(FPCore (x y z t) :precision binary64 (if (<= y 1.9e+20) x (fma z (- t x) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.9e+20) {
tmp = x;
} else {
tmp = fma(z, (t - x), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= 1.9e+20) tmp = x; else tmp = fma(z, Float64(t - x), x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, 1.9e+20], x, N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.9 \cdot 10^{+20}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\
\end{array}
\end{array}
if y < 1.9e20Initial program 99.5%
+-commutative99.5%
associate-*l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 68.9%
if 1.9e20 < y Initial program 89.7%
+-commutative89.7%
associate-*l*94.3%
fma-define94.3%
Simplified94.3%
Taylor expanded in y around inf 86.3%
+-commutative86.3%
fma-define86.3%
Simplified86.3%
(FPCore (x y z t) :precision binary64 (if (<= y 1.1e+21) x (+ x (* z (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.1e+21) {
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 <= 1.1d+21) 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 <= 1.1e+21) {
tmp = x;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 1.1e+21: tmp = x else: tmp = x + (z * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 1.1e+21) 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 <= 1.1e+21) tmp = x; else tmp = x + (z * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 1.1e+21], x, N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.1 \cdot 10^{+21}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 1.1e21Initial program 99.5%
+-commutative99.5%
associate-*l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 68.9%
if 1.1e21 < y Initial program 89.7%
Taylor expanded in y around inf 86.3%
(FPCore (x y z t) :precision binary64 (if (<= y 2e+24) x (+ x (* z t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2e+24) {
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 <= 2d+24) 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 <= 2e+24) {
tmp = x;
} else {
tmp = x + (z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 2e+24: tmp = x else: tmp = x + (z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 2e+24) 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 <= 2e+24) tmp = x; else tmp = x + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 2e+24], x, N[(x + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2 \cdot 10^{+24}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot t\\
\end{array}
\end{array}
if y < 2e24Initial program 99.5%
+-commutative99.5%
associate-*l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 68.5%
if 2e24 < y Initial program 89.6%
+-commutative89.6%
associate-*l*94.2%
fma-define94.2%
Simplified94.2%
Taylor expanded in x around 0 31.6%
associate-/r*31.5%
div-sub31.5%
rec-exp31.6%
rec-exp31.6%
tanh-def-a79.1%
Simplified79.1%
Taylor expanded in y around inf 73.5%
*-commutative73.5%
Simplified73.5%
(FPCore (x y z t) :precision binary64 (if (<= y 1.1e+22) x (* x (- 1.0 z))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.1e+22) {
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 <= 1.1d+22) 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 <= 1.1e+22) {
tmp = x;
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 1.1e+22: tmp = x else: tmp = x * (1.0 - z) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 1.1e+22) 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 <= 1.1e+22) tmp = x; else tmp = x * (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 1.1e+22], x, N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.1 \cdot 10^{+22}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if y < 1.1e22Initial program 99.5%
+-commutative99.5%
associate-*l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 68.9%
if 1.1e22 < y Initial program 89.7%
Taylor expanded in y around inf 76.1%
Taylor expanded in x around inf 52.8%
mul-1-neg52.8%
unsub-neg52.8%
Simplified52.8%
(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 97.3%
+-commutative97.3%
associate-*l*98.6%
fma-define98.6%
Simplified98.6%
Taylor expanded in y around 0 62.3%
(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 2024143
(FPCore (x y z t)
:name "SynthBasics:moogVCF from YampaSynth-0.2"
:precision binary64
:alt
(! :herbie-platform default (+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y)))))))
(+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))