
(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}
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 1.02e+179) (+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y)))))) (fma z (- t x) x)))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.02e+179) {
tmp = x + (y * (z * (tanh((t / y)) - tanh((x / y)))));
} else {
tmp = fma(z, (t - x), x);
}
return tmp;
}
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 1.02e+179) tmp = Float64(x + Float64(y * Float64(z * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))))); else tmp = fma(z, Float64(t - x), x); end return tmp end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 1.02e+179], 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], N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.02 \cdot 10^{+179}:\\
\;\;\;\;x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\
\end{array}
\end{array}
if y < 1.0199999999999999e179Initial program 95.1%
associate-*l*96.3%
Simplified96.3%
if 1.0199999999999999e179 < y Initial program 80.6%
associate-*l*88.0%
Simplified88.0%
Taylor expanded in y around inf 99.9%
+-commutative99.9%
fma-def100.0%
Simplified100.0%
Final simplification96.7%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (fma z (* y (- (tanh (/ t y)) (tanh (/ x y)))) x))
y = abs(y);
double code(double x, double y, double z, double t) {
return fma(z, (y * (tanh((t / y)) - tanh((x / y)))), x);
}
y = abs(y) function code(x, y, z, t) return fma(z, Float64(y * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))), x) end
NOTE: y should be positive before calling this function 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}
y = |y|\\
\\
\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 93.7%
+-commutative93.7%
*-commutative93.7%
associate-*l*97.1%
fma-def97.1%
Simplified97.1%
Final simplification97.1%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (or (<= t -1.95e-126) (not (<= t 1.4e-66))) (fma z (* y (tanh (/ t y))) x) (+ x (* y (* z (- (/ t y) (tanh (/ x y))))))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.95e-126) || !(t <= 1.4e-66)) {
tmp = fma(z, (y * tanh((t / y))), x);
} else {
tmp = x + (y * (z * ((t / y) - tanh((x / y)))));
}
return tmp;
}
y = abs(y) function code(x, y, z, t) tmp = 0.0 if ((t <= -1.95e-126) || !(t <= 1.4e-66)) tmp = fma(z, Float64(y * tanh(Float64(t / y))), x); else tmp = Float64(x + Float64(y * Float64(z * Float64(Float64(t / y) - tanh(Float64(x / y)))))); end return tmp end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.95e-126], N[Not[LessEqual[t, 1.4e-66]], $MachinePrecision]], N[(z * N[(y * N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(x + N[(y * N[(z * N[(N[(t / y), $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.95 \cdot 10^{-126} \lor \neg \left(t \leq 1.4 \cdot 10^{-66}\right):\\
\;\;\;\;\mathsf{fma}\left(z, y \cdot \tanh \left(\frac{t}{y}\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(z \cdot \left(\frac{t}{y} - \tanh \left(\frac{x}{y}\right)\right)\right)\\
\end{array}
\end{array}
if t < -1.9499999999999999e-126 or 1.4e-66 < t Initial program 97.7%
+-commutative97.7%
*-commutative97.7%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in x around 0 13.1%
associate-/r*13.1%
div-sub13.1%
rec-exp13.1%
rec-exp13.1%
tanh-def-a93.5%
Simplified93.5%
if -1.9499999999999999e-126 < t < 1.4e-66Initial program 86.7%
associate-*l*91.2%
Simplified91.2%
Taylor expanded in t around 0 88.1%
Final simplification91.5%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (or (<= t -2.7e-54) (not (<= t 2.9e-63))) (+ x (* (tanh (/ t y)) (* z y))) (+ x (* y (* z (- (/ t y) (tanh (/ x y))))))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.7e-54) || !(t <= 2.9e-63)) {
tmp = x + (tanh((t / y)) * (z * y));
} else {
tmp = x + (y * (z * ((t / y) - tanh((x / y)))));
}
return tmp;
}
NOTE: y should be positive before calling this function
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 <= (-2.7d-54)) .or. (.not. (t <= 2.9d-63))) then
tmp = x + (tanh((t / y)) * (z * y))
else
tmp = x + (y * (z * ((t / y) - tanh((x / y)))))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.7e-54) || !(t <= 2.9e-63)) {
tmp = x + (Math.tanh((t / y)) * (z * y));
} else {
tmp = x + (y * (z * ((t / y) - Math.tanh((x / y)))));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if (t <= -2.7e-54) or not (t <= 2.9e-63): tmp = x + (math.tanh((t / y)) * (z * y)) else: tmp = x + (y * (z * ((t / y) - math.tanh((x / y))))) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if ((t <= -2.7e-54) || !(t <= 2.9e-63)) tmp = Float64(x + Float64(tanh(Float64(t / y)) * Float64(z * y))); else tmp = Float64(x + Float64(y * Float64(z * Float64(Float64(t / y) - tanh(Float64(x / y)))))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.7e-54) || ~((t <= 2.9e-63))) tmp = x + (tanh((t / y)) * (z * y)); else tmp = x + (y * (z * ((t / y) - tanh((x / y))))); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.7e-54], N[Not[LessEqual[t, 2.9e-63]], $MachinePrecision]], N[(x + N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z * N[(N[(t / y), $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.7 \cdot 10^{-54} \lor \neg \left(t \leq 2.9 \cdot 10^{-63}\right):\\
\;\;\;\;x + \tanh \left(\frac{t}{y}\right) \cdot \left(z \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(z \cdot \left(\frac{t}{y} - \tanh \left(\frac{x}{y}\right)\right)\right)\\
\end{array}
\end{array}
if t < -2.70000000000000026e-54 or 2.89999999999999975e-63 < t Initial program 98.2%
associate-*l*97.9%
Simplified97.9%
Taylor expanded in x around 0 13.1%
*-commutative13.1%
associate-*r*13.0%
associate-/r*13.0%
div-sub13.0%
rec-exp13.0%
rec-exp13.0%
Simplified92.4%
if -2.70000000000000026e-54 < t < 2.89999999999999975e-63Initial program 86.9%
associate-*l*92.0%
Simplified92.0%
Taylor expanded in t around 0 87.3%
Final simplification90.4%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (or (<= t -2.9e-127) (not (<= t 1.35e-68))) (+ x (* (tanh (/ t y)) (* z y))) (+ x (- (* z t) (* z x)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.9e-127) || !(t <= 1.35e-68)) {
tmp = x + (tanh((t / y)) * (z * y));
} else {
tmp = x + ((z * t) - (z * x));
}
return tmp;
}
NOTE: y should be positive before calling this function
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 <= (-2.9d-127)) .or. (.not. (t <= 1.35d-68))) then
tmp = x + (tanh((t / y)) * (z * y))
else
tmp = x + ((z * t) - (z * x))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.9e-127) || !(t <= 1.35e-68)) {
tmp = x + (Math.tanh((t / y)) * (z * y));
} else {
tmp = x + ((z * t) - (z * x));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if (t <= -2.9e-127) or not (t <= 1.35e-68): tmp = x + (math.tanh((t / y)) * (z * y)) else: tmp = x + ((z * t) - (z * x)) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if ((t <= -2.9e-127) || !(t <= 1.35e-68)) tmp = Float64(x + Float64(tanh(Float64(t / y)) * Float64(z * y))); else tmp = Float64(x + Float64(Float64(z * t) - Float64(z * x))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.9e-127) || ~((t <= 1.35e-68))) tmp = x + (tanh((t / y)) * (z * y)); else tmp = x + ((z * t) - (z * x)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.9e-127], N[Not[LessEqual[t, 1.35e-68]], $MachinePrecision]], N[(x + N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z * t), $MachinePrecision] - N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.9 \cdot 10^{-127} \lor \neg \left(t \leq 1.35 \cdot 10^{-68}\right):\\
\;\;\;\;x + \tanh \left(\frac{t}{y}\right) \cdot \left(z \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(z \cdot t - z \cdot x\right)\\
\end{array}
\end{array}
if t < -2.9e-127 or 1.3500000000000001e-68 < t Initial program 97.7%
associate-*l*98.0%
Simplified98.0%
Taylor expanded in x around 0 13.1%
*-commutative13.1%
associate-*r*12.9%
associate-/r*12.9%
div-sub12.9%
rec-exp13.0%
rec-exp13.0%
Simplified91.1%
if -2.9e-127 < t < 1.3500000000000001e-68Initial program 86.7%
+-commutative86.7%
*-commutative86.7%
associate-*l*92.0%
fma-def92.0%
Simplified92.0%
Taylor expanded in y around inf 79.8%
Taylor expanded in t around 0 79.9%
Final simplification87.1%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 1.46e-93) x (fma z (- t x) x)))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.46e-93) {
tmp = x;
} else {
tmp = fma(z, (t - x), x);
}
return tmp;
}
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 1.46e-93) tmp = x; else tmp = fma(z, Float64(t - x), x); end return tmp end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 1.46e-93], x, N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.46 \cdot 10^{-93}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\
\end{array}
\end{array}
if y < 1.45999999999999999e-93Initial program 95.1%
associate-*l*96.5%
Simplified96.5%
Taylor expanded in x around inf 62.3%
if 1.45999999999999999e-93 < y Initial program 90.6%
associate-*l*93.5%
Simplified93.5%
Taylor expanded in y around inf 81.1%
+-commutative81.1%
fma-def81.1%
Simplified81.1%
Final simplification68.2%
NOTE: y should be positive before calling this function
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 z))))
(if (<= y 6.8e-109)
x
(if (<= y 4.6e+21)
t_1
(if (<= y 8.2e+58)
x
(if (or (<= y 2.3e+78) (not (<= y 4.1e+86))) (+ x (* z t)) t_1))))))y = abs(y);
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - z);
double tmp;
if (y <= 6.8e-109) {
tmp = x;
} else if (y <= 4.6e+21) {
tmp = t_1;
} else if (y <= 8.2e+58) {
tmp = x;
} else if ((y <= 2.3e+78) || !(y <= 4.1e+86)) {
tmp = x + (z * t);
} else {
tmp = t_1;
}
return tmp;
}
NOTE: y should be positive before calling this function
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 * (1.0d0 - z)
if (y <= 6.8d-109) then
tmp = x
else if (y <= 4.6d+21) then
tmp = t_1
else if (y <= 8.2d+58) then
tmp = x
else if ((y <= 2.3d+78) .or. (.not. (y <= 4.1d+86))) then
tmp = x + (z * t)
else
tmp = t_1
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - z);
double tmp;
if (y <= 6.8e-109) {
tmp = x;
} else if (y <= 4.6e+21) {
tmp = t_1;
} else if (y <= 8.2e+58) {
tmp = x;
} else if ((y <= 2.3e+78) || !(y <= 4.1e+86)) {
tmp = x + (z * t);
} else {
tmp = t_1;
}
return tmp;
}
y = abs(y) def code(x, y, z, t): t_1 = x * (1.0 - z) tmp = 0 if y <= 6.8e-109: tmp = x elif y <= 4.6e+21: tmp = t_1 elif y <= 8.2e+58: tmp = x elif (y <= 2.3e+78) or not (y <= 4.1e+86): tmp = x + (z * t) else: tmp = t_1 return tmp
y = abs(y) function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - z)) tmp = 0.0 if (y <= 6.8e-109) tmp = x; elseif (y <= 4.6e+21) tmp = t_1; elseif (y <= 8.2e+58) tmp = x; elseif ((y <= 2.3e+78) || !(y <= 4.1e+86)) tmp = Float64(x + Float64(z * t)); else tmp = t_1; end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - z); tmp = 0.0; if (y <= 6.8e-109) tmp = x; elseif (y <= 4.6e+21) tmp = t_1; elseif (y <= 8.2e+58) tmp = x; elseif ((y <= 2.3e+78) || ~((y <= 4.1e+86))) tmp = x + (z * t); else tmp = t_1; end tmp_2 = tmp; end
NOTE: y should be positive before calling this function
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 6.8e-109], x, If[LessEqual[y, 4.6e+21], t$95$1, If[LessEqual[y, 8.2e+58], x, If[Or[LessEqual[y, 2.3e+78], N[Not[LessEqual[y, 4.1e+86]], $MachinePrecision]], N[(x + N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - z\right)\\
\mathbf{if}\;y \leq 6.8 \cdot 10^{-109}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 4.6 \cdot 10^{+21}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{+58}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{+78} \lor \neg \left(y \leq 4.1 \cdot 10^{+86}\right):\\
\;\;\;\;x + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < 6.80000000000000023e-109 or 4.6e21 < y < 8.2e58Initial program 95.3%
associate-*l*96.6%
Simplified96.6%
Taylor expanded in x around inf 63.4%
if 6.80000000000000023e-109 < y < 4.6e21 or 2.3000000000000002e78 < y < 4.0999999999999999e86Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
associate-*l*99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in y around inf 69.5%
Taylor expanded in t around 0 72.4%
associate-*r*72.4%
*-lft-identity72.4%
distribute-rgt-in72.4%
+-commutative72.4%
mul-1-neg72.4%
unsub-neg72.4%
Simplified72.4%
if 8.2e58 < y < 2.3000000000000002e78 or 4.0999999999999999e86 < y Initial program 83.0%
associate-*l*88.3%
Simplified88.3%
Taylor expanded in x around 0 31.5%
*-commutative31.5%
associate-*r*30.6%
associate-/r*30.6%
div-sub30.6%
rec-exp30.6%
rec-exp30.6%
Simplified69.2%
Taylor expanded in y around inf 69.8%
Final simplification65.6%
NOTE: y should be positive before calling this function
(FPCore (x y z t)
:precision binary64
(if (<= x -6.6e-32)
x
(if (<= x -4.8e-61)
(* z (- x))
(if (<= x -5e-207) x (if (<= x 4.5e-190) (* z t) x)))))y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6.6e-32) {
tmp = x;
} else if (x <= -4.8e-61) {
tmp = z * -x;
} else if (x <= -5e-207) {
tmp = x;
} else if (x <= 4.5e-190) {
tmp = z * t;
} else {
tmp = x;
}
return tmp;
}
NOTE: y should be positive before calling this function
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 <= (-6.6d-32)) then
tmp = x
else if (x <= (-4.8d-61)) then
tmp = z * -x
else if (x <= (-5d-207)) then
tmp = x
else if (x <= 4.5d-190) then
tmp = z * t
else
tmp = x
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6.6e-32) {
tmp = x;
} else if (x <= -4.8e-61) {
tmp = z * -x;
} else if (x <= -5e-207) {
tmp = x;
} else if (x <= 4.5e-190) {
tmp = z * t;
} else {
tmp = x;
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if x <= -6.6e-32: tmp = x elif x <= -4.8e-61: tmp = z * -x elif x <= -5e-207: tmp = x elif x <= 4.5e-190: tmp = z * t else: tmp = x return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (x <= -6.6e-32) tmp = x; elseif (x <= -4.8e-61) tmp = Float64(z * Float64(-x)); elseif (x <= -5e-207) tmp = x; elseif (x <= 4.5e-190) tmp = Float64(z * t); else tmp = x; end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -6.6e-32) tmp = x; elseif (x <= -4.8e-61) tmp = z * -x; elseif (x <= -5e-207) tmp = x; elseif (x <= 4.5e-190) tmp = z * t; else tmp = x; end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[x, -6.6e-32], x, If[LessEqual[x, -4.8e-61], N[(z * (-x)), $MachinePrecision], If[LessEqual[x, -5e-207], x, If[LessEqual[x, 4.5e-190], N[(z * t), $MachinePrecision], x]]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.6 \cdot 10^{-32}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -4.8 \cdot 10^{-61}:\\
\;\;\;\;z \cdot \left(-x\right)\\
\mathbf{elif}\;x \leq -5 \cdot 10^{-207}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-190}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -6.60000000000000051e-32 or -4.8000000000000002e-61 < x < -5.00000000000000014e-207 or 4.50000000000000021e-190 < x Initial program 96.6%
associate-*l*99.0%
Simplified99.0%
Taylor expanded in x around inf 69.5%
if -6.60000000000000051e-32 < x < -4.8000000000000002e-61Initial program 89.0%
+-commutative89.0%
*-commutative89.0%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in y around inf 68.3%
Taylor expanded in z around inf 68.3%
Taylor expanded in t around 0 57.2%
associate-*r*57.2%
mul-1-neg57.2%
Simplified57.2%
if -5.00000000000000014e-207 < x < 4.50000000000000021e-190Initial program 83.8%
+-commutative83.8%
*-commutative83.8%
associate-*l*89.4%
fma-def89.4%
Simplified89.4%
Taylor expanded in y around inf 59.4%
Taylor expanded in t around inf 47.4%
Final simplification64.6%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 6.8e-109) x (if (or (<= y 9.8e+208) (not (<= y 1.7e+274))) (* x (- 1.0 z)) (* z t))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 6.8e-109) {
tmp = x;
} else if ((y <= 9.8e+208) || !(y <= 1.7e+274)) {
tmp = x * (1.0 - z);
} else {
tmp = z * t;
}
return tmp;
}
NOTE: y should be positive before calling this function
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-109) then
tmp = x
else if ((y <= 9.8d+208) .or. (.not. (y <= 1.7d+274))) then
tmp = x * (1.0d0 - z)
else
tmp = z * t
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 6.8e-109) {
tmp = x;
} else if ((y <= 9.8e+208) || !(y <= 1.7e+274)) {
tmp = x * (1.0 - z);
} else {
tmp = z * t;
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 6.8e-109: tmp = x elif (y <= 9.8e+208) or not (y <= 1.7e+274): tmp = x * (1.0 - z) else: tmp = z * t return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 6.8e-109) tmp = x; elseif ((y <= 9.8e+208) || !(y <= 1.7e+274)) tmp = Float64(x * Float64(1.0 - z)); else tmp = Float64(z * t); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 6.8e-109) tmp = x; elseif ((y <= 9.8e+208) || ~((y <= 1.7e+274))) tmp = x * (1.0 - z); else tmp = z * t; end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 6.8e-109], x, If[Or[LessEqual[y, 9.8e+208], N[Not[LessEqual[y, 1.7e+274]], $MachinePrecision]], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(z * t), $MachinePrecision]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.8 \cdot 10^{-109}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 9.8 \cdot 10^{+208} \lor \neg \left(y \leq 1.7 \cdot 10^{+274}\right):\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if y < 6.80000000000000023e-109Initial program 95.0%
associate-*l*96.4%
Simplified96.4%
Taylor expanded in x around inf 62.3%
if 6.80000000000000023e-109 < y < 9.79999999999999918e208 or 1.7e274 < y Initial program 92.3%
+-commutative92.3%
*-commutative92.3%
associate-*l*94.8%
fma-def94.8%
Simplified94.8%
Taylor expanded in y around inf 77.0%
Taylor expanded in t around 0 63.9%
associate-*r*63.9%
*-lft-identity63.9%
distribute-rgt-in63.9%
+-commutative63.9%
mul-1-neg63.9%
unsub-neg63.9%
Simplified63.9%
if 9.79999999999999918e208 < y < 1.7e274Initial program 79.5%
+-commutative79.5%
*-commutative79.5%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in t around inf 56.4%
Final simplification62.5%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (or (<= z -4e+63) (not (<= z 3.4e+166))) (* z (- t x)) x))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4e+63) || !(z <= 3.4e+166)) {
tmp = z * (t - x);
} else {
tmp = x;
}
return tmp;
}
NOTE: y should be positive before calling this function
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 <= (-4d+63)) .or. (.not. (z <= 3.4d+166))) then
tmp = z * (t - x)
else
tmp = x
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4e+63) || !(z <= 3.4e+166)) {
tmp = z * (t - x);
} else {
tmp = x;
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if (z <= -4e+63) or not (z <= 3.4e+166): tmp = z * (t - x) else: tmp = x return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if ((z <= -4e+63) || !(z <= 3.4e+166)) tmp = Float64(z * Float64(t - x)); else tmp = x; end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4e+63) || ~((z <= 3.4e+166))) tmp = z * (t - x); else tmp = x; end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4e+63], N[Not[LessEqual[z, 3.4e+166]], $MachinePrecision]], N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{+63} \lor \neg \left(z \leq 3.4 \cdot 10^{+166}\right):\\
\;\;\;\;z \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.00000000000000023e63 or 3.4e166 < z Initial program 85.3%
+-commutative85.3%
*-commutative85.3%
associate-*l*94.1%
fma-def94.1%
Simplified94.1%
Taylor expanded in y around inf 60.4%
Taylor expanded in z around inf 60.4%
if -4.00000000000000023e63 < z < 3.4e166Initial program 96.6%
associate-*l*96.1%
Simplified96.1%
Taylor expanded in x around inf 67.5%
Final simplification65.7%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 1.4e-93) x (+ x (* z (- t x)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.4e-93) {
tmp = x;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
NOTE: y should be positive before calling this function
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.4d-93) then
tmp = x
else
tmp = x + (z * (t - x))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.4e-93) {
tmp = x;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 1.4e-93: tmp = x else: tmp = x + (z * (t - x)) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 1.4e-93) tmp = x; else tmp = Float64(x + Float64(z * Float64(t - x))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 1.4e-93) tmp = x; else tmp = x + (z * (t - x)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 1.4e-93], x, N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.4 \cdot 10^{-93}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 1.39999999999999999e-93Initial program 95.1%
associate-*l*96.5%
Simplified96.5%
Taylor expanded in x around inf 62.3%
if 1.39999999999999999e-93 < y Initial program 90.6%
+-commutative90.6%
*-commutative90.6%
associate-*l*95.2%
fma-def95.2%
Simplified95.2%
Taylor expanded in y around inf 81.1%
Final simplification68.2%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= x -7.8e-208) x (if (<= x 7e-189) (* z t) x)))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.8e-208) {
tmp = x;
} else if (x <= 7e-189) {
tmp = z * t;
} else {
tmp = x;
}
return tmp;
}
NOTE: y should be positive before calling this function
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 <= (-7.8d-208)) then
tmp = x
else if (x <= 7d-189) then
tmp = z * t
else
tmp = x
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.8e-208) {
tmp = x;
} else if (x <= 7e-189) {
tmp = z * t;
} else {
tmp = x;
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if x <= -7.8e-208: tmp = x elif x <= 7e-189: tmp = z * t else: tmp = x return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (x <= -7.8e-208) tmp = x; elseif (x <= 7e-189) tmp = Float64(z * t); else tmp = x; end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -7.8e-208) tmp = x; elseif (x <= 7e-189) tmp = z * t; else tmp = x; end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[x, -7.8e-208], x, If[LessEqual[x, 7e-189], N[(z * t), $MachinePrecision], x]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.8 \cdot 10^{-208}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 7 \cdot 10^{-189}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -7.80000000000000007e-208 or 7.0000000000000003e-189 < x Initial program 96.2%
associate-*l*99.0%
Simplified99.0%
Taylor expanded in x around inf 66.5%
if -7.80000000000000007e-208 < x < 7.0000000000000003e-189Initial program 83.8%
+-commutative83.8%
*-commutative83.8%
associate-*l*89.4%
fma-def89.4%
Simplified89.4%
Taylor expanded in y around inf 59.4%
Taylor expanded in t around inf 47.4%
Final simplification62.6%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 x)
y = abs(y);
double code(double x, double y, double z, double t) {
return x;
}
NOTE: y should be positive before calling this function
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
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
return x;
}
y = abs(y) def code(x, y, z, t): return x
y = abs(y) function code(x, y, z, t) return x end
y = abs(y) function tmp = code(x, y, z, t) tmp = x; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := x
\begin{array}{l}
y = |y|\\
\\
x
\end{array}
Initial program 93.7%
associate-*l*95.5%
Simplified95.5%
Taylor expanded in x around inf 57.1%
Final simplification57.1%
(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 2023222
(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))))))