
(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 9 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 (fma y (- (* (tanh (/ t y)) z) (* z (tanh (/ x y)))) x))
double code(double x, double y, double z, double t) {
return fma(y, ((tanh((t / y)) * z) - (z * tanh((x / y)))), x);
}
function code(x, y, z, t) return fma(y, Float64(Float64(tanh(Float64(t / y)) * z) - Float64(z * tanh(Float64(x / y)))), x) end
code[x_, y_, z_, t_] := N[(y * N[(N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] * z), $MachinePrecision] - N[(z * N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, \tanh \left(\frac{t}{y}\right) \cdot z - z \cdot \tanh \left(\frac{x}{y}\right), x\right)
\end{array}
Initial program 97.7%
+-commutative97.7%
associate-*l*99.5%
fma-define99.5%
Simplified99.5%
sub-neg99.5%
distribute-rgt-in99.6%
Applied egg-rr99.6%
Final simplification99.6%
(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.7%
+-commutative97.7%
associate-*l*99.5%
fma-define99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 (+ x (* (- (tanh (/ t y)) (tanh (/ x y))) (* y z))))
double code(double x, double y, double z, double t) {
return x + ((tanh((t / y)) - tanh((x / y))) * (y * z));
}
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 + ((tanh((t / y)) - tanh((x / y))) * (y * z))
end function
public static double code(double x, double y, double z, double t) {
return x + ((Math.tanh((t / y)) - Math.tanh((x / y))) * (y * z));
}
def code(x, y, z, t): return x + ((math.tanh((t / y)) - math.tanh((x / y))) * (y * z))
function code(x, y, z, t) return Float64(x + Float64(Float64(tanh(Float64(t / y)) - tanh(Float64(x / y))) * Float64(y * z))) end
function tmp = code(x, y, z, t) tmp = x + ((tanh((t / y)) - tanh((x / y))) * (y * z)); end
code[x_, y_, z_, t_] := 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]
\begin{array}{l}
\\
x + \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot \left(y \cdot z\right)
\end{array}
Initial program 97.7%
Final simplification97.7%
(FPCore (x y z t) :precision binary64 (if (<= y 3.6e+89) (+ x (* y (* (tanh (/ t y)) z))) (+ x (* z (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3.6e+89) {
tmp = x + (y * (tanh((t / y)) * z));
} 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 <= 3.6d+89) then
tmp = x + (y * (tanh((t / y)) * z))
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 <= 3.6e+89) {
tmp = x + (y * (Math.tanh((t / y)) * z));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 3.6e+89: tmp = x + (y * (math.tanh((t / y)) * z)) else: tmp = x + (z * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 3.6e+89) tmp = Float64(x + Float64(y * Float64(tanh(Float64(t / y)) * z))); 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 <= 3.6e+89) tmp = x + (y * (tanh((t / y)) * z)); else tmp = x + (z * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 3.6e+89], N[(x + N[(y * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.6 \cdot 10^{+89}:\\
\;\;\;\;x + y \cdot \left(\tanh \left(\frac{t}{y}\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 3.6e89Initial program 99.1%
Taylor expanded in x around 0 28.1%
associate-/r*28.1%
rec-exp28.1%
div-sub28.1%
rec-exp28.1%
tanh-def-a86.0%
Simplified86.0%
if 3.6e89 < y Initial program 91.8%
Taylor expanded in y around inf 86.8%
Final simplification86.1%
(FPCore (x y z t)
:precision binary64
(if (<= y 2.8e+50)
x
(if (or (<= y 2.8e+99) (and (not (<= y 5.5e+179)) (<= y 9.2e+225)))
(+ x (* t z))
(* x (- 1.0 z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.8e+50) {
tmp = x;
} else if ((y <= 2.8e+99) || (!(y <= 5.5e+179) && (y <= 9.2e+225))) {
tmp = x + (t * z);
} 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 <= 2.8d+50) then
tmp = x
else if ((y <= 2.8d+99) .or. (.not. (y <= 5.5d+179)) .and. (y <= 9.2d+225)) then
tmp = x + (t * z)
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 <= 2.8e+50) {
tmp = x;
} else if ((y <= 2.8e+99) || (!(y <= 5.5e+179) && (y <= 9.2e+225))) {
tmp = x + (t * z);
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 2.8e+50: tmp = x elif (y <= 2.8e+99) or (not (y <= 5.5e+179) and (y <= 9.2e+225)): tmp = x + (t * z) else: tmp = x * (1.0 - z) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 2.8e+50) tmp = x; elseif ((y <= 2.8e+99) || (!(y <= 5.5e+179) && (y <= 9.2e+225))) tmp = Float64(x + Float64(t * z)); 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 <= 2.8e+50) tmp = x; elseif ((y <= 2.8e+99) || (~((y <= 5.5e+179)) && (y <= 9.2e+225))) tmp = x + (t * z); else tmp = x * (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 2.8e+50], x, If[Or[LessEqual[y, 2.8e+99], And[N[Not[LessEqual[y, 5.5e+179]], $MachinePrecision], LessEqual[y, 9.2e+225]]], N[(x + N[(t * z), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.8 \cdot 10^{+50}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{+99} \lor \neg \left(y \leq 5.5 \cdot 10^{+179}\right) \land y \leq 9.2 \cdot 10^{+225}:\\
\;\;\;\;x + t \cdot z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if y < 2.7999999999999998e50Initial program 99.0%
Taylor expanded in x around inf 70.5%
if 2.7999999999999998e50 < y < 2.8e99 or 5.4999999999999998e179 < y < 9.1999999999999998e225Initial program 95.2%
Taylor expanded in x around 0 34.2%
associate-/r*34.2%
rec-exp34.2%
div-sub34.2%
rec-exp34.2%
tanh-def-a91.5%
Simplified91.5%
Taylor expanded in y around inf 68.4%
+-commutative68.4%
Simplified68.4%
if 2.8e99 < y < 5.4999999999999998e179 or 9.1999999999999998e225 < y Initial program 92.6%
Taylor expanded in t around 0 35.0%
sub-neg35.0%
+-commutative35.0%
neg-sub035.0%
associate--r-35.0%
Simplified75.6%
Taylor expanded in x around 0 71.9%
mul-1-neg71.9%
unsub-neg71.9%
Simplified71.9%
Final simplification70.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* t z))))
(if (<= y 2.6e+48)
x
(if (<= y 5e+101)
t_1
(if (<= y 3.6e+178)
(* x (- 1.0 z))
(if (<= y 1.85e+226) t_1 (- x (* z x))))))))
double code(double x, double y, double z, double t) {
double t_1 = x + (t * z);
double tmp;
if (y <= 2.6e+48) {
tmp = x;
} else if (y <= 5e+101) {
tmp = t_1;
} else if (y <= 3.6e+178) {
tmp = x * (1.0 - z);
} else if (y <= 1.85e+226) {
tmp = t_1;
} else {
tmp = x - (z * 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 + (t * z)
if (y <= 2.6d+48) then
tmp = x
else if (y <= 5d+101) then
tmp = t_1
else if (y <= 3.6d+178) then
tmp = x * (1.0d0 - z)
else if (y <= 1.85d+226) then
tmp = t_1
else
tmp = x - (z * x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x + (t * z);
double tmp;
if (y <= 2.6e+48) {
tmp = x;
} else if (y <= 5e+101) {
tmp = t_1;
} else if (y <= 3.6e+178) {
tmp = x * (1.0 - z);
} else if (y <= 1.85e+226) {
tmp = t_1;
} else {
tmp = x - (z * x);
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (t * z) tmp = 0 if y <= 2.6e+48: tmp = x elif y <= 5e+101: tmp = t_1 elif y <= 3.6e+178: tmp = x * (1.0 - z) elif y <= 1.85e+226: tmp = t_1 else: tmp = x - (z * x) return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(t * z)) tmp = 0.0 if (y <= 2.6e+48) tmp = x; elseif (y <= 5e+101) tmp = t_1; elseif (y <= 3.6e+178) tmp = Float64(x * Float64(1.0 - z)); elseif (y <= 1.85e+226) tmp = t_1; else tmp = Float64(x - Float64(z * x)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (t * z); tmp = 0.0; if (y <= 2.6e+48) tmp = x; elseif (y <= 5e+101) tmp = t_1; elseif (y <= 3.6e+178) tmp = x * (1.0 - z); elseif (y <= 1.85e+226) tmp = t_1; else tmp = x - (z * x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 2.6e+48], x, If[LessEqual[y, 5e+101], t$95$1, If[LessEqual[y, 3.6e+178], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.85e+226], t$95$1, N[(x - N[(z * x), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + t \cdot z\\
\mathbf{if}\;y \leq 2.6 \cdot 10^{+48}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+101}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3.6 \cdot 10^{+178}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\mathbf{elif}\;y \leq 1.85 \cdot 10^{+226}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot x\\
\end{array}
\end{array}
if y < 2.59999999999999995e48Initial program 99.0%
Taylor expanded in x around inf 70.5%
if 2.59999999999999995e48 < y < 4.99999999999999989e101 or 3.5999999999999998e178 < y < 1.84999999999999991e226Initial program 95.2%
Taylor expanded in x around 0 34.2%
associate-/r*34.2%
rec-exp34.2%
div-sub34.2%
rec-exp34.2%
tanh-def-a91.5%
Simplified91.5%
Taylor expanded in y around inf 68.4%
+-commutative68.4%
Simplified68.4%
if 4.99999999999999989e101 < y < 3.5999999999999998e178Initial program 94.6%
Taylor expanded in t around 0 21.7%
sub-neg21.7%
+-commutative21.7%
neg-sub021.7%
associate--r-21.7%
Simplified79.5%
Taylor expanded in x around 0 71.2%
mul-1-neg71.2%
unsub-neg71.2%
Simplified71.2%
if 1.84999999999999991e226 < y Initial program 90.7%
Taylor expanded in t around 0 47.6%
sub-neg47.6%
+-commutative47.6%
neg-sub047.6%
associate--r-47.6%
Simplified71.9%
associate-*r*67.4%
distribute-rgt-neg-out67.4%
add-sqr-sqrt22.4%
sqrt-unprod57.5%
sqr-neg57.5%
sqrt-unprod35.0%
add-sqr-sqrt51.7%
cancel-sign-sub-inv51.7%
*-commutative51.7%
add-sqr-sqrt35.0%
sqrt-unprod57.5%
sqr-neg57.5%
sqrt-unprod22.4%
add-sqr-sqrt67.4%
Applied egg-rr67.4%
Taylor expanded in x around 0 72.6%
*-commutative72.6%
Simplified72.6%
Final simplification70.5%
(FPCore (x y z t) :precision binary64 (if (<= y 2.2e+50) x (+ x (* z (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.2e+50) {
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 <= 2.2d+50) 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 <= 2.2e+50) {
tmp = x;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 2.2e+50: tmp = x else: tmp = x + (z * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 2.2e+50) 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 <= 2.2e+50) tmp = x; else tmp = x + (z * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 2.2e+50], x, N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.2 \cdot 10^{+50}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 2.20000000000000017e50Initial program 99.0%
Taylor expanded in x around inf 70.5%
if 2.20000000000000017e50 < y Initial program 93.5%
Taylor expanded in y around inf 81.8%
Final simplification73.1%
(FPCore (x y z t) :precision binary64 (if (<= y 1.22e+63) x (* x (- 1.0 z))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.22e+63) {
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.22d+63) 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.22e+63) {
tmp = x;
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 1.22e+63: tmp = x else: tmp = x * (1.0 - z) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 1.22e+63) 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.22e+63) tmp = x; else tmp = x * (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 1.22e+63], x, N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.22 \cdot 10^{+63}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if y < 1.2199999999999999e63Initial program 99.0%
Taylor expanded in x around inf 69.2%
if 1.2199999999999999e63 < y Initial program 93.1%
Taylor expanded in t around 0 33.6%
sub-neg33.6%
+-commutative33.6%
neg-sub033.6%
associate--r-33.6%
Simplified67.3%
Taylor expanded in x around 0 64.8%
mul-1-neg64.8%
unsub-neg64.8%
Simplified64.8%
Final simplification68.2%
(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.7%
Taylor expanded in x around inf 63.8%
Final simplification63.8%
(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 2024071
(FPCore (x y z t)
:name "SynthBasics:moogVCF from YampaSynth-0.2"
:precision binary64
:alt
(+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y))))))
(+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))