
(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}
(FPCore (x y z t) :precision binary64 (fma (* y (- (tanh (/ t y)) (tanh (/ x y)))) z x))
double code(double x, double y, double z, double t) {
return fma((y * (tanh((t / y)) - tanh((x / y)))), z, x);
}
function code(x, y, z, t) return fma(Float64(y * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))), z, x) end
code[x_, y_, z_, t_] := N[(N[(y * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), z, x\right)
\end{array}
Initial program 95.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6499.2
Applied rewrites99.2%
Final simplification99.2%
(FPCore (x y z t)
:precision binary64
(if (<= x -2.2e+124)
(fma (* y (- (/ t y) (tanh (/ x y)))) z x)
(if (<= x 1.35e+59)
(fma (* y (- (tanh (/ t y)) (/ x y))) z x)
(fma z (/ 1.0 (/ (- -1.0 (/ (+ t (/ (* t t) x)) x)) x)) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.2e+124) {
tmp = fma((y * ((t / y) - tanh((x / y)))), z, x);
} else if (x <= 1.35e+59) {
tmp = fma((y * (tanh((t / y)) - (x / y))), z, x);
} else {
tmp = fma(z, (1.0 / ((-1.0 - ((t + ((t * t) / x)) / x)) / x)), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (x <= -2.2e+124) tmp = fma(Float64(y * Float64(Float64(t / y) - tanh(Float64(x / y)))), z, x); elseif (x <= 1.35e+59) tmp = fma(Float64(y * Float64(tanh(Float64(t / y)) - Float64(x / y))), z, x); else tmp = fma(z, Float64(1.0 / Float64(Float64(-1.0 - Float64(Float64(t + Float64(Float64(t * t) / x)) / x)) / x)), x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.2e+124], N[(N[(y * N[(N[(t / y), $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z + x), $MachinePrecision], If[LessEqual[x, 1.35e+59], N[(N[(y * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z + x), $MachinePrecision], N[(z * N[(1.0 / N[(N[(-1.0 - N[(N[(t + N[(N[(t * t), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{+124}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \left(\frac{t}{y} - \tanh \left(\frac{x}{y}\right)\right), z, x\right)\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{+59}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right), z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{1}{\frac{-1 - \frac{t + \frac{t \cdot t}{x}}{x}}{x}}, x\right)\\
\end{array}
\end{array}
if x < -2.2000000000000001e124Initial program 100.0%
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 t around 0
lower-/.f6480.3
Applied rewrites80.3%
if -2.2000000000000001e124 < x < 1.3500000000000001e59Initial program 93.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6498.8
Applied rewrites98.8%
Taylor expanded in x around 0
lower-/.f6487.4
Applied rewrites87.4%
if 1.3500000000000001e59 < x Initial program 98.1%
Taylor expanded in y around inf
+-commutativeN/A
lower-fma.f64N/A
lower--.f6471.3
Applied rewrites71.3%
Applied rewrites41.6%
Taylor expanded in x around inf
Applied rewrites62.6%
Taylor expanded in x around -inf
Applied rewrites82.3%
Final simplification85.3%
(FPCore (x y z t) :precision binary64 (if (<= y 7e-109) (fma z (/ 1.0 (/ (- -1.0 (/ (+ t (/ (* t t) x)) x)) x)) x) (fma (* y (- (/ t y) (tanh (/ x y)))) z x)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 7e-109) {
tmp = fma(z, (1.0 / ((-1.0 - ((t + ((t * t) / x)) / x)) / x)), x);
} else {
tmp = fma((y * ((t / y) - tanh((x / y)))), z, x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= 7e-109) tmp = fma(z, Float64(1.0 / Float64(Float64(-1.0 - Float64(Float64(t + Float64(Float64(t * t) / x)) / x)) / x)), x); else tmp = fma(Float64(y * Float64(Float64(t / y) - tanh(Float64(x / y)))), z, x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, 7e-109], N[(z * N[(1.0 / N[(N[(-1.0 - N[(N[(t + N[(N[(t * t), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(y * N[(N[(t / y), $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7 \cdot 10^{-109}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{1}{\frac{-1 - \frac{t + \frac{t \cdot t}{x}}{x}}{x}}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \left(\frac{t}{y} - \tanh \left(\frac{x}{y}\right)\right), z, x\right)\\
\end{array}
\end{array}
if y < 7e-109Initial program 97.8%
Taylor expanded in y around inf
+-commutativeN/A
lower-fma.f64N/A
lower--.f6455.3
Applied rewrites55.3%
Applied rewrites41.6%
Taylor expanded in x around inf
Applied rewrites55.9%
Taylor expanded in x around -inf
Applied rewrites63.0%
if 7e-109 < y Initial program 90.3%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6498.7
Applied rewrites98.7%
Taylor expanded in t around 0
lower-/.f6479.4
Applied rewrites79.4%
Final simplification68.0%
(FPCore (x y z t) :precision binary64 (if (<= y 90000000.0) (fma z (/ 1.0 (/ (- -1.0 (/ (+ t (/ (* t t) x)) x)) x)) x) (fma z (- t x) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 90000000.0) {
tmp = fma(z, (1.0 / ((-1.0 - ((t + ((t * t) / x)) / x)) / x)), x);
} else {
tmp = fma(z, (t - x), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= 90000000.0) tmp = fma(z, Float64(1.0 / Float64(Float64(-1.0 - Float64(Float64(t + Float64(Float64(t * t) / x)) / x)) / x)), x); else tmp = fma(z, Float64(t - x), x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, 90000000.0], N[(z * N[(1.0 / N[(N[(-1.0 - N[(N[(t + N[(N[(t * t), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 90000000:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{1}{\frac{-1 - \frac{t + \frac{t \cdot t}{x}}{x}}{x}}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\
\end{array}
\end{array}
if y < 9e7Initial program 98.0%
Taylor expanded in y around inf
+-commutativeN/A
lower-fma.f64N/A
lower--.f6455.3
Applied rewrites55.3%
Applied rewrites40.6%
Taylor expanded in x around inf
Applied rewrites54.1%
Taylor expanded in x around -inf
Applied rewrites62.0%
if 9e7 < y Initial program 86.7%
Taylor expanded in y around inf
+-commutativeN/A
lower-fma.f64N/A
lower--.f6479.6
Applied rewrites79.6%
Final simplification65.9%
(FPCore (x y z t) :precision binary64 (if (<= y 90000000.0) (fma z (/ 1.0 (/ (- -1.0 (/ t x)) x)) x) (fma z (- t x) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 90000000.0) {
tmp = fma(z, (1.0 / ((-1.0 - (t / x)) / x)), x);
} else {
tmp = fma(z, (t - x), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= 90000000.0) tmp = fma(z, Float64(1.0 / Float64(Float64(-1.0 - Float64(t / x)) / x)), x); else tmp = fma(z, Float64(t - x), x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, 90000000.0], N[(z * N[(1.0 / N[(N[(-1.0 - N[(t / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 90000000:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{1}{\frac{-1 - \frac{t}{x}}{x}}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\
\end{array}
\end{array}
if y < 9e7Initial program 98.0%
Taylor expanded in y around inf
+-commutativeN/A
lower-fma.f64N/A
lower--.f6455.3
Applied rewrites55.3%
Applied rewrites40.6%
Taylor expanded in x around inf
Applied rewrites59.9%
if 9e7 < y Initial program 86.7%
Taylor expanded in y around inf
+-commutativeN/A
lower-fma.f64N/A
lower--.f6479.6
Applied rewrites79.6%
Final simplification64.3%
(FPCore (x y z t) :precision binary64 (if (<= y 1.7e-103) (* (- t) (/ x (- t))) (fma z (- t x) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.7e-103) {
tmp = -t * (x / -t);
} else {
tmp = fma(z, (t - x), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= 1.7e-103) tmp = Float64(Float64(-t) * Float64(x / Float64(-t))); else tmp = fma(z, Float64(t - x), x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, 1.7e-103], N[((-t) * N[(x / (-t)), $MachinePrecision]), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.7 \cdot 10^{-103}:\\
\;\;\;\;\left(-t\right) \cdot \frac{x}{-t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\
\end{array}
\end{array}
if y < 1.70000000000000001e-103Initial program 97.9%
Taylor expanded in y around inf
+-commutativeN/A
lower-fma.f64N/A
lower--.f6455.3
Applied rewrites55.3%
Taylor expanded in t around -inf
Applied rewrites47.2%
Taylor expanded in z around 0
Applied rewrites49.6%
if 1.70000000000000001e-103 < y Initial program 89.7%
Taylor expanded in y around inf
+-commutativeN/A
lower-fma.f64N/A
lower--.f6474.1
Applied rewrites74.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* z (- t x)))) (if (<= z -1050000000.0) t_1 (if (<= z 1.25e+39) (fma z (- x) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = z * (t - x);
double tmp;
if (z <= -1050000000.0) {
tmp = t_1;
} else if (z <= 1.25e+39) {
tmp = fma(z, -x, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(z * Float64(t - x)) tmp = 0.0 if (z <= -1050000000.0) tmp = t_1; elseif (z <= 1.25e+39) tmp = fma(z, Float64(-x), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1050000000.0], t$95$1, If[LessEqual[z, 1.25e+39], N[(z * (-x) + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(t - x\right)\\
\mathbf{if}\;z \leq -1050000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{+39}:\\
\;\;\;\;\mathsf{fma}\left(z, -x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.05e9 or 1.25000000000000004e39 < z Initial program 91.3%
Taylor expanded in y around inf
+-commutativeN/A
lower-fma.f64N/A
lower--.f6446.3
Applied rewrites46.3%
Taylor expanded in z around inf
Applied rewrites46.3%
if -1.05e9 < z < 1.25000000000000004e39Initial program 99.3%
Taylor expanded in y around inf
+-commutativeN/A
lower-fma.f64N/A
lower--.f6473.5
Applied rewrites73.5%
Taylor expanded in t around 0
Applied rewrites85.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* z (- x)))) (if (<= x -1.32e-105) t_1 (if (<= x 1.35e-76) (* t z) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = z * -x;
double tmp;
if (x <= -1.32e-105) {
tmp = t_1;
} else if (x <= 1.35e-76) {
tmp = t * z;
} else {
tmp = t_1;
}
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 = z * -x
if (x <= (-1.32d-105)) then
tmp = t_1
else if (x <= 1.35d-76) then
tmp = t * z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * -x;
double tmp;
if (x <= -1.32e-105) {
tmp = t_1;
} else if (x <= 1.35e-76) {
tmp = t * z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -x tmp = 0 if x <= -1.32e-105: tmp = t_1 elif x <= 1.35e-76: tmp = t * z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-x)) tmp = 0.0 if (x <= -1.32e-105) tmp = t_1; elseif (x <= 1.35e-76) tmp = Float64(t * z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * -x; tmp = 0.0; if (x <= -1.32e-105) tmp = t_1; elseif (x <= 1.35e-76) tmp = t * z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-x)), $MachinePrecision]}, If[LessEqual[x, -1.32e-105], t$95$1, If[LessEqual[x, 1.35e-76], N[(t * z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-x\right)\\
\mathbf{if}\;x \leq -1.32 \cdot 10^{-105}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{-76}:\\
\;\;\;\;t \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.32000000000000006e-105 or 1.35e-76 < x Initial program 96.4%
Taylor expanded in y around inf
+-commutativeN/A
lower-fma.f64N/A
lower--.f6464.4
Applied rewrites64.4%
Applied rewrites29.7%
Taylor expanded in z around -inf
Applied rewrites22.1%
Taylor expanded in t around 0
Applied rewrites19.3%
if -1.32000000000000006e-105 < x < 1.35e-76Initial program 94.0%
Taylor expanded in y around inf
+-commutativeN/A
lower-fma.f64N/A
lower--.f6454.5
Applied rewrites54.5%
Taylor expanded in t around inf
Applied rewrites31.7%
Final simplification23.9%
(FPCore (x y z t) :precision binary64 (if (<= y 66000000.0) (fma z (- x) x) (fma z (- t x) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 66000000.0) {
tmp = fma(z, -x, x);
} else {
tmp = fma(z, (t - x), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= 66000000.0) tmp = fma(z, Float64(-x), x); else tmp = fma(z, Float64(t - x), x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, 66000000.0], N[(z * (-x) + x), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 66000000:\\
\;\;\;\;\mathsf{fma}\left(z, -x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\
\end{array}
\end{array}
if y < 6.6e7Initial program 98.0%
Taylor expanded in y around inf
+-commutativeN/A
lower-fma.f64N/A
lower--.f6455.3
Applied rewrites55.3%
Taylor expanded in t around 0
Applied rewrites57.3%
if 6.6e7 < y Initial program 86.7%
Taylor expanded in y around inf
+-commutativeN/A
lower-fma.f64N/A
lower--.f6479.6
Applied rewrites79.6%
(FPCore (x y z t) :precision binary64 (* z (- t x)))
double code(double x, double y, double z, double t) {
return z * (t - 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 = z * (t - x)
end function
public static double code(double x, double y, double z, double t) {
return z * (t - x);
}
def code(x, y, z, t): return z * (t - x)
function code(x, y, z, t) return Float64(z * Float64(t - x)) end
function tmp = code(x, y, z, t) tmp = z * (t - x); end
code[x_, y_, z_, t_] := N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \left(t - x\right)
\end{array}
Initial program 95.5%
Taylor expanded in y around inf
+-commutativeN/A
lower-fma.f64N/A
lower--.f6460.7
Applied rewrites60.7%
Taylor expanded in z around inf
Applied rewrites26.6%
(FPCore (x y z t) :precision binary64 (* t z))
double code(double x, double y, double z, double t) {
return t * z;
}
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 = t * z
end function
public static double code(double x, double y, double z, double t) {
return t * z;
}
def code(x, y, z, t): return t * z
function code(x, y, z, t) return Float64(t * z) end
function tmp = code(x, y, z, t) tmp = t * z; end
code[x_, y_, z_, t_] := N[(t * z), $MachinePrecision]
\begin{array}{l}
\\
t \cdot z
\end{array}
Initial program 95.5%
Taylor expanded in y around inf
+-commutativeN/A
lower-fma.f64N/A
lower--.f6460.7
Applied rewrites60.7%
Taylor expanded in t around inf
Applied rewrites16.9%
Final simplification16.9%
(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 2024233
(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))))))