
(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
(let* ((t_1 (- (tanh (/ t y)) (tanh (/ x y)))))
(if (<= (+ x (* (* y z) t_1)) 1e+306)
(fma (* t_1 y) z x)
(fma (- t x) z x))))
double code(double x, double y, double z, double t) {
double t_1 = tanh((t / y)) - tanh((x / y));
double tmp;
if ((x + ((y * z) * t_1)) <= 1e+306) {
tmp = fma((t_1 * y), z, x);
} else {
tmp = fma((t - x), z, x);
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(tanh(Float64(t / y)) - tanh(Float64(x / y))) tmp = 0.0 if (Float64(x + Float64(Float64(y * z) * t_1)) <= 1e+306) tmp = fma(Float64(t_1 * y), z, x); else tmp = fma(Float64(t - x), z, x); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x + N[(N[(y * z), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], 1e+306], N[(N[(t$95$1 * y), $MachinePrecision] * z + x), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\\
\mathbf{if}\;x + \left(y \cdot z\right) \cdot t\_1 \leq 10^{+306}:\\
\;\;\;\;\mathsf{fma}\left(t\_1 \cdot y, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, z, x\right)\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 1.00000000000000002e306Initial program 97.3%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6499.1
Applied rewrites99.1%
if 1.00000000000000002e306 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) Initial program 48.1%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64100.0
Applied rewrites100.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.45e+34) (not (<= x 1.6e+44))) (fma (* (- (/ t y) (tanh (/ x y))) y) z x) (fma (* (- (tanh (/ t y)) (/ x y)) z) y x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.45e+34) || !(x <= 1.6e+44)) {
tmp = fma((((t / y) - tanh((x / y))) * y), z, x);
} else {
tmp = fma(((tanh((t / y)) - (x / y)) * z), y, x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.45e+34) || !(x <= 1.6e+44)) tmp = fma(Float64(Float64(Float64(t / y) - tanh(Float64(x / y))) * y), z, x); else tmp = fma(Float64(Float64(tanh(Float64(t / y)) - Float64(x / y)) * z), y, x); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.45e+34], N[Not[LessEqual[x, 1.6e+44]], $MachinePrecision]], N[(N[(N[(N[(t / y), $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] * z + x), $MachinePrecision], N[(N[(N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[(x / y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.45 \cdot 10^{+34} \lor \neg \left(x \leq 1.6 \cdot 10^{+44}\right):\\
\;\;\;\;\mathsf{fma}\left(\left(\frac{t}{y} - \tanh \left(\frac{x}{y}\right)\right) \cdot y, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right) \cdot z, y, x\right)\\
\end{array}
\end{array}
if x < -2.4500000000000001e34 or 1.60000000000000002e44 < x Initial program 98.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in y around inf
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate-*r/N/A
distribute-lft1-inN/A
metadata-evalN/A
mul0-lftN/A
metadata-evalN/A
lower-/.f6480.3
Applied rewrites80.3%
if -2.4500000000000001e34 < x < 1.60000000000000002e44Initial program 90.4%
Taylor expanded in x around 0
lower-/.f6474.9
Applied rewrites74.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6477.8
Applied rewrites77.8%
Final simplification78.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.45e+34) (not (<= x 6.5e+45))) (fma (- (/ t y) (tanh (/ x y))) (* z y) x) (fma (* (- (tanh (/ t y)) (/ x y)) z) y x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.45e+34) || !(x <= 6.5e+45)) {
tmp = fma(((t / y) - tanh((x / y))), (z * y), x);
} else {
tmp = fma(((tanh((t / y)) - (x / y)) * z), y, x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.45e+34) || !(x <= 6.5e+45)) tmp = fma(Float64(Float64(t / y) - tanh(Float64(x / y))), Float64(z * y), x); else tmp = fma(Float64(Float64(tanh(Float64(t / y)) - Float64(x / y)) * z), y, x); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.45e+34], N[Not[LessEqual[x, 6.5e+45]], $MachinePrecision]], N[(N[(N[(t / y), $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(z * y), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[(x / y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.45 \cdot 10^{+34} \lor \neg \left(x \leq 6.5 \cdot 10^{+45}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{y} - \tanh \left(\frac{x}{y}\right), z \cdot y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right) \cdot z, y, x\right)\\
\end{array}
\end{array}
if x < -2.4500000000000001e34 or 6.50000000000000034e45 < x Initial program 98.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in y around inf
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate-*r/N/A
distribute-lft1-inN/A
metadata-evalN/A
mul0-lftN/A
metadata-evalN/A
lower-/.f6480.3
Applied rewrites80.3%
lift-fma.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lower-fma.f6478.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites78.4%
if -2.4500000000000001e34 < x < 6.50000000000000034e45Initial program 90.4%
Taylor expanded in x around 0
lower-/.f6474.9
Applied rewrites74.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6477.8
Applied rewrites77.8%
Final simplification78.0%
(FPCore (x y z t)
:precision binary64
(if (<= x -1.55e+135)
(fma (- t x) z x)
(if (<= x 3.6e+132)
(fma (* (- (tanh (/ t y)) (/ x y)) z) y x)
(+ x (* (* y z) (/ t y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.55e+135) {
tmp = fma((t - x), z, x);
} else if (x <= 3.6e+132) {
tmp = fma(((tanh((t / y)) - (x / y)) * z), y, x);
} else {
tmp = x + ((y * z) * (t / y));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (x <= -1.55e+135) tmp = fma(Float64(t - x), z, x); elseif (x <= 3.6e+132) tmp = fma(Float64(Float64(tanh(Float64(t / y)) - Float64(x / y)) * z), y, x); else tmp = Float64(x + Float64(Float64(y * z) * Float64(t / y))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.55e+135], N[(N[(t - x), $MachinePrecision] * z + x), $MachinePrecision], If[LessEqual[x, 3.6e+132], N[(N[(N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[(x / y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] * y + x), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] * N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{+135}:\\
\;\;\;\;\mathsf{fma}\left(t - x, z, x\right)\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{+132}:\\
\;\;\;\;\mathsf{fma}\left(\left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right) \cdot z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y \cdot z\right) \cdot \frac{t}{y}\\
\end{array}
\end{array}
if x < -1.55000000000000011e135Initial program 100.0%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6472.3
Applied rewrites72.3%
if -1.55000000000000011e135 < x < 3.60000000000000016e132Initial program 91.2%
Taylor expanded in x around 0
lower-/.f6472.9
Applied rewrites72.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6476.3
Applied rewrites76.3%
if 3.60000000000000016e132 < x Initial program 100.0%
Taylor expanded in y around inf
lower-/.f64N/A
lower--.f6437.8
Applied rewrites37.8%
Taylor expanded in x around 0
Applied rewrites72.3%
(FPCore (x y z t) :precision binary64 (if (<= y 1.75e-247) (fma (/ (* (- x) x) x) z x) (if (<= y 21000000.0) (+ x (* (* y z) (/ t y))) (fma (- t x) z x))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.75e-247) {
tmp = fma(((-x * x) / x), z, x);
} else if (y <= 21000000.0) {
tmp = x + ((y * z) * (t / y));
} else {
tmp = fma((t - x), z, x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= 1.75e-247) tmp = fma(Float64(Float64(Float64(-x) * x) / x), z, x); elseif (y <= 21000000.0) tmp = Float64(x + Float64(Float64(y * z) * Float64(t / y))); else tmp = fma(Float64(t - x), z, x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, 1.75e-247], N[(N[(N[((-x) * x), $MachinePrecision] / x), $MachinePrecision] * z + x), $MachinePrecision], If[LessEqual[y, 21000000.0], N[(x + N[(N[(y * z), $MachinePrecision] * N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.75 \cdot 10^{-247}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(-x\right) \cdot x}{x}, z, x\right)\\
\mathbf{elif}\;y \leq 21000000:\\
\;\;\;\;x + \left(y \cdot z\right) \cdot \frac{t}{y}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, z, x\right)\\
\end{array}
\end{array}
if y < 1.75e-247Initial program 94.3%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6454.3
Applied rewrites54.3%
Taylor expanded in x around inf
Applied rewrites50.3%
Applied rewrites43.1%
if 1.75e-247 < y < 2.1e7Initial program 100.0%
Taylor expanded in y around inf
lower-/.f64N/A
lower--.f6437.7
Applied rewrites37.7%
Taylor expanded in x around 0
Applied rewrites52.1%
if 2.1e7 < y Initial program 85.8%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6486.6
Applied rewrites86.6%
Final simplification55.4%
(FPCore (x y z t) :precision binary64 (if (<= y 1.65e-164) (fma (- x) z x) (if (<= y 21000000.0) (fma (* (/ t y) y) z x) (fma (- t x) z x))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.65e-164) {
tmp = fma(-x, z, x);
} else if (y <= 21000000.0) {
tmp = fma(((t / y) * y), z, x);
} else {
tmp = fma((t - x), z, x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= 1.65e-164) tmp = fma(Float64(-x), z, x); elseif (y <= 21000000.0) tmp = fma(Float64(Float64(t / y) * y), z, x); else tmp = fma(Float64(t - x), z, x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, 1.65e-164], N[((-x) * z + x), $MachinePrecision], If[LessEqual[y, 21000000.0], N[(N[(N[(t / y), $MachinePrecision] * y), $MachinePrecision] * z + x), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.65 \cdot 10^{-164}:\\
\;\;\;\;\mathsf{fma}\left(-x, z, x\right)\\
\mathbf{elif}\;y \leq 21000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{y} \cdot y, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, z, x\right)\\
\end{array}
\end{array}
if y < 1.65e-164Initial program 94.9%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6452.4
Applied rewrites52.4%
Taylor expanded in x around inf
Applied rewrites50.2%
if 1.65e-164 < y < 2.1e7Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6499.9
Applied rewrites99.9%
Taylor expanded in y around -inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
distribute-lft-out--N/A
mul-1-negN/A
remove-double-negN/A
lower--.f6445.1
Applied rewrites45.1%
Taylor expanded in x around 0
Applied rewrites58.0%
if 2.1e7 < y Initial program 85.8%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6486.6
Applied rewrites86.6%
(FPCore (x y z t) :precision binary64 (if (<= y 8.8e-48) (fma (- x) z x) (fma (- t x) z x)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 8.8e-48) {
tmp = fma(-x, z, x);
} else {
tmp = fma((t - x), z, x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= 8.8e-48) tmp = fma(Float64(-x), z, x); else tmp = fma(Float64(t - x), z, x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, 8.8e-48], N[((-x) * z + x), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * z + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 8.8 \cdot 10^{-48}:\\
\;\;\;\;\mathsf{fma}\left(-x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, z, x\right)\\
\end{array}
\end{array}
if y < 8.8000000000000005e-48Initial program 95.7%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6451.3
Applied rewrites51.3%
Taylor expanded in x around inf
Applied rewrites49.9%
if 8.8000000000000005e-48 < y Initial program 88.5%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6480.1
Applied rewrites80.1%
(FPCore (x y z t) :precision binary64 (if (<= z 1.7e-14) (fma (- x) z x) (* z t)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.7e-14) {
tmp = fma(-x, z, x);
} else {
tmp = z * t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= 1.7e-14) tmp = fma(Float64(-x), z, x); else tmp = Float64(z * t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, 1.7e-14], N[((-x) * z + x), $MachinePrecision], N[(z * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.7 \cdot 10^{-14}:\\
\;\;\;\;\mathsf{fma}\left(-x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if z < 1.70000000000000001e-14Initial program 95.4%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6465.9
Applied rewrites65.9%
Taylor expanded in x around inf
Applied rewrites65.4%
if 1.70000000000000001e-14 < z Initial program 88.7%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6442.6
Applied rewrites42.6%
Taylor expanded in x around 0
Applied rewrites27.4%
(FPCore (x y z t) :precision binary64 (* z t))
double code(double x, double y, double z, double t) {
return z * t;
}
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 = z * t
end function
public static double code(double x, double y, double z, double t) {
return z * t;
}
def code(x, y, z, t): return z * t
function code(x, y, z, t) return Float64(z * t) end
function tmp = code(x, y, z, t) tmp = z * t; end
code[x_, y_, z_, t_] := N[(z * t), $MachinePrecision]
\begin{array}{l}
\\
z \cdot t
\end{array}
Initial program 93.6%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6459.6
Applied rewrites59.6%
Taylor expanded in x around 0
Applied rewrites16.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 2024296
(FPCore (x y z t)
:name "SynthBasics:moogVCF from YampaSynth-0.2"
:precision binary64
:alt
(! :herbie-platform default (+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y)))))))
(+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))