
(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 13 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 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 92.6%
+-commutative92.6%
*-commutative92.6%
associate-*l*98.0%
fma-def98.0%
Simplified98.0%
Final simplification98.0%
(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}
Initial program 92.6%
associate-*l*97.1%
Simplified97.1%
Final simplification97.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -4.8e-83) (not (<= t 7.6e-53))) (fma z (* y (tanh (/ t y))) x) (+ x (* z (- t (* y (tanh (/ x y))))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.8e-83) || !(t <= 7.6e-53)) {
tmp = fma(z, (y * tanh((t / y))), x);
} else {
tmp = x + (z * (t - (y * tanh((x / y)))));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((t <= -4.8e-83) || !(t <= 7.6e-53)) tmp = fma(z, Float64(y * tanh(Float64(t / y))), x); else tmp = Float64(x + Float64(z * Float64(t - Float64(y * tanh(Float64(x / y)))))); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -4.8e-83], N[Not[LessEqual[t, 7.6e-53]], $MachinePrecision]], N[(z * N[(y * N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(x + N[(z * N[(t - N[(y * N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.8 \cdot 10^{-83} \lor \neg \left(t \leq 7.6 \cdot 10^{-53}\right):\\
\;\;\;\;\mathsf{fma}\left(z, y \cdot \tanh \left(\frac{t}{y}\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - y \cdot \tanh \left(\frac{x}{y}\right)\right)\\
\end{array}
\end{array}
if t < -4.8000000000000002e-83 or 7.5999999999999995e-53 < t Initial program 95.5%
+-commutative95.5%
*-commutative95.5%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in x around 0 14.4%
associate-/r*14.4%
div-sub14.5%
rec-exp14.5%
rec-exp14.5%
tanh-def-a92.6%
Simplified92.6%
if -4.8000000000000002e-83 < t < 7.5999999999999995e-53Initial program 88.5%
associate-*l*95.0%
Simplified95.0%
Taylor expanded in t around 0 91.2%
Taylor expanded in t around -inf 34.1%
+-commutative34.1%
mul-1-neg34.1%
unsub-neg34.1%
associate-*r*33.8%
*-commutative33.8%
Simplified85.6%
Taylor expanded in z around 0 34.1%
*-commutative34.1%
*-commutative34.1%
Simplified92.4%
Final simplification92.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.05e-83) (not (<= t 3.2e-45))) (+ x (* y (* z (tanh (/ t y))))) (+ x (* z (- t (* y (tanh (/ x y))))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.05e-83) || !(t <= 3.2e-45)) {
tmp = x + (y * (z * tanh((t / y))));
} else {
tmp = x + (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 <= (-1.05d-83)) .or. (.not. (t <= 3.2d-45))) then
tmp = x + (y * (z * tanh((t / y))))
else
tmp = x + (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 <= -1.05e-83) || !(t <= 3.2e-45)) {
tmp = x + (y * (z * Math.tanh((t / y))));
} else {
tmp = x + (z * (t - (y * Math.tanh((x / y)))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.05e-83) or not (t <= 3.2e-45): tmp = x + (y * (z * math.tanh((t / y)))) else: tmp = x + (z * (t - (y * math.tanh((x / y))))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.05e-83) || !(t <= 3.2e-45)) tmp = Float64(x + Float64(y * Float64(z * tanh(Float64(t / y))))); else tmp = Float64(x + Float64(z * Float64(t - Float64(y * tanh(Float64(x / y)))))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.05e-83) || ~((t <= 3.2e-45))) tmp = x + (y * (z * tanh((t / y)))); else tmp = x + (z * (t - (y * tanh((x / y))))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.05e-83], N[Not[LessEqual[t, 3.2e-45]], $MachinePrecision]], N[(x + N[(y * N[(z * N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(t - N[(y * N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.05 \cdot 10^{-83} \lor \neg \left(t \leq 3.2 \cdot 10^{-45}\right):\\
\;\;\;\;x + y \cdot \left(z \cdot \tanh \left(\frac{t}{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - y \cdot \tanh \left(\frac{x}{y}\right)\right)\\
\end{array}
\end{array}
if t < -1.0499999999999999e-83 or 3.20000000000000007e-45 < t Initial program 95.5%
associate-*l*98.6%
Simplified98.6%
Taylor expanded in x around 0 14.4%
associate-/r*14.4%
div-sub14.5%
rec-exp14.5%
rec-exp14.5%
tanh-def-a91.3%
Simplified91.3%
if -1.0499999999999999e-83 < t < 3.20000000000000007e-45Initial program 88.5%
associate-*l*95.0%
Simplified95.0%
Taylor expanded in t around 0 91.2%
Taylor expanded in t around -inf 34.1%
+-commutative34.1%
mul-1-neg34.1%
unsub-neg34.1%
associate-*r*33.8%
*-commutative33.8%
Simplified85.6%
Taylor expanded in z around 0 34.1%
*-commutative34.1%
*-commutative34.1%
Simplified92.4%
Final simplification91.8%
(FPCore (x y z t) :precision binary64 (if (or (<= t -4.5e-90) (not (<= t 2.55e-179))) (+ x (* y (* z (tanh (/ t y))))) (- (+ x (* z t)) (* z x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.5e-90) || !(t <= 2.55e-179)) {
tmp = x + (y * (z * tanh((t / y))));
} else {
tmp = (x + (z * t)) - (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) :: tmp
if ((t <= (-4.5d-90)) .or. (.not. (t <= 2.55d-179))) then
tmp = x + (y * (z * tanh((t / y))))
else
tmp = (x + (z * t)) - (z * x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.5e-90) || !(t <= 2.55e-179)) {
tmp = x + (y * (z * Math.tanh((t / y))));
} else {
tmp = (x + (z * t)) - (z * x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -4.5e-90) or not (t <= 2.55e-179): tmp = x + (y * (z * math.tanh((t / y)))) else: tmp = (x + (z * t)) - (z * x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -4.5e-90) || !(t <= 2.55e-179)) tmp = Float64(x + Float64(y * Float64(z * tanh(Float64(t / y))))); else tmp = Float64(Float64(x + Float64(z * t)) - Float64(z * x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -4.5e-90) || ~((t <= 2.55e-179))) tmp = x + (y * (z * tanh((t / y)))); else tmp = (x + (z * t)) - (z * x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -4.5e-90], N[Not[LessEqual[t, 2.55e-179]], $MachinePrecision]], N[(x + N[(y * N[(z * N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(z * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.5 \cdot 10^{-90} \lor \neg \left(t \leq 2.55 \cdot 10^{-179}\right):\\
\;\;\;\;x + y \cdot \left(z \cdot \tanh \left(\frac{t}{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + z \cdot t\right) - z \cdot x\\
\end{array}
\end{array}
if t < -4.50000000000000009e-90 or 2.55000000000000014e-179 < t Initial program 95.2%
associate-*l*98.9%
Simplified98.9%
Taylor expanded in x around 0 21.1%
associate-/r*21.1%
div-sub21.1%
rec-exp21.1%
rec-exp21.1%
tanh-def-a89.6%
Simplified89.6%
if -4.50000000000000009e-90 < t < 2.55000000000000014e-179Initial program 86.4%
associate-*l*93.0%
Simplified93.0%
Taylor expanded in t around 0 91.4%
Taylor expanded in t around -inf 31.3%
+-commutative31.3%
mul-1-neg31.3%
unsub-neg31.3%
associate-*r*31.1%
*-commutative31.1%
Simplified86.0%
Taylor expanded in y around inf 88.2%
Final simplification89.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* z t))))
(if (<= y -3.2e-26)
t_1
(if (<= y 1.6e-61) x (if (<= y 3.8e+277) t_1 (- x (* z x)))))))
double code(double x, double y, double z, double t) {
double t_1 = x + (z * t);
double tmp;
if (y <= -3.2e-26) {
tmp = t_1;
} else if (y <= 1.6e-61) {
tmp = x;
} else if (y <= 3.8e+277) {
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 + (z * t)
if (y <= (-3.2d-26)) then
tmp = t_1
else if (y <= 1.6d-61) then
tmp = x
else if (y <= 3.8d+277) 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 + (z * t);
double tmp;
if (y <= -3.2e-26) {
tmp = t_1;
} else if (y <= 1.6e-61) {
tmp = x;
} else if (y <= 3.8e+277) {
tmp = t_1;
} else {
tmp = x - (z * x);
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (z * t) tmp = 0 if y <= -3.2e-26: tmp = t_1 elif y <= 1.6e-61: tmp = x elif y <= 3.8e+277: tmp = t_1 else: tmp = x - (z * x) return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(z * t)) tmp = 0.0 if (y <= -3.2e-26) tmp = t_1; elseif (y <= 1.6e-61) tmp = x; elseif (y <= 3.8e+277) 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 + (z * t); tmp = 0.0; if (y <= -3.2e-26) tmp = t_1; elseif (y <= 1.6e-61) tmp = x; elseif (y <= 3.8e+277) 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[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.2e-26], t$95$1, If[LessEqual[y, 1.6e-61], x, If[LessEqual[y, 3.8e+277], t$95$1, N[(x - N[(z * x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + z \cdot t\\
\mathbf{if}\;y \leq -3.2 \cdot 10^{-26}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{-61}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{+277}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot x\\
\end{array}
\end{array}
if y < -3.2000000000000001e-26 or 1.6000000000000001e-61 < y < 3.80000000000000005e277Initial program 88.4%
+-commutative88.4%
*-commutative88.4%
associate-*l*97.3%
fma-def97.3%
Simplified97.3%
Taylor expanded in y around inf 80.0%
Taylor expanded in t around inf 69.1%
if -3.2000000000000001e-26 < y < 1.6000000000000001e-61Initial program 100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in x around inf 83.6%
if 3.80000000000000005e277 < y Initial program 87.0%
+-commutative87.0%
*-commutative87.0%
associate-*l*87.0%
fma-def87.0%
Simplified87.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in t around 0 100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
Final simplification75.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -7.5e-40) (not (<= y 2.15e-61))) (+ x (* z (- t x))) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.5e-40) || !(y <= 2.15e-61)) {
tmp = x + (z * (t - x));
} 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 ((y <= (-7.5d-40)) .or. (.not. (y <= 2.15d-61))) then
tmp = x + (z * (t - x))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.5e-40) || !(y <= 2.15e-61)) {
tmp = x + (z * (t - x));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -7.5e-40) or not (y <= 2.15e-61): tmp = x + (z * (t - x)) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -7.5e-40) || !(y <= 2.15e-61)) tmp = Float64(x + Float64(z * Float64(t - x))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -7.5e-40) || ~((y <= 2.15e-61))) tmp = x + (z * (t - x)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -7.5e-40], N[Not[LessEqual[y, 2.15e-61]], $MachinePrecision]], N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{-40} \lor \neg \left(y \leq 2.15 \cdot 10^{-61}\right):\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -7.50000000000000069e-40 or 2.1500000000000002e-61 < y Initial program 88.5%
+-commutative88.5%
*-commutative88.5%
associate-*l*96.9%
fma-def96.9%
Simplified96.9%
Taylor expanded in y around inf 80.0%
if -7.50000000000000069e-40 < y < 2.1500000000000002e-61Initial program 100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in x around inf 85.3%
Final simplification81.9%
(FPCore (x y z t) :precision binary64 (if (<= y -6.8e-38) (- (+ x (* z t)) (* z x)) (if (<= y 1.1e-61) x (+ x (* z (- t x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -6.8e-38) {
tmp = (x + (z * t)) - (z * x);
} else if (y <= 1.1e-61) {
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.8d-38)) then
tmp = (x + (z * t)) - (z * x)
else if (y <= 1.1d-61) 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.8e-38) {
tmp = (x + (z * t)) - (z * x);
} else if (y <= 1.1e-61) {
tmp = x;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -6.8e-38: tmp = (x + (z * t)) - (z * x) elif y <= 1.1e-61: tmp = x else: tmp = x + (z * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -6.8e-38) tmp = Float64(Float64(x + Float64(z * t)) - Float64(z * x)); elseif (y <= 1.1e-61) 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.8e-38) tmp = (x + (z * t)) - (z * x); elseif (y <= 1.1e-61) tmp = x; else tmp = x + (z * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -6.8e-38], N[(N[(x + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(z * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.1e-61], x, N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.8 \cdot 10^{-38}:\\
\;\;\;\;\left(x + z \cdot t\right) - z \cdot x\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{-61}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < -6.8000000000000004e-38Initial program 84.4%
associate-*l*93.5%
Simplified93.5%
Taylor expanded in t around 0 76.5%
Taylor expanded in t around -inf 49.6%
+-commutative49.6%
mul-1-neg49.6%
unsub-neg49.6%
associate-*r*41.7%
*-commutative41.7%
Simplified67.1%
Taylor expanded in y around inf 79.3%
if -6.8000000000000004e-38 < y < 1.10000000000000004e-61Initial program 100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in x around inf 85.3%
if 1.10000000000000004e-61 < y Initial program 92.3%
+-commutative92.3%
*-commutative92.3%
associate-*l*98.6%
fma-def98.6%
Simplified98.6%
Taylor expanded in y around inf 80.6%
Final simplification81.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.2e+74) (not (<= z 8.2e+27))) (* z (- t x)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.2e+74) || !(z <= 8.2e+27)) {
tmp = z * (t - x);
} 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 ((z <= (-1.2d+74)) .or. (.not. (z <= 8.2d+27))) then
tmp = z * (t - x)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.2e+74) || !(z <= 8.2e+27)) {
tmp = z * (t - x);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.2e+74) or not (z <= 8.2e+27): tmp = z * (t - x) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.2e+74) || !(z <= 8.2e+27)) tmp = Float64(z * Float64(t - x)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.2e+74) || ~((z <= 8.2e+27))) tmp = z * (t - x); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.2e+74], N[Not[LessEqual[z, 8.2e+27]], $MachinePrecision]], N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+74} \lor \neg \left(z \leq 8.2 \cdot 10^{+27}\right):\\
\;\;\;\;z \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.20000000000000004e74 or 8.2000000000000005e27 < z Initial program 82.3%
+-commutative82.3%
*-commutative82.3%
associate-*l*96.7%
fma-def96.7%
Simplified96.7%
Taylor expanded in y around inf 56.1%
Taylor expanded in z around inf 56.1%
if -1.20000000000000004e74 < z < 8.2000000000000005e27Initial program 98.8%
associate-*l*97.4%
Simplified97.4%
Taylor expanded in x around inf 80.0%
Final simplification71.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.2e-27) (not (<= y 7e-62))) (+ x (* z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.2e-27) || !(y <= 7e-62)) {
tmp = x + (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 ((y <= (-2.2d-27)) .or. (.not. (y <= 7d-62))) then
tmp = x + (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 ((y <= -2.2e-27) || !(y <= 7e-62)) {
tmp = x + (z * t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.2e-27) or not (y <= 7e-62): tmp = x + (z * t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.2e-27) || !(y <= 7e-62)) tmp = Float64(x + Float64(z * t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.2e-27) || ~((y <= 7e-62))) tmp = x + (z * t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.2e-27], N[Not[LessEqual[y, 7e-62]], $MachinePrecision]], N[(x + N[(z * t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.2 \cdot 10^{-27} \lor \neg \left(y \leq 7 \cdot 10^{-62}\right):\\
\;\;\;\;x + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.19999999999999987e-27 or 7.0000000000000003e-62 < y Initial program 88.3%
+-commutative88.3%
*-commutative88.3%
associate-*l*96.9%
fma-def96.9%
Simplified96.9%
Taylor expanded in y around inf 80.9%
Taylor expanded in t around inf 67.6%
if -2.19999999999999987e-27 < y < 7.0000000000000003e-62Initial program 100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in x around inf 83.6%
Final simplification73.4%
(FPCore (x y z t) :precision binary64 (if (<= y 2.3e+192) x (if (<= y 3.2e+277) (* z t) (* z (- x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.3e+192) {
tmp = x;
} else if (y <= 3.2e+277) {
tmp = z * t;
} else {
tmp = 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) :: tmp
if (y <= 2.3d+192) then
tmp = x
else if (y <= 3.2d+277) then
tmp = z * t
else
tmp = z * -x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.3e+192) {
tmp = x;
} else if (y <= 3.2e+277) {
tmp = z * t;
} else {
tmp = z * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 2.3e+192: tmp = x elif y <= 3.2e+277: tmp = z * t else: tmp = z * -x return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 2.3e+192) tmp = x; elseif (y <= 3.2e+277) tmp = Float64(z * t); else tmp = Float64(z * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 2.3e+192) tmp = x; elseif (y <= 3.2e+277) tmp = z * t; else tmp = z * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 2.3e+192], x, If[LessEqual[y, 3.2e+277], N[(z * t), $MachinePrecision], N[(z * (-x)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.3 \cdot 10^{+192}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 3.2 \cdot 10^{+277}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-x\right)\\
\end{array}
\end{array}
if y < 2.2999999999999999e192Initial program 93.0%
associate-*l*97.7%
Simplified97.7%
Taylor expanded in x around inf 61.6%
if 2.2999999999999999e192 < y < 3.2000000000000002e277Initial program 90.3%
+-commutative90.3%
*-commutative90.3%
associate-*l*99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in y around inf 95.6%
Taylor expanded in z around inf 71.6%
Taylor expanded in t around inf 61.7%
if 3.2000000000000002e277 < y Initial program 87.0%
+-commutative87.0%
*-commutative87.0%
associate-*l*87.0%
fma-def87.0%
Simplified87.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in z around inf 86.7%
Taylor expanded in t around 0 86.7%
mul-1-neg86.7%
distribute-rgt-neg-in86.7%
Simplified86.7%
Final simplification62.3%
(FPCore (x y z t) :precision binary64 (if (<= y 9.8e+191) x (* z t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 9.8e+191) {
tmp = x;
} else {
tmp = 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 <= 9.8d+191) then
tmp = x
else
tmp = z * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 9.8e+191) {
tmp = x;
} else {
tmp = z * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 9.8e+191: tmp = x else: tmp = z * t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 9.8e+191) tmp = x; else tmp = Float64(z * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 9.8e+191) tmp = x; else tmp = z * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 9.8e+191], x, N[(z * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9.8 \cdot 10^{+191}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if y < 9.7999999999999999e191Initial program 93.0%
associate-*l*97.7%
Simplified97.7%
Taylor expanded in x around inf 61.6%
if 9.7999999999999999e191 < y Initial program 89.4%
+-commutative89.4%
*-commutative89.4%
associate-*l*96.4%
fma-def96.4%
Simplified96.4%
Taylor expanded in y around inf 96.7%
Taylor expanded in z around inf 75.5%
Taylor expanded in t around inf 50.1%
Final simplification60.4%
(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 92.6%
associate-*l*97.1%
Simplified97.1%
Taylor expanded in x around inf 57.7%
Final simplification57.7%
(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 2023174
(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))))))