
(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 (if (<= y_m 3.8e+217) (fma z (* y_m (- (tanh (/ t y_m)) (tanh (/ x y_m)))) 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 <= 3.8e+217) {
tmp = fma(z, (y_m * (tanh((t / y_m)) - tanh((x / y_m)))), 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 <= 3.8e+217) tmp = fma(z, Float64(y_m * Float64(tanh(Float64(t / y_m)) - tanh(Float64(x / y_m)))), x); else tmp = Float64(x + Float64(z * Float64(t - x))); end return tmp end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_, t_] := If[LessEqual[y$95$m, 3.8e+217], N[(z * N[(y$95$m * N[(N[Tanh[N[(t / y$95$m), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], 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 3.8 \cdot 10^{+217}:\\
\;\;\;\;\mathsf{fma}\left(z, y\_m \cdot \left(\tanh \left(\frac{t}{y\_m}\right) - \tanh \left(\frac{x}{y\_m}\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 3.80000000000000002e217Initial program 95.6%
+-commutative95.6%
*-commutative95.6%
associate-*l*98.8%
fma-def98.8%
Simplified98.8%
if 3.80000000000000002e217 < y Initial program 51.1%
Taylor expanded in y around inf 100.0%
Final simplification98.8%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (let* ((t_1 (+ x (* (- (tanh (/ t y_m)) (tanh (/ x y_m))) (* y_m z))))) (if (<= t_1 2e+289) t_1 (* z (- t x)))))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double t_1 = x + ((tanh((t / y_m)) - tanh((x / y_m))) * (y_m * z));
double tmp;
if (t_1 <= 2e+289) {
tmp = t_1;
} else {
tmp = 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) :: t_1
real(8) :: tmp
t_1 = x + ((tanh((t / y_m)) - tanh((x / y_m))) * (y_m * z))
if (t_1 <= 2d+289) then
tmp = t_1
else
tmp = 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 t_1 = x + ((Math.tanh((t / y_m)) - Math.tanh((x / y_m))) * (y_m * z));
double tmp;
if (t_1 <= 2e+289) {
tmp = t_1;
} else {
tmp = z * (t - x);
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z, t): t_1 = x + ((math.tanh((t / y_m)) - math.tanh((x / y_m))) * (y_m * z)) tmp = 0 if t_1 <= 2e+289: tmp = t_1 else: tmp = z * (t - x) return tmp
y_m = abs(y) function code(x, y_m, z, t) t_1 = Float64(x + Float64(Float64(tanh(Float64(t / y_m)) - tanh(Float64(x / y_m))) * Float64(y_m * z))) tmp = 0.0 if (t_1 <= 2e+289) tmp = t_1; else tmp = Float64(z * Float64(t - x)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z, t) t_1 = x + ((tanh((t / y_m)) - tanh((x / y_m))) * (y_m * z)); tmp = 0.0; if (t_1 <= 2e+289) tmp = t_1; else tmp = z * (t - x); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(N[Tanh[N[(t / y$95$m), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(y$95$m * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e+289], t$95$1, N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_1 := x + \left(\tanh \left(\frac{t}{y\_m}\right) - \tanh \left(\frac{x}{y\_m}\right)\right) \cdot \left(y\_m \cdot z\right)\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{+289}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 2.0000000000000001e289Initial program 97.9%
if 2.0000000000000001e289 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) Initial program 36.7%
Taylor expanded in y around inf 95.0%
Taylor expanded in z around inf 95.0%
Final simplification97.7%
y_m = (fabs.f64 y)
(FPCore (x y_m z t)
:precision binary64
(let* ((t_1 (+ x (* y_m (* z (tanh (/ t y_m)))))))
(if (<= t -9.4e-88)
t_1
(if (<= t -1.08e-280)
(+ x (* (* y_m z) (- (/ t y_m) (tanh (/ x y_m)))))
(if (<= t 1.15e-33) (+ x (* z (- t x))) t_1)))))y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double t_1 = x + (y_m * (z * tanh((t / y_m))));
double tmp;
if (t <= -9.4e-88) {
tmp = t_1;
} else if (t <= -1.08e-280) {
tmp = x + ((y_m * z) * ((t / y_m) - tanh((x / y_m))));
} else if (t <= 1.15e-33) {
tmp = x + (z * (t - x));
} else {
tmp = t_1;
}
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 = x + (y_m * (z * tanh((t / y_m))))
if (t <= (-9.4d-88)) then
tmp = t_1
else if (t <= (-1.08d-280)) then
tmp = x + ((y_m * z) * ((t / y_m) - tanh((x / y_m))))
else if (t <= 1.15d-33) then
tmp = x + (z * (t - x))
else
tmp = t_1
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 = x + (y_m * (z * Math.tanh((t / y_m))));
double tmp;
if (t <= -9.4e-88) {
tmp = t_1;
} else if (t <= -1.08e-280) {
tmp = x + ((y_m * z) * ((t / y_m) - Math.tanh((x / y_m))));
} else if (t <= 1.15e-33) {
tmp = x + (z * (t - x));
} else {
tmp = t_1;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z, t): t_1 = x + (y_m * (z * math.tanh((t / y_m)))) tmp = 0 if t <= -9.4e-88: tmp = t_1 elif t <= -1.08e-280: tmp = x + ((y_m * z) * ((t / y_m) - math.tanh((x / y_m)))) elif t <= 1.15e-33: tmp = x + (z * (t - x)) else: tmp = t_1 return tmp
y_m = abs(y) function code(x, y_m, z, t) t_1 = Float64(x + Float64(y_m * Float64(z * tanh(Float64(t / y_m))))) tmp = 0.0 if (t <= -9.4e-88) tmp = t_1; elseif (t <= -1.08e-280) tmp = Float64(x + Float64(Float64(y_m * z) * Float64(Float64(t / y_m) - tanh(Float64(x / y_m))))); elseif (t <= 1.15e-33) tmp = Float64(x + Float64(z * Float64(t - x))); else tmp = t_1; end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z, t) t_1 = x + (y_m * (z * tanh((t / y_m)))); tmp = 0.0; if (t <= -9.4e-88) tmp = t_1; elseif (t <= -1.08e-280) tmp = x + ((y_m * z) * ((t / y_m) - tanh((x / y_m)))); elseif (t <= 1.15e-33) tmp = x + (z * (t - x)); else tmp = t_1; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_, t_] := Block[{t$95$1 = N[(x + N[(y$95$m * N[(z * N[Tanh[N[(t / y$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -9.4e-88], t$95$1, If[LessEqual[t, -1.08e-280], N[(x + N[(N[(y$95$m * z), $MachinePrecision] * N[(N[(t / y$95$m), $MachinePrecision] - N[Tanh[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.15e-33], N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_1 := x + y\_m \cdot \left(z \cdot \tanh \left(\frac{t}{y\_m}\right)\right)\\
\mathbf{if}\;t \leq -9.4 \cdot 10^{-88}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.08 \cdot 10^{-280}:\\
\;\;\;\;x + \left(y\_m \cdot z\right) \cdot \left(\frac{t}{y\_m} - \tanh \left(\frac{x}{y\_m}\right)\right)\\
\mathbf{elif}\;t \leq 1.15 \cdot 10^{-33}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -9.4e-88 or 1.14999999999999993e-33 < t Initial program 98.1%
Taylor expanded in x around 0 7.5%
associate-/r*7.5%
div-sub7.5%
rec-exp7.5%
rec-exp7.5%
tanh-def-a90.3%
Simplified90.3%
if -9.4e-88 < t < -1.07999999999999996e-280Initial program 91.9%
Taylor expanded in t around 0 89.1%
if -1.07999999999999996e-280 < t < 1.14999999999999993e-33Initial program 82.3%
Taylor expanded in y around inf 85.9%
Final simplification89.0%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (if (or (<= t -9.5e-88) (not (<= t 7.2e-27))) (+ x (* y_m (* z (tanh (/ t y_m))))) (+ x (* z (- t x)))))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double tmp;
if ((t <= -9.5e-88) || !(t <= 7.2e-27)) {
tmp = x + (y_m * (z * tanh((t / y_m))));
} 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 ((t <= (-9.5d-88)) .or. (.not. (t <= 7.2d-27))) then
tmp = x + (y_m * (z * tanh((t / y_m))))
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 ((t <= -9.5e-88) || !(t <= 7.2e-27)) {
tmp = x + (y_m * (z * Math.tanh((t / y_m))));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z, t): tmp = 0 if (t <= -9.5e-88) or not (t <= 7.2e-27): tmp = x + (y_m * (z * math.tanh((t / y_m)))) else: tmp = x + (z * (t - x)) return tmp
y_m = abs(y) function code(x, y_m, z, t) tmp = 0.0 if ((t <= -9.5e-88) || !(t <= 7.2e-27)) tmp = Float64(x + Float64(y_m * Float64(z * tanh(Float64(t / y_m))))); 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 ((t <= -9.5e-88) || ~((t <= 7.2e-27))) tmp = x + (y_m * (z * tanh((t / y_m)))); 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[Or[LessEqual[t, -9.5e-88], N[Not[LessEqual[t, 7.2e-27]], $MachinePrecision]], N[(x + N[(y$95$m * N[(z * N[Tanh[N[(t / y$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.5 \cdot 10^{-88} \lor \neg \left(t \leq 7.2 \cdot 10^{-27}\right):\\
\;\;\;\;x + y\_m \cdot \left(z \cdot \tanh \left(\frac{t}{y\_m}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if t < -9.5e-88 or 7.1999999999999997e-27 < t Initial program 98.1%
Taylor expanded in x around 0 7.5%
associate-/r*7.5%
div-sub7.5%
rec-exp7.5%
rec-exp7.5%
tanh-def-a90.3%
Simplified90.3%
if -9.5e-88 < t < 7.1999999999999997e-27Initial program 85.6%
Taylor expanded in y around inf 81.8%
Final simplification86.9%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (if (<= y_m 2.6e+75) (+ x (* y_m (/ z (- (/ y_m t) (* (/ t y_m) -0.3333333333333333))))) (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+75) {
tmp = x + (y_m * (z / ((y_m / t) - ((t / y_m) * -0.3333333333333333))));
} 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+75) tmp = Float64(x + Float64(y_m * Float64(z / Float64(Float64(y_m / t) - Float64(Float64(t / y_m) * -0.3333333333333333))))); 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+75], N[(x + N[(y$95$m * N[(z / N[(N[(y$95$m / t), $MachinePrecision] - N[(N[(t / y$95$m), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $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^{+75}:\\
\;\;\;\;x + y\_m \cdot \frac{z}{\frac{y\_m}{t} - \frac{t}{y\_m} \cdot -0.3333333333333333}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\
\end{array}
\end{array}
if y < 2.59999999999999985e75Initial program 96.2%
Taylor expanded in x around 0 17.7%
associate-/r*17.7%
div-sub17.7%
rec-exp17.7%
rec-exp17.7%
tanh-def-a80.3%
Simplified80.3%
tanh-def-b46.7%
clear-num46.7%
+-commutative46.7%
exp-prod46.7%
expm1-def51.1%
*-commutative51.1%
Applied egg-rr51.1%
Taylor expanded in y around -inf 69.8%
+-commutative69.8%
mul-1-neg69.8%
unsub-neg69.8%
distribute-rgt-out--69.8%
metadata-eval69.8%
Simplified69.8%
Taylor expanded in z around 0 69.8%
if 2.59999999999999985e75 < y Initial program 80.2%
Taylor expanded in y around inf 84.7%
+-commutative84.7%
fma-def84.8%
Simplified84.8%
Final simplification72.7%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (if (<= y_m 1.15e+75) (+ x (* y_m (/ z (- (/ y_m t) (* (/ t y_m) -0.3333333333333333))))) (+ x (* z (- t x)))))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 1.15e+75) {
tmp = x + (y_m * (z / ((y_m / t) - ((t / y_m) * -0.3333333333333333))));
} 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 <= 1.15d+75) then
tmp = x + (y_m * (z / ((y_m / t) - ((t / y_m) * (-0.3333333333333333d0)))))
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 <= 1.15e+75) {
tmp = x + (y_m * (z / ((y_m / t) - ((t / y_m) * -0.3333333333333333))));
} 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 <= 1.15e+75: tmp = x + (y_m * (z / ((y_m / t) - ((t / y_m) * -0.3333333333333333)))) 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 <= 1.15e+75) tmp = Float64(x + Float64(y_m * Float64(z / Float64(Float64(y_m / t) - Float64(Float64(t / y_m) * -0.3333333333333333))))); 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 <= 1.15e+75) tmp = x + (y_m * (z / ((y_m / t) - ((t / y_m) * -0.3333333333333333)))); 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, 1.15e+75], N[(x + N[(y$95$m * N[(z / N[(N[(y$95$m / t), $MachinePrecision] - N[(N[(t / y$95$m), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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 1.15 \cdot 10^{+75}:\\
\;\;\;\;x + y\_m \cdot \frac{z}{\frac{y\_m}{t} - \frac{t}{y\_m} \cdot -0.3333333333333333}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 1.1499999999999999e75Initial program 96.2%
Taylor expanded in x around 0 17.7%
associate-/r*17.7%
div-sub17.7%
rec-exp17.7%
rec-exp17.7%
tanh-def-a80.3%
Simplified80.3%
tanh-def-b46.7%
clear-num46.7%
+-commutative46.7%
exp-prod46.7%
expm1-def51.1%
*-commutative51.1%
Applied egg-rr51.1%
Taylor expanded in y around -inf 69.8%
+-commutative69.8%
mul-1-neg69.8%
unsub-neg69.8%
distribute-rgt-out--69.8%
metadata-eval69.8%
Simplified69.8%
Taylor expanded in z around 0 69.8%
if 1.1499999999999999e75 < y Initial program 80.2%
Taylor expanded in y around inf 84.7%
Final simplification72.7%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (if (<= y_m 2.1e+28) x (if (<= y_m 2.35e+198) (* x (- 1.0 z)) (* z (- t x)))))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 2.1e+28) {
tmp = x;
} else if (y_m <= 2.35e+198) {
tmp = x * (1.0 - z);
} else {
tmp = 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 <= 2.1d+28) then
tmp = x
else if (y_m <= 2.35d+198) then
tmp = x * (1.0d0 - z)
else
tmp = 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 <= 2.1e+28) {
tmp = x;
} else if (y_m <= 2.35e+198) {
tmp = x * (1.0 - z);
} else {
tmp = z * (t - x);
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z, t): tmp = 0 if y_m <= 2.1e+28: tmp = x elif y_m <= 2.35e+198: tmp = x * (1.0 - z) else: tmp = z * (t - x) return tmp
y_m = abs(y) function code(x, y_m, z, t) tmp = 0.0 if (y_m <= 2.1e+28) tmp = x; elseif (y_m <= 2.35e+198) tmp = Float64(x * Float64(1.0 - z)); else tmp = 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 <= 2.1e+28) tmp = x; elseif (y_m <= 2.35e+198) tmp = x * (1.0 - z); else tmp = 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, 2.1e+28], x, If[LessEqual[y$95$m, 2.35e+198], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 2.1 \cdot 10^{+28}:\\
\;\;\;\;x\\
\mathbf{elif}\;y\_m \leq 2.35 \cdot 10^{+198}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 2.09999999999999989e28Initial program 96.0%
Taylor expanded in x around inf 67.1%
if 2.09999999999999989e28 < y < 2.3500000000000001e198Initial program 95.2%
Taylor expanded in y around inf 71.2%
Taylor expanded in x around inf 55.5%
mul-1-neg55.5%
unsub-neg55.5%
Simplified55.5%
if 2.3500000000000001e198 < y Initial program 56.6%
Taylor expanded in y around inf 95.1%
Taylor expanded in z around inf 73.6%
Final simplification65.8%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (if (<= y_m 1.15e+75) x (if (<= y_m 1.15e+199) (+ x (* z t)) (* z (- t x)))))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 1.15e+75) {
tmp = x;
} else if (y_m <= 1.15e+199) {
tmp = x + (z * t);
} else {
tmp = 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 <= 1.15d+75) then
tmp = x
else if (y_m <= 1.15d+199) then
tmp = x + (z * t)
else
tmp = 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 <= 1.15e+75) {
tmp = x;
} else if (y_m <= 1.15e+199) {
tmp = x + (z * t);
} else {
tmp = z * (t - x);
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z, t): tmp = 0 if y_m <= 1.15e+75: tmp = x elif y_m <= 1.15e+199: tmp = x + (z * t) else: tmp = z * (t - x) return tmp
y_m = abs(y) function code(x, y_m, z, t) tmp = 0.0 if (y_m <= 1.15e+75) tmp = x; elseif (y_m <= 1.15e+199) tmp = Float64(x + Float64(z * t)); else tmp = 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 <= 1.15e+75) tmp = x; elseif (y_m <= 1.15e+199) tmp = x + (z * t); else tmp = 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, 1.15e+75], x, If[LessEqual[y$95$m, 1.15e+199], N[(x + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 1.15 \cdot 10^{+75}:\\
\;\;\;\;x\\
\mathbf{elif}\;y\_m \leq 1.15 \cdot 10^{+199}:\\
\;\;\;\;x + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 1.1499999999999999e75Initial program 96.2%
Taylor expanded in x around inf 65.6%
if 1.1499999999999999e75 < y < 1.14999999999999997e199Initial program 93.9%
Taylor expanded in x around 0 33.5%
associate-/r*33.5%
div-sub33.5%
rec-exp33.5%
rec-exp33.5%
tanh-def-a72.3%
Simplified72.3%
Taylor expanded in y around inf 60.0%
+-commutative60.0%
*-commutative60.0%
Simplified60.0%
if 1.14999999999999997e199 < y Initial program 56.6%
Taylor expanded in y around inf 95.1%
Taylor expanded in z around inf 73.6%
Final simplification65.5%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (if (<= y_m 2.2e+75) 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 <= 2.2e+75) {
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 <= 2.2d+75) 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 <= 2.2e+75) {
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 <= 2.2e+75: 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 <= 2.2e+75) 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 <= 2.2e+75) 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, 2.2e+75], 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 2.2 \cdot 10^{+75}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 2.20000000000000012e75Initial program 96.2%
Taylor expanded in x around inf 65.6%
if 2.20000000000000012e75 < y Initial program 80.2%
Taylor expanded in y around inf 84.7%
Final simplification69.3%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (if (<= y_m 2.1e+28) x (* x (- 1.0 z))))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 2.1e+28) {
tmp = x;
} 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 <= 2.1d+28) then
tmp = x
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 <= 2.1e+28) {
tmp = x;
} 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 <= 2.1e+28: tmp = x 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 <= 2.1e+28) tmp = x; 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 <= 2.1e+28) tmp = x; 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, 2.1e+28], x, N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 2.1 \cdot 10^{+28}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if y < 2.09999999999999989e28Initial program 96.0%
Taylor expanded in x around inf 67.1%
if 2.09999999999999989e28 < y Initial program 83.0%
Taylor expanded in y around inf 78.7%
Taylor expanded in x around inf 56.1%
mul-1-neg56.1%
unsub-neg56.1%
Simplified56.1%
Final simplification64.7%
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 93.1%
Taylor expanded in x around inf 59.7%
Final simplification59.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 2024040
(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))))))