
(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 11 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}
y_m = (fabs.f64 y)
(FPCore (x y_m z t)
:precision binary64
(let* ((t_1 (tanh (/ t y_m))))
(if (<= y_m 7.8e+130)
(fma y_m (* z (- t_1 (tanh (/ x y_m)))) x)
(+ x (* z (- (* y_m t_1) x))))))y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double t_1 = tanh((t / y_m));
double tmp;
if (y_m <= 7.8e+130) {
tmp = fma(y_m, (z * (t_1 - tanh((x / y_m)))), x);
} else {
tmp = x + (z * ((y_m * t_1) - x));
}
return tmp;
}
y_m = abs(y) function code(x, y_m, z, t) t_1 = tanh(Float64(t / y_m)) tmp = 0.0 if (y_m <= 7.8e+130) tmp = fma(y_m, Float64(z * Float64(t_1 - tanh(Float64(x / y_m)))), x); else tmp = Float64(x + Float64(z * Float64(Float64(y_m * t_1) - x))); end return tmp end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_, t_] := Block[{t$95$1 = N[Tanh[N[(t / y$95$m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$95$m, 7.8e+130], N[(y$95$m * N[(z * N[(t$95$1 - N[Tanh[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(x + N[(z * N[(N[(y$95$m * t$95$1), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_1 := \tanh \left(\frac{t}{y\_m}\right)\\
\mathbf{if}\;y\_m \leq 7.8 \cdot 10^{+130}:\\
\;\;\;\;\mathsf{fma}\left(y\_m, z \cdot \left(t\_1 - \tanh \left(\frac{x}{y\_m}\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y\_m \cdot t\_1 - x\right)\\
\end{array}
\end{array}
if y < 7.8000000000000004e130Initial program 94.3%
+-commutative94.3%
associate-*l*97.8%
fma-define97.8%
Simplified97.8%
if 7.8000000000000004e130 < y Initial program 75.6%
Taylor expanded in x around 0 59.0%
+-commutative59.0%
Simplified92.2%
Final simplification97.0%
y_m = (fabs.f64 y)
(FPCore (x y_m z t)
:precision binary64
(let* ((t_1 (tanh (/ t y_m))))
(if (<= y_m 4.5e+129)
(+ x (* (- t_1 (tanh (/ x y_m))) (* y_m z)))
(+ x (* z (- (* y_m t_1) x))))))y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double t_1 = tanh((t / y_m));
double tmp;
if (y_m <= 4.5e+129) {
tmp = x + ((t_1 - tanh((x / y_m))) * (y_m * z));
} else {
tmp = x + (z * ((y_m * t_1) - x));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = tanh((t / y_m))
if (y_m <= 4.5d+129) then
tmp = x + ((t_1 - tanh((x / y_m))) * (y_m * z))
else
tmp = x + (z * ((y_m * t_1) - x))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
double t_1 = Math.tanh((t / y_m));
double tmp;
if (y_m <= 4.5e+129) {
tmp = x + ((t_1 - Math.tanh((x / y_m))) * (y_m * z));
} else {
tmp = x + (z * ((y_m * t_1) - x));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z, t): t_1 = math.tanh((t / y_m)) tmp = 0 if y_m <= 4.5e+129: tmp = x + ((t_1 - math.tanh((x / y_m))) * (y_m * z)) else: tmp = x + (z * ((y_m * t_1) - x)) return tmp
y_m = abs(y) function code(x, y_m, z, t) t_1 = tanh(Float64(t / y_m)) tmp = 0.0 if (y_m <= 4.5e+129) tmp = Float64(x + Float64(Float64(t_1 - tanh(Float64(x / y_m))) * Float64(y_m * z))); else tmp = Float64(x + Float64(z * Float64(Float64(y_m * t_1) - x))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z, t) t_1 = tanh((t / y_m)); tmp = 0.0; if (y_m <= 4.5e+129) tmp = x + ((t_1 - tanh((x / y_m))) * (y_m * z)); else tmp = x + (z * ((y_m * t_1) - x)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_, t_] := Block[{t$95$1 = N[Tanh[N[(t / y$95$m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$95$m, 4.5e+129], N[(x + N[(N[(t$95$1 - N[Tanh[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(y$95$m * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(N[(y$95$m * t$95$1), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_1 := \tanh \left(\frac{t}{y\_m}\right)\\
\mathbf{if}\;y\_m \leq 4.5 \cdot 10^{+129}:\\
\;\;\;\;x + \left(t\_1 - \tanh \left(\frac{x}{y\_m}\right)\right) \cdot \left(y\_m \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y\_m \cdot t\_1 - x\right)\\
\end{array}
\end{array}
if y < 4.5000000000000001e129Initial program 94.3%
if 4.5000000000000001e129 < y Initial program 75.6%
Taylor expanded in x around 0 59.0%
+-commutative59.0%
Simplified92.2%
Final simplification94.0%
y_m = (fabs.f64 y)
(FPCore (x y_m z t)
:precision binary64
(let* ((t_1 (tanh (/ t y_m))))
(if (<= y_m 1.95e+37)
(+ x (* t_1 (* y_m z)))
(+ x (* z (- (* y_m t_1) x))))))y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double t_1 = tanh((t / y_m));
double tmp;
if (y_m <= 1.95e+37) {
tmp = x + (t_1 * (y_m * z));
} else {
tmp = x + (z * ((y_m * t_1) - x));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = tanh((t / y_m))
if (y_m <= 1.95d+37) then
tmp = x + (t_1 * (y_m * z))
else
tmp = x + (z * ((y_m * t_1) - x))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
double t_1 = Math.tanh((t / y_m));
double tmp;
if (y_m <= 1.95e+37) {
tmp = x + (t_1 * (y_m * z));
} else {
tmp = x + (z * ((y_m * t_1) - x));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z, t): t_1 = math.tanh((t / y_m)) tmp = 0 if y_m <= 1.95e+37: tmp = x + (t_1 * (y_m * z)) else: tmp = x + (z * ((y_m * t_1) - x)) return tmp
y_m = abs(y) function code(x, y_m, z, t) t_1 = tanh(Float64(t / y_m)) tmp = 0.0 if (y_m <= 1.95e+37) tmp = Float64(x + Float64(t_1 * Float64(y_m * z))); else tmp = Float64(x + Float64(z * Float64(Float64(y_m * t_1) - x))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z, t) t_1 = tanh((t / y_m)); tmp = 0.0; if (y_m <= 1.95e+37) tmp = x + (t_1 * (y_m * z)); else tmp = x + (z * ((y_m * t_1) - x)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_, t_] := Block[{t$95$1 = N[Tanh[N[(t / y$95$m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$95$m, 1.95e+37], N[(x + N[(t$95$1 * N[(y$95$m * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(N[(y$95$m * t$95$1), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_1 := \tanh \left(\frac{t}{y\_m}\right)\\
\mathbf{if}\;y\_m \leq 1.95 \cdot 10^{+37}:\\
\;\;\;\;x + t\_1 \cdot \left(y\_m \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y\_m \cdot t\_1 - x\right)\\
\end{array}
\end{array}
if y < 1.9499999999999999e37Initial program 93.7%
Taylor expanded in x around 0 27.0%
associate-*r*26.8%
associate-/r*26.8%
div-sub26.8%
rec-exp26.8%
rec-exp26.8%
tanh-def-a81.1%
Simplified81.1%
if 1.9499999999999999e37 < y Initial program 85.2%
Taylor expanded in x around 0 52.1%
+-commutative52.1%
Simplified90.6%
Final simplification83.2%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (if (<= y_m 2.6e+129) (+ x (* (tanh (/ t y_m)) (* y_m z))) (fma z (- t x) x)))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 2.6e+129) {
tmp = x + (tanh((t / y_m)) * (y_m * z));
} else {
tmp = fma(z, (t - x), x);
}
return tmp;
}
y_m = abs(y) function code(x, y_m, z, t) tmp = 0.0 if (y_m <= 2.6e+129) tmp = Float64(x + Float64(tanh(Float64(t / y_m)) * Float64(y_m * z))); else tmp = fma(z, Float64(t - x), x); end return tmp end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_, t_] := If[LessEqual[y$95$m, 2.6e+129], N[(x + N[(N[Tanh[N[(t / y$95$m), $MachinePrecision]], $MachinePrecision] * N[(y$95$m * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 2.6 \cdot 10^{+129}:\\
\;\;\;\;x + \tanh \left(\frac{t}{y\_m}\right) \cdot \left(y\_m \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\
\end{array}
\end{array}
if y < 2.60000000000000012e129Initial program 94.3%
Taylor expanded in x around 0 27.4%
associate-*r*27.2%
associate-/r*27.2%
div-sub27.2%
rec-exp27.2%
rec-exp27.2%
tanh-def-a81.2%
Simplified81.2%
if 2.60000000000000012e129 < y Initial program 75.6%
Taylor expanded in y around inf 92.4%
+-commutative92.4%
fma-define92.5%
Simplified92.5%
Final simplification82.7%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (if (<= y_m 8.4e+73) x (fma z (- t x) x)))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 8.4e+73) {
tmp = x;
} else {
tmp = fma(z, (t - x), x);
}
return tmp;
}
y_m = abs(y) function code(x, y_m, z, t) tmp = 0.0 if (y_m <= 8.4e+73) tmp = x; else tmp = fma(z, Float64(t - x), x); end return tmp end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_, t_] := If[LessEqual[y$95$m, 8.4e+73], x, N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 8.4 \cdot 10^{+73}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\
\end{array}
\end{array}
if y < 8.4000000000000005e73Initial program 94.0%
Taylor expanded in x around inf 64.7%
if 8.4000000000000005e73 < y Initial program 82.5%
Taylor expanded in y around inf 87.9%
+-commutative87.9%
fma-define87.9%
Simplified87.9%
y_m = (fabs.f64 y)
(FPCore (x y_m z t)
:precision binary64
(if (<= y_m 1.1e+74)
x
(if (or (<= y_m 1.45e+126) (not (<= y_m 2.7e+167)))
(+ x (* z t))
(- x (* z x)))))y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 1.1e+74) {
tmp = x;
} else if ((y_m <= 1.45e+126) || !(y_m <= 2.7e+167)) {
tmp = x + (z * t);
} else {
tmp = x - (z * x);
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y_m <= 1.1d+74) then
tmp = x
else if ((y_m <= 1.45d+126) .or. (.not. (y_m <= 2.7d+167))) then
tmp = x + (z * t)
else
tmp = x - (z * x)
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 1.1e+74) {
tmp = x;
} else if ((y_m <= 1.45e+126) || !(y_m <= 2.7e+167)) {
tmp = x + (z * t);
} else {
tmp = x - (z * x);
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z, t): tmp = 0 if y_m <= 1.1e+74: tmp = x elif (y_m <= 1.45e+126) or not (y_m <= 2.7e+167): tmp = x + (z * t) else: tmp = x - (z * x) return tmp
y_m = abs(y) function code(x, y_m, z, t) tmp = 0.0 if (y_m <= 1.1e+74) tmp = x; elseif ((y_m <= 1.45e+126) || !(y_m <= 2.7e+167)) tmp = Float64(x + Float64(z * t)); else tmp = Float64(x - Float64(z * x)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z, t) tmp = 0.0; if (y_m <= 1.1e+74) tmp = x; elseif ((y_m <= 1.45e+126) || ~((y_m <= 2.7e+167))) tmp = x + (z * t); else tmp = x - (z * x); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_, t_] := If[LessEqual[y$95$m, 1.1e+74], x, If[Or[LessEqual[y$95$m, 1.45e+126], N[Not[LessEqual[y$95$m, 2.7e+167]], $MachinePrecision]], N[(x + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 1.1 \cdot 10^{+74}:\\
\;\;\;\;x\\
\mathbf{elif}\;y\_m \leq 1.45 \cdot 10^{+126} \lor \neg \left(y\_m \leq 2.7 \cdot 10^{+167}\right):\\
\;\;\;\;x + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot x\\
\end{array}
\end{array}
if y < 1.1000000000000001e74Initial program 94.0%
Taylor expanded in x around inf 64.7%
if 1.1000000000000001e74 < y < 1.44999999999999993e126 or 2.70000000000000005e167 < y Initial program 83.4%
Taylor expanded in x around 0 37.7%
associate-*r*37.0%
associate-/r*37.0%
div-sub37.0%
rec-exp37.0%
rec-exp37.0%
tanh-def-a68.7%
Simplified68.7%
Taylor expanded in y around inf 72.2%
+-commutative72.2%
*-commutative72.2%
Simplified72.2%
if 1.44999999999999993e126 < y < 2.70000000000000005e167Initial program 68.0%
Taylor expanded in y around inf 96.3%
Taylor expanded in x around inf 96.3%
mul-1-neg96.3%
unsub-neg96.3%
Simplified96.3%
Taylor expanded in z around 0 96.3%
mul-1-neg96.3%
*-commutative96.3%
sub-neg96.3%
Simplified96.3%
Final simplification66.4%
y_m = (fabs.f64 y)
(FPCore (x y_m z t)
:precision binary64
(if (<= y_m 8.4e+73)
x
(if (or (<= y_m 1.65e+126) (not (<= y_m 7e+167)))
(+ x (* z t))
(* x (- 1.0 z)))))y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 8.4e+73) {
tmp = x;
} else if ((y_m <= 1.65e+126) || !(y_m <= 7e+167)) {
tmp = x + (z * t);
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y_m <= 8.4d+73) then
tmp = x
else if ((y_m <= 1.65d+126) .or. (.not. (y_m <= 7d+167))) then
tmp = x + (z * t)
else
tmp = x * (1.0d0 - z)
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 8.4e+73) {
tmp = x;
} else if ((y_m <= 1.65e+126) || !(y_m <= 7e+167)) {
tmp = x + (z * t);
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z, t): tmp = 0 if y_m <= 8.4e+73: tmp = x elif (y_m <= 1.65e+126) or not (y_m <= 7e+167): tmp = x + (z * t) else: tmp = x * (1.0 - z) return tmp
y_m = abs(y) function code(x, y_m, z, t) tmp = 0.0 if (y_m <= 8.4e+73) tmp = x; elseif ((y_m <= 1.65e+126) || !(y_m <= 7e+167)) tmp = Float64(x + Float64(z * t)); else tmp = Float64(x * Float64(1.0 - z)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z, t) tmp = 0.0; if (y_m <= 8.4e+73) tmp = x; elseif ((y_m <= 1.65e+126) || ~((y_m <= 7e+167))) tmp = x + (z * t); else tmp = x * (1.0 - z); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_, t_] := If[LessEqual[y$95$m, 8.4e+73], x, If[Or[LessEqual[y$95$m, 1.65e+126], N[Not[LessEqual[y$95$m, 7e+167]], $MachinePrecision]], N[(x + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 8.4 \cdot 10^{+73}:\\
\;\;\;\;x\\
\mathbf{elif}\;y\_m \leq 1.65 \cdot 10^{+126} \lor \neg \left(y\_m \leq 7 \cdot 10^{+167}\right):\\
\;\;\;\;x + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if y < 8.4000000000000005e73Initial program 94.0%
Taylor expanded in x around inf 64.7%
if 8.4000000000000005e73 < y < 1.65000000000000006e126 or 6.99999999999999975e167 < y Initial program 83.4%
Taylor expanded in x around 0 37.7%
associate-*r*37.0%
associate-/r*37.0%
div-sub37.0%
rec-exp37.0%
rec-exp37.0%
tanh-def-a68.7%
Simplified68.7%
Taylor expanded in y around inf 72.2%
+-commutative72.2%
*-commutative72.2%
Simplified72.2%
if 1.65000000000000006e126 < y < 6.99999999999999975e167Initial program 68.0%
Taylor expanded in y around inf 96.3%
Taylor expanded in x around inf 96.3%
mul-1-neg96.3%
unsub-neg96.3%
Simplified96.3%
Final simplification66.4%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (if (<= y_m 1.48e+82) x (if (<= y_m 1.26e+101) (* z t) (* x (- 1.0 z)))))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 1.48e+82) {
tmp = x;
} else if (y_m <= 1.26e+101) {
tmp = z * t;
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y_m <= 1.48d+82) then
tmp = x
else if (y_m <= 1.26d+101) then
tmp = z * t
else
tmp = x * (1.0d0 - z)
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 1.48e+82) {
tmp = x;
} else if (y_m <= 1.26e+101) {
tmp = z * t;
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z, t): tmp = 0 if y_m <= 1.48e+82: tmp = x elif y_m <= 1.26e+101: tmp = z * t else: tmp = x * (1.0 - z) return tmp
y_m = abs(y) function code(x, y_m, z, t) tmp = 0.0 if (y_m <= 1.48e+82) tmp = x; elseif (y_m <= 1.26e+101) tmp = Float64(z * t); else tmp = Float64(x * Float64(1.0 - z)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z, t) tmp = 0.0; if (y_m <= 1.48e+82) tmp = x; elseif (y_m <= 1.26e+101) tmp = z * t; else tmp = x * (1.0 - z); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_, t_] := If[LessEqual[y$95$m, 1.48e+82], x, If[LessEqual[y$95$m, 1.26e+101], N[(z * t), $MachinePrecision], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 1.48 \cdot 10^{+82}:\\
\;\;\;\;x\\
\mathbf{elif}\;y\_m \leq 1.26 \cdot 10^{+101}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if y < 1.48e82Initial program 94.0%
Taylor expanded in x around inf 65.1%
if 1.48e82 < y < 1.2600000000000001e101Initial program 99.1%
Taylor expanded in y around inf 81.7%
Taylor expanded in x around inf 81.1%
+-commutative81.1%
mul-1-neg81.1%
unsub-neg81.1%
*-commutative81.1%
associate-/l*61.6%
Simplified61.6%
Taylor expanded in x around 0 80.7%
if 1.2600000000000001e101 < y Initial program 79.7%
Taylor expanded in y around inf 88.1%
Taylor expanded in x around inf 63.9%
mul-1-neg63.9%
unsub-neg63.9%
Simplified63.9%
Final simplification65.2%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (if (<= x -4.6e-173) x (if (<= x 9.2e-278) (* z t) x)))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double tmp;
if (x <= -4.6e-173) {
tmp = x;
} else if (x <= 9.2e-278) {
tmp = z * t;
} else {
tmp = x;
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-4.6d-173)) then
tmp = x
else if (x <= 9.2d-278) then
tmp = z * t
else
tmp = x
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
double tmp;
if (x <= -4.6e-173) {
tmp = x;
} else if (x <= 9.2e-278) {
tmp = z * t;
} else {
tmp = x;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z, t): tmp = 0 if x <= -4.6e-173: tmp = x elif x <= 9.2e-278: tmp = z * t else: tmp = x return tmp
y_m = abs(y) function code(x, y_m, z, t) tmp = 0.0 if (x <= -4.6e-173) tmp = x; elseif (x <= 9.2e-278) tmp = Float64(z * t); else tmp = x; end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z, t) tmp = 0.0; if (x <= -4.6e-173) tmp = x; elseif (x <= 9.2e-278) tmp = z * t; else tmp = x; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_, t_] := If[LessEqual[x, -4.6e-173], x, If[LessEqual[x, 9.2e-278], N[(z * t), $MachinePrecision], x]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.6 \cdot 10^{-173}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 9.2 \cdot 10^{-278}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -4.59999999999999976e-173 or 9.20000000000000012e-278 < x Initial program 92.2%
Taylor expanded in x around inf 68.0%
if -4.59999999999999976e-173 < x < 9.20000000000000012e-278Initial program 89.1%
Taylor expanded in y around inf 61.8%
Taylor expanded in x around inf 38.2%
+-commutative38.2%
mul-1-neg38.2%
unsub-neg38.2%
*-commutative38.2%
associate-/l*30.0%
Simplified30.0%
Taylor expanded in x around 0 53.1%
Final simplification65.8%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (if (<= y_m 8.4e+73) x (+ x (* z (- t x)))))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 8.4e+73) {
tmp = x;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y_m <= 8.4d+73) then
tmp = x
else
tmp = x + (z * (t - x))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 8.4e+73) {
tmp = x;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z, t): tmp = 0 if y_m <= 8.4e+73: tmp = x else: tmp = x + (z * (t - x)) return tmp
y_m = abs(y) function code(x, y_m, z, t) tmp = 0.0 if (y_m <= 8.4e+73) tmp = x; else tmp = Float64(x + Float64(z * Float64(t - x))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z, t) tmp = 0.0; if (y_m <= 8.4e+73) tmp = x; else tmp = x + (z * (t - x)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_, t_] := If[LessEqual[y$95$m, 8.4e+73], x, N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 8.4 \cdot 10^{+73}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 8.4000000000000005e73Initial program 94.0%
Taylor expanded in x around inf 64.7%
if 8.4000000000000005e73 < y Initial program 82.5%
Taylor expanded in y around inf 87.9%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 x)
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
return x;
}
y_m = abs(y)
real(8) function code(x, y_m, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
return x;
}
y_m = math.fabs(y) def code(x, y_m, z, t): return x
y_m = abs(y) function code(x, y_m, z, t) return x end
y_m = abs(y); function tmp = code(x, y_m, z, t) tmp = x; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_, t_] := x
\begin{array}{l}
y_m = \left|y\right|
\\
x
\end{array}
Initial program 91.8%
Taylor expanded in x around inf 60.2%
(FPCore (x y z t) :precision binary64 (+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y)))))))
double code(double x, double y, double z, double t) {
return x + (y * (z * (tanh((t / y)) - tanh((x / y)))));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + (y * (z * (tanh((t / y)) - tanh((x / y)))))
end function
public static double code(double x, double y, double z, double t) {
return x + (y * (z * (Math.tanh((t / y)) - Math.tanh((x / y)))));
}
def code(x, y, z, t): return x + (y * (z * (math.tanh((t / y)) - math.tanh((x / y)))))
function code(x, y, z, t) return Float64(x + Float64(y * Float64(z * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))))) end
function tmp = code(x, y, z, t) tmp = x + (y * (z * (tanh((t / y)) - tanh((x / y))))); end
code[x_, y_, z_, t_] := N[(x + N[(y * N[(z * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)
\end{array}
herbie shell --seed 2024087
(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))))))