
(FPCore (x y z t) :precision binary64 (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))
double code(double x, double y, double z, double t) {
return x + ((y * z) * (tanh((t / y)) - tanh((x / y))));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y * z) * (tanh((t / y)) - tanh((x / y))))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y * z) * (Math.tanh((t / y)) - Math.tanh((x / y))));
}
def code(x, y, z, t): return x + ((y * z) * (math.tanh((t / y)) - math.tanh((x / y))))
function code(x, y, z, t) return Float64(x + Float64(Float64(y * z) * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y))))) end
function tmp = code(x, y, z, t) tmp = x + ((y * z) * (tanh((t / y)) - tanh((x / y)))); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * z), $MachinePrecision] * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))
double code(double x, double y, double z, double t) {
return x + ((y * z) * (tanh((t / y)) - tanh((x / y))));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y * z) * (tanh((t / y)) - tanh((x / y))))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y * z) * (Math.tanh((t / y)) - Math.tanh((x / y))));
}
def code(x, y, z, t): return x + ((y * z) * (math.tanh((t / y)) - math.tanh((x / y))))
function code(x, y, z, t) return Float64(x + Float64(Float64(y * z) * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y))))) end
function tmp = code(x, y, z, t) tmp = x + ((y * z) * (tanh((t / y)) - tanh((x / y)))); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * z), $MachinePrecision] * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)
\end{array}
(FPCore (x y z t) :precision binary64 (fma y (* z (- (tanh (/ t y)) (tanh (/ x y)))) x))
double code(double x, double y, double z, double t) {
return fma(y, (z * (tanh((t / y)) - tanh((x / y)))), x);
}
function code(x, y, z, t) return fma(y, Float64(z * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))), x) end
code[x_, y_, z_, t_] := N[(y * N[(z * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)
\end{array}
Initial program 94.4%
+-commutative94.4%
associate-*l*98.4%
fma-define98.4%
Simplified98.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (+ x (* (- (tanh (/ t y)) (tanh (/ x y))) (* y z))))) (if (<= t_1 5e+303) t_1 (+ (* x (- 1.0 z)) (* z t)))))
double code(double x, double y, double z, double t) {
double t_1 = x + ((tanh((t / y)) - tanh((x / y))) * (y * z));
double tmp;
if (t_1 <= 5e+303) {
tmp = t_1;
} else {
tmp = (x * (1.0 - z)) + (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) :: t_1
real(8) :: tmp
t_1 = x + ((tanh((t / y)) - tanh((x / y))) * (y * z))
if (t_1 <= 5d+303) then
tmp = t_1
else
tmp = (x * (1.0d0 - z)) + (z * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x + ((Math.tanh((t / y)) - Math.tanh((x / y))) * (y * z));
double tmp;
if (t_1 <= 5e+303) {
tmp = t_1;
} else {
tmp = (x * (1.0 - z)) + (z * t);
}
return tmp;
}
def code(x, y, z, t): t_1 = x + ((math.tanh((t / y)) - math.tanh((x / y))) * (y * z)) tmp = 0 if t_1 <= 5e+303: tmp = t_1 else: tmp = (x * (1.0 - z)) + (z * t) return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(tanh(Float64(t / y)) - tanh(Float64(x / y))) * Float64(y * z))) tmp = 0.0 if (t_1 <= 5e+303) tmp = t_1; else tmp = Float64(Float64(x * Float64(1.0 - z)) + Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + ((tanh((t / y)) - tanh((x / y))) * (y * z)); tmp = 0.0; if (t_1 <= 5e+303) tmp = t_1; else tmp = (x * (1.0 - z)) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+303], t$95$1, N[(N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot \left(y \cdot z\right)\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{+303}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - z\right) + z \cdot t\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 4.9999999999999997e303Initial program 97.6%
if 4.9999999999999997e303 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) Initial program 43.2%
Taylor expanded in y around inf 43.2%
Taylor expanded in x around 0 100.0%
Final simplification97.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -8.8e+46) (not (<= t 3300.0))) (+ x (* (tanh (/ t y)) (* y z))) (+ x (* z (- t (* y (tanh (/ x y))))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -8.8e+46) || !(t <= 3300.0)) {
tmp = x + (tanh((t / y)) * (y * z));
} 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 <= (-8.8d+46)) .or. (.not. (t <= 3300.0d0))) then
tmp = x + (tanh((t / y)) * (y * z))
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 <= -8.8e+46) || !(t <= 3300.0)) {
tmp = x + (Math.tanh((t / y)) * (y * z));
} else {
tmp = x + (z * (t - (y * Math.tanh((x / y)))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -8.8e+46) or not (t <= 3300.0): tmp = x + (math.tanh((t / y)) * (y * z)) else: tmp = x + (z * (t - (y * math.tanh((x / y))))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -8.8e+46) || !(t <= 3300.0)) tmp = Float64(x + Float64(tanh(Float64(t / y)) * Float64(y * z))); 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 <= -8.8e+46) || ~((t <= 3300.0))) tmp = x + (tanh((t / y)) * (y * z)); else tmp = x + (z * (t - (y * tanh((x / y))))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -8.8e+46], N[Not[LessEqual[t, 3300.0]], $MachinePrecision]], N[(x + N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] * N[(y * z), $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 -8.8 \cdot 10^{+46} \lor \neg \left(t \leq 3300\right):\\
\;\;\;\;x + \tanh \left(\frac{t}{y}\right) \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - y \cdot \tanh \left(\frac{x}{y}\right)\right)\\
\end{array}
\end{array}
if t < -8.8000000000000001e46 or 3300 < t Initial program 98.2%
Taylor expanded in x around 0 12.0%
associate-*r*11.9%
associate-/r*11.9%
div-sub11.9%
rec-exp11.9%
rec-exp11.9%
tanh-def-a88.3%
Simplified88.3%
if -8.8000000000000001e46 < t < 3300Initial program 91.8%
+-commutative91.8%
associate-*l*98.0%
fma-define98.0%
Simplified98.0%
Taylor expanded in t around 0 93.6%
fma-undefine93.6%
Applied egg-rr93.6%
associate-*r*87.4%
sub-neg87.4%
distribute-lft-in82.6%
Applied egg-rr82.6%
distribute-lft-out87.4%
distribute-rgt-out82.6%
associate-*r*86.6%
associate-*r*93.7%
distribute-rgt-out93.7%
associate-*l/96.4%
*-commutative96.4%
*-lft-identity96.4%
associate-*l/96.4%
associate-*r*95.6%
lft-mult-inverse95.6%
*-lft-identity95.6%
*-commutative95.6%
Simplified95.6%
Final simplification92.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (tanh (/ t y)))) (if (<= y 160000.0) (+ x (* t_1 (* y z))) (+ x (* z (- (* y t_1) x))))))
double code(double x, double y, double z, double t) {
double t_1 = tanh((t / y));
double tmp;
if (y <= 160000.0) {
tmp = x + (t_1 * (y * z));
} else {
tmp = x + (z * ((y * t_1) - 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 = tanh((t / y))
if (y <= 160000.0d0) then
tmp = x + (t_1 * (y * z))
else
tmp = x + (z * ((y * t_1) - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.tanh((t / y));
double tmp;
if (y <= 160000.0) {
tmp = x + (t_1 * (y * z));
} else {
tmp = x + (z * ((y * t_1) - x));
}
return tmp;
}
def code(x, y, z, t): t_1 = math.tanh((t / y)) tmp = 0 if y <= 160000.0: tmp = x + (t_1 * (y * z)) else: tmp = x + (z * ((y * t_1) - x)) return tmp
function code(x, y, z, t) t_1 = tanh(Float64(t / y)) tmp = 0.0 if (y <= 160000.0) tmp = Float64(x + Float64(t_1 * Float64(y * z))); else tmp = Float64(x + Float64(z * Float64(Float64(y * t_1) - x))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = tanh((t / y)); tmp = 0.0; if (y <= 160000.0) tmp = x + (t_1 * (y * z)); else tmp = x + (z * ((y * t_1) - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 160000.0], N[(x + N[(t$95$1 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(N[(y * t$95$1), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tanh \left(\frac{t}{y}\right)\\
\mathbf{if}\;y \leq 160000:\\
\;\;\;\;x + t\_1 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y \cdot t\_1 - x\right)\\
\end{array}
\end{array}
if y < 1.6e5Initial program 95.0%
Taylor expanded in x around 0 28.8%
associate-*r*28.6%
associate-/r*28.6%
div-sub28.6%
rec-exp28.6%
rec-exp28.6%
tanh-def-a80.9%
Simplified80.9%
if 1.6e5 < y Initial program 92.5%
Taylor expanded in x around 0 56.0%
+-commutative56.0%
Simplified93.2%
Taylor expanded in z around 0 56.0%
associate-/l*56.0%
rec-exp56.0%
rec-exp56.0%
tanh-def-a93.2%
Simplified93.2%
Final simplification83.9%
(FPCore (x y z t) :precision binary64 (if (<= y 3e+35) (+ x (* (tanh (/ t y)) (* y z))) (+ x (* z (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3e+35) {
tmp = x + (tanh((t / y)) * (y * z));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 3d+35) then
tmp = x + (tanh((t / y)) * (y * z))
else
tmp = x + (z * (t - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3e+35) {
tmp = x + (Math.tanh((t / y)) * (y * z));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 3e+35: tmp = x + (math.tanh((t / y)) * (y * z)) else: tmp = x + (z * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 3e+35) tmp = Float64(x + Float64(tanh(Float64(t / y)) * Float64(y * z))); else tmp = Float64(x + Float64(z * Float64(t - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 3e+35) tmp = x + (tanh((t / y)) * (y * z)); else tmp = x + (z * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 3e+35], N[(x + N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3 \cdot 10^{+35}:\\
\;\;\;\;x + \tanh \left(\frac{t}{y}\right) \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 2.99999999999999991e35Initial program 95.1%
Taylor expanded in x around 0 28.6%
associate-*r*28.4%
associate-/r*28.4%
div-sub28.4%
rec-exp28.4%
rec-exp28.4%
tanh-def-a81.3%
Simplified81.3%
if 2.99999999999999991e35 < y Initial program 91.9%
Taylor expanded in y around inf 79.5%
Final simplification80.9%
(FPCore (x y z t) :precision binary64 (if (<= y 5.1e+16) x (+ x (* z (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5.1e+16) {
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 <= 5.1d+16) 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 <= 5.1e+16) {
tmp = x;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 5.1e+16: tmp = x else: tmp = x + (z * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 5.1e+16) 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 <= 5.1e+16) tmp = x; else tmp = x + (z * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 5.1e+16], x, N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.1 \cdot 10^{+16}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 5.1e16Initial program 95.0%
+-commutative95.0%
associate-*l*98.5%
fma-define98.5%
Simplified98.5%
Taylor expanded in y around 0 68.6%
if 5.1e16 < y Initial program 92.3%
Taylor expanded in y around inf 78.1%
(FPCore (x y z t) :precision binary64 (if (<= y 5.5e-56) x (+ x (* z t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5.5e-56) {
tmp = x;
} else {
tmp = x + (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 <= 5.5d-56) then
tmp = x
else
tmp = x + (z * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5.5e-56) {
tmp = x;
} else {
tmp = x + (z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 5.5e-56: tmp = x else: tmp = x + (z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 5.5e-56) tmp = x; else tmp = Float64(x + Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 5.5e-56) tmp = x; else tmp = x + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 5.5e-56], x, N[(x + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.5 \cdot 10^{-56}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot t\\
\end{array}
\end{array}
if y < 5.4999999999999999e-56Initial program 94.7%
+-commutative94.7%
associate-*l*98.4%
fma-define98.4%
Simplified98.4%
Taylor expanded in y around 0 69.3%
if 5.4999999999999999e-56 < y Initial program 93.7%
Taylor expanded in x around 0 44.9%
associate-*r*44.7%
associate-/r*44.7%
div-sub44.7%
rec-exp44.7%
rec-exp44.7%
tanh-def-a78.4%
Simplified78.4%
Taylor expanded in y around inf 66.3%
+-commutative66.3%
*-commutative66.3%
Simplified66.3%
Final simplification68.4%
(FPCore (x y z t) :precision binary64 (if (<= y 35000000.0) x (* x (- 1.0 z))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 35000000.0) {
tmp = x;
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 35000000.0d0) then
tmp = x
else
tmp = x * (1.0d0 - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 35000000.0) {
tmp = x;
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 35000000.0: tmp = x else: tmp = x * (1.0 - z) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 35000000.0) tmp = x; else tmp = Float64(x * Float64(1.0 - z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 35000000.0) tmp = x; else tmp = x * (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 35000000.0], x, N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 35000000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if y < 3.5e7Initial program 95.0%
+-commutative95.0%
associate-*l*98.5%
fma-define98.5%
Simplified98.5%
Taylor expanded in y around 0 68.4%
if 3.5e7 < y Initial program 92.4%
Taylor expanded in y around inf 69.3%
Taylor expanded in x around inf 67.0%
mul-1-neg67.0%
unsub-neg67.0%
Simplified67.0%
(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 94.4%
+-commutative94.4%
associate-*l*98.4%
fma-define98.4%
Simplified98.4%
Taylor expanded in y around 0 66.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}
herbie shell --seed 2024108
(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))))))