
(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 14 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 (/ x y))) (t_2 (tanh (/ t y))))
(if (<= (- x (* (- t_1 t_2) (* z y))) 1e+306)
(fma (* (- t_2 t_1) z) y x)
(* (- t x) z))))
double code(double x, double y, double z, double t) {
double t_1 = tanh((x / y));
double t_2 = tanh((t / y));
double tmp;
if ((x - ((t_1 - t_2) * (z * y))) <= 1e+306) {
tmp = fma(((t_2 - t_1) * z), y, x);
} else {
tmp = (t - x) * z;
}
return tmp;
}
function code(x, y, z, t) t_1 = tanh(Float64(x / y)) t_2 = tanh(Float64(t / y)) tmp = 0.0 if (Float64(x - Float64(Float64(t_1 - t_2) * Float64(z * y))) <= 1e+306) tmp = fma(Float64(Float64(t_2 - t_1) * z), y, x); else tmp = Float64(Float64(t - x) * z); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(x - N[(N[(t$95$1 - t$95$2), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+306], N[(N[(N[(t$95$2 - t$95$1), $MachinePrecision] * z), $MachinePrecision] * y + x), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tanh \left(\frac{x}{y}\right)\\
t_2 := \tanh \left(\frac{t}{y}\right)\\
\mathbf{if}\;x - \left(t\_1 - t\_2\right) \cdot \left(z \cdot y\right) \leq 10^{+306}:\\
\;\;\;\;\mathsf{fma}\left(\left(t\_2 - t\_1\right) \cdot z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t - x\right) \cdot z\\
\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.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6498.6
Applied rewrites98.6%
if 1.00000000000000002e306 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) Initial program 40.0%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in z around inf
Applied rewrites100.0%
Final simplification98.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- t x) z))
(t_2
(+
(* (/ 1.0 (/ (+ (/ (fma y x (/ (* (* x x) y) t)) t) y) t)) (* z y))
x))
(t_3 (tanh (/ x y)))
(t_4 (- x (* (- t_3 (tanh (/ t y))) (* z y)))))
(if (<= t_4 (- INFINITY))
t_1
(if (<= t_4 -1e+31)
t_2
(if (<= t_4 2e-21)
(+
(*
(/ 1.0 (/ (+ (/ (fma t (* (/ y x) t) (* t y)) x) y) (- x)))
(* z y))
x)
(if (<= t_4 2e+135)
(fma (* (- (/ t y) t_3) z) y x)
(if (<= t_4 1e+306) t_2 t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = (t - x) * z;
double t_2 = ((1.0 / (((fma(y, x, (((x * x) * y) / t)) / t) + y) / t)) * (z * y)) + x;
double t_3 = tanh((x / y));
double t_4 = x - ((t_3 - tanh((t / y))) * (z * y));
double tmp;
if (t_4 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_4 <= -1e+31) {
tmp = t_2;
} else if (t_4 <= 2e-21) {
tmp = ((1.0 / (((fma(t, ((y / x) * t), (t * y)) / x) + y) / -x)) * (z * y)) + x;
} else if (t_4 <= 2e+135) {
tmp = fma((((t / y) - t_3) * z), y, x);
} else if (t_4 <= 1e+306) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(t - x) * z) t_2 = Float64(Float64(Float64(1.0 / Float64(Float64(Float64(fma(y, x, Float64(Float64(Float64(x * x) * y) / t)) / t) + y) / t)) * Float64(z * y)) + x) t_3 = tanh(Float64(x / y)) t_4 = Float64(x - Float64(Float64(t_3 - tanh(Float64(t / y))) * Float64(z * y))) tmp = 0.0 if (t_4 <= Float64(-Inf)) tmp = t_1; elseif (t_4 <= -1e+31) tmp = t_2; elseif (t_4 <= 2e-21) tmp = Float64(Float64(Float64(1.0 / Float64(Float64(Float64(fma(t, Float64(Float64(y / x) * t), Float64(t * y)) / x) + y) / Float64(-x))) * Float64(z * y)) + x); elseif (t_4 <= 2e+135) tmp = fma(Float64(Float64(Float64(t / y) - t_3) * z), y, x); elseif (t_4 <= 1e+306) tmp = t_2; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(1.0 / N[(N[(N[(N[(y * x + N[(N[(N[(x * x), $MachinePrecision] * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$3 = N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(x - N[(N[(t$95$3 - N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], t$95$1, If[LessEqual[t$95$4, -1e+31], t$95$2, If[LessEqual[t$95$4, 2e-21], N[(N[(N[(1.0 / N[(N[(N[(N[(t * N[(N[(y / x), $MachinePrecision] * t), $MachinePrecision] + N[(t * y), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + y), $MachinePrecision] / (-x)), $MachinePrecision]), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$4, 2e+135], N[(N[(N[(N[(t / y), $MachinePrecision] - t$95$3), $MachinePrecision] * z), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t$95$4, 1e+306], t$95$2, t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - x\right) \cdot z\\
t_2 := \frac{1}{\frac{\frac{\mathsf{fma}\left(y, x, \frac{\left(x \cdot x\right) \cdot y}{t}\right)}{t} + y}{t}} \cdot \left(z \cdot y\right) + x\\
t_3 := \tanh \left(\frac{x}{y}\right)\\
t_4 := x - \left(t\_3 - \tanh \left(\frac{t}{y}\right)\right) \cdot \left(z \cdot y\right)\\
\mathbf{if}\;t\_4 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_4 \leq -1 \cdot 10^{+31}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_4 \leq 2 \cdot 10^{-21}:\\
\;\;\;\;\frac{1}{\frac{\frac{\mathsf{fma}\left(t, \frac{y}{x} \cdot t, t \cdot y\right)}{x} + y}{-x}} \cdot \left(z \cdot y\right) + x\\
\mathbf{elif}\;t\_4 \leq 2 \cdot 10^{+135}:\\
\;\;\;\;\mathsf{fma}\left(\left(\frac{t}{y} - t\_3\right) \cdot z, y, x\right)\\
\mathbf{elif}\;t\_4 \leq 10^{+306}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < -inf.0 or 1.00000000000000002e306 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) Initial program 51.5%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in z around inf
Applied rewrites100.0%
if -inf.0 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < -9.9999999999999996e30 or 1.99999999999999992e135 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 1.00000000000000002e306Initial program 99.9%
Taylor expanded in y around inf
lower-/.f64N/A
lower--.f6438.3
Applied rewrites38.3%
Applied rewrites38.3%
Taylor expanded in t around inf
Applied rewrites61.2%
Taylor expanded in t around -inf
Applied rewrites78.0%
if -9.9999999999999996e30 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 1.99999999999999982e-21Initial program 98.8%
Taylor expanded in y around inf
lower-/.f64N/A
lower--.f6459.5
Applied rewrites59.5%
Applied rewrites59.4%
Taylor expanded in x around -inf
Applied rewrites74.5%
if 1.99999999999999982e-21 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 1.99999999999999992e135Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
Taylor expanded in t around 0
lower-/.f6472.1
Applied rewrites72.1%
Final simplification78.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- t x) z))
(t_2
(+
(* (/ 1.0 (/ (+ (/ (fma y x (/ (* (* x x) y) t)) t) y) t)) (* z y))
x))
(t_3 (tanh (/ t y)))
(t_4 (- x (* (- (tanh (/ x y)) t_3) (* z y)))))
(if (<= t_4 (- INFINITY))
t_1
(if (<= t_4 -2e+84)
t_2
(if (<= t_4 2e+110)
(+ (fma (* t_3 y) z (* (* (- z) y) (/ x y))) x)
(if (<= t_4 1e+306) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (t - x) * z;
double t_2 = ((1.0 / (((fma(y, x, (((x * x) * y) / t)) / t) + y) / t)) * (z * y)) + x;
double t_3 = tanh((t / y));
double t_4 = x - ((tanh((x / y)) - t_3) * (z * y));
double tmp;
if (t_4 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_4 <= -2e+84) {
tmp = t_2;
} else if (t_4 <= 2e+110) {
tmp = fma((t_3 * y), z, ((-z * y) * (x / y))) + x;
} else if (t_4 <= 1e+306) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(t - x) * z) t_2 = Float64(Float64(Float64(1.0 / Float64(Float64(Float64(fma(y, x, Float64(Float64(Float64(x * x) * y) / t)) / t) + y) / t)) * Float64(z * y)) + x) t_3 = tanh(Float64(t / y)) t_4 = Float64(x - Float64(Float64(tanh(Float64(x / y)) - t_3) * Float64(z * y))) tmp = 0.0 if (t_4 <= Float64(-Inf)) tmp = t_1; elseif (t_4 <= -2e+84) tmp = t_2; elseif (t_4 <= 2e+110) tmp = Float64(fma(Float64(t_3 * y), z, Float64(Float64(Float64(-z) * y) * Float64(x / y))) + x); elseif (t_4 <= 1e+306) tmp = t_2; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(1.0 / N[(N[(N[(N[(y * x + N[(N[(N[(x * x), $MachinePrecision] * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$3 = N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(x - N[(N[(N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision] - t$95$3), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], t$95$1, If[LessEqual[t$95$4, -2e+84], t$95$2, If[LessEqual[t$95$4, 2e+110], N[(N[(N[(t$95$3 * y), $MachinePrecision] * z + N[(N[((-z) * y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$4, 1e+306], t$95$2, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - x\right) \cdot z\\
t_2 := \frac{1}{\frac{\frac{\mathsf{fma}\left(y, x, \frac{\left(x \cdot x\right) \cdot y}{t}\right)}{t} + y}{t}} \cdot \left(z \cdot y\right) + x\\
t_3 := \tanh \left(\frac{t}{y}\right)\\
t_4 := x - \left(\tanh \left(\frac{x}{y}\right) - t\_3\right) \cdot \left(z \cdot y\right)\\
\mathbf{if}\;t\_4 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_4 \leq -2 \cdot 10^{+84}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_4 \leq 2 \cdot 10^{+110}:\\
\;\;\;\;\mathsf{fma}\left(t\_3 \cdot y, z, \left(\left(-z\right) \cdot y\right) \cdot \frac{x}{y}\right) + x\\
\mathbf{elif}\;t\_4 \leq 10^{+306}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < -inf.0 or 1.00000000000000002e306 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) Initial program 51.5%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in z around inf
Applied rewrites100.0%
if -inf.0 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < -2.00000000000000012e84 or 2e110 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 1.00000000000000002e306Initial program 99.9%
Taylor expanded in y around inf
lower-/.f64N/A
lower--.f6433.8
Applied rewrites33.8%
Applied rewrites33.8%
Taylor expanded in t around inf
Applied rewrites59.0%
Taylor expanded in t around -inf
Applied rewrites77.6%
if -2.00000000000000012e84 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 2e110Initial program 99.1%
Taylor expanded in y around inf
lower-/.f6483.7
Applied rewrites83.7%
lift-*.f64N/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-neg.f6483.8
Applied rewrites83.8%
Final simplification83.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- t x) z))
(t_2
(+
(* (/ 1.0 (/ (+ (/ (fma y x (/ (* (* x x) y) t)) t) y) t)) (* z y))
x))
(t_3 (tanh (/ t y)))
(t_4 (- x (* (- (tanh (/ x y)) t_3) (* z y)))))
(if (<= t_4 (- INFINITY))
t_1
(if (<= t_4 -2e+84)
t_2
(if (<= t_4 2e+110)
(fma (- t_3 (/ x y)) (* z y) x)
(if (<= t_4 1e+306) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (t - x) * z;
double t_2 = ((1.0 / (((fma(y, x, (((x * x) * y) / t)) / t) + y) / t)) * (z * y)) + x;
double t_3 = tanh((t / y));
double t_4 = x - ((tanh((x / y)) - t_3) * (z * y));
double tmp;
if (t_4 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_4 <= -2e+84) {
tmp = t_2;
} else if (t_4 <= 2e+110) {
tmp = fma((t_3 - (x / y)), (z * y), x);
} else if (t_4 <= 1e+306) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(t - x) * z) t_2 = Float64(Float64(Float64(1.0 / Float64(Float64(Float64(fma(y, x, Float64(Float64(Float64(x * x) * y) / t)) / t) + y) / t)) * Float64(z * y)) + x) t_3 = tanh(Float64(t / y)) t_4 = Float64(x - Float64(Float64(tanh(Float64(x / y)) - t_3) * Float64(z * y))) tmp = 0.0 if (t_4 <= Float64(-Inf)) tmp = t_1; elseif (t_4 <= -2e+84) tmp = t_2; elseif (t_4 <= 2e+110) tmp = fma(Float64(t_3 - Float64(x / y)), Float64(z * y), x); elseif (t_4 <= 1e+306) tmp = t_2; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(1.0 / N[(N[(N[(N[(y * x + N[(N[(N[(x * x), $MachinePrecision] * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$3 = N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(x - N[(N[(N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision] - t$95$3), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], t$95$1, If[LessEqual[t$95$4, -2e+84], t$95$2, If[LessEqual[t$95$4, 2e+110], N[(N[(t$95$3 - N[(x / y), $MachinePrecision]), $MachinePrecision] * N[(z * y), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$4, 1e+306], t$95$2, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - x\right) \cdot z\\
t_2 := \frac{1}{\frac{\frac{\mathsf{fma}\left(y, x, \frac{\left(x \cdot x\right) \cdot y}{t}\right)}{t} + y}{t}} \cdot \left(z \cdot y\right) + x\\
t_3 := \tanh \left(\frac{t}{y}\right)\\
t_4 := x - \left(\tanh \left(\frac{x}{y}\right) - t\_3\right) \cdot \left(z \cdot y\right)\\
\mathbf{if}\;t\_4 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_4 \leq -2 \cdot 10^{+84}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_4 \leq 2 \cdot 10^{+110}:\\
\;\;\;\;\mathsf{fma}\left(t\_3 - \frac{x}{y}, z \cdot y, x\right)\\
\mathbf{elif}\;t\_4 \leq 10^{+306}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < -inf.0 or 1.00000000000000002e306 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) Initial program 51.5%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in z around inf
Applied rewrites100.0%
if -inf.0 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < -2.00000000000000012e84 or 2e110 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 1.00000000000000002e306Initial program 99.9%
Taylor expanded in y around inf
lower-/.f64N/A
lower--.f6433.8
Applied rewrites33.8%
Applied rewrites33.8%
Taylor expanded in t around inf
Applied rewrites59.0%
Taylor expanded in t around -inf
Applied rewrites77.6%
if -2.00000000000000012e84 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 2e110Initial program 99.1%
Taylor expanded in y around inf
lower-/.f6483.7
Applied rewrites83.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6483.7
lift-*.f64N/A
*-commutativeN/A
lift-*.f6483.7
Applied rewrites83.7%
Final simplification83.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- t x) z))
(t_2 (- x (* (- (tanh (/ x y)) (tanh (/ t y))) (* z y))))
(t_3
(+
(* (/ 1.0 (/ (+ (/ (fma y x (/ (* (* x x) y) t)) t) y) t)) (* z y))
x)))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 -1e+31)
t_3
(if (<= t_2 2e-21)
(+
(*
(/ 1.0 (/ (+ (/ (fma t (* (/ y x) t) (* t y)) x) y) (- x)))
(* z y))
x)
(if (<= t_2 1e+306) t_3 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (t - x) * z;
double t_2 = x - ((tanh((x / y)) - tanh((t / y))) * (z * y));
double t_3 = ((1.0 / (((fma(y, x, (((x * x) * y) / t)) / t) + y) / t)) * (z * y)) + x;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= -1e+31) {
tmp = t_3;
} else if (t_2 <= 2e-21) {
tmp = ((1.0 / (((fma(t, ((y / x) * t), (t * y)) / x) + y) / -x)) * (z * y)) + x;
} else if (t_2 <= 1e+306) {
tmp = t_3;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(t - x) * z) t_2 = Float64(x - Float64(Float64(tanh(Float64(x / y)) - tanh(Float64(t / y))) * Float64(z * y))) t_3 = Float64(Float64(Float64(1.0 / Float64(Float64(Float64(fma(y, x, Float64(Float64(Float64(x * x) * y) / t)) / t) + y) / t)) * Float64(z * y)) + x) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= -1e+31) tmp = t_3; elseif (t_2 <= 2e-21) tmp = Float64(Float64(Float64(1.0 / Float64(Float64(Float64(fma(t, Float64(Float64(y / x) * t), Float64(t * y)) / x) + y) / Float64(-x))) * Float64(z * y)) + x); elseif (t_2 <= 1e+306) tmp = t_3; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(N[(N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(1.0 / N[(N[(N[(N[(y * x + N[(N[(N[(x * x), $MachinePrecision] * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, -1e+31], t$95$3, If[LessEqual[t$95$2, 2e-21], N[(N[(N[(1.0 / N[(N[(N[(N[(t * N[(N[(y / x), $MachinePrecision] * t), $MachinePrecision] + N[(t * y), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + y), $MachinePrecision] / (-x)), $MachinePrecision]), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$2, 1e+306], t$95$3, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - x\right) \cdot z\\
t_2 := x - \left(\tanh \left(\frac{x}{y}\right) - \tanh \left(\frac{t}{y}\right)\right) \cdot \left(z \cdot y\right)\\
t_3 := \frac{1}{\frac{\frac{\mathsf{fma}\left(y, x, \frac{\left(x \cdot x\right) \cdot y}{t}\right)}{t} + y}{t}} \cdot \left(z \cdot y\right) + x\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{+31}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-21}:\\
\;\;\;\;\frac{1}{\frac{\frac{\mathsf{fma}\left(t, \frac{y}{x} \cdot t, t \cdot y\right)}{x} + y}{-x}} \cdot \left(z \cdot y\right) + x\\
\mathbf{elif}\;t\_2 \leq 10^{+306}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < -inf.0 or 1.00000000000000002e306 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) Initial program 51.5%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in z around inf
Applied rewrites100.0%
if -inf.0 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < -9.9999999999999996e30 or 1.99999999999999982e-21 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 1.00000000000000002e306Initial program 99.9%
Taylor expanded in y around inf
lower-/.f64N/A
lower--.f6443.9
Applied rewrites43.9%
Applied rewrites43.9%
Taylor expanded in t around inf
Applied rewrites61.0%
Taylor expanded in t around -inf
Applied rewrites73.0%
if -9.9999999999999996e30 < (+.f64 x (*.f64 (*.f64 y z) (-.f64 (tanh.f64 (/.f64 t y)) (tanh.f64 (/.f64 x y))))) < 1.99999999999999982e-21Initial program 98.8%
Taylor expanded in y around inf
lower-/.f64N/A
lower--.f6459.5
Applied rewrites59.5%
Applied rewrites59.4%
Taylor expanded in x around -inf
Applied rewrites74.5%
Final simplification76.9%
(FPCore (x y z t) :precision binary64 (if (<= y 5e+52) (+ (* (/ 1.0 (/ (+ (/ (fma y x (/ (* (* x x) y) t)) t) y) t)) (* z y)) x) (fma (- t x) z x)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5e+52) {
tmp = ((1.0 / (((fma(y, x, (((x * x) * y) / t)) / t) + y) / t)) * (z * y)) + x;
} else {
tmp = fma((t - x), z, x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= 5e+52) tmp = Float64(Float64(Float64(1.0 / Float64(Float64(Float64(fma(y, x, Float64(Float64(Float64(x * x) * y) / t)) / t) + y) / t)) * Float64(z * y)) + x); else tmp = fma(Float64(t - x), z, x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, 5e+52], N[(N[(N[(1.0 / N[(N[(N[(N[(y * x + N[(N[(N[(x * x), $MachinePrecision] * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * z + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5 \cdot 10^{+52}:\\
\;\;\;\;\frac{1}{\frac{\frac{\mathsf{fma}\left(y, x, \frac{\left(x \cdot x\right) \cdot y}{t}\right)}{t} + y}{t}} \cdot \left(z \cdot y\right) + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, z, x\right)\\
\end{array}
\end{array}
if y < 5e52Initial program 96.6%
Taylor expanded in y around inf
lower-/.f64N/A
lower--.f6445.2
Applied rewrites45.2%
Applied rewrites45.1%
Taylor expanded in t around inf
Applied rewrites54.0%
Taylor expanded in t around -inf
Applied rewrites60.1%
if 5e52 < y Initial program 81.5%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6487.4
Applied rewrites87.4%
Final simplification65.8%
(FPCore (x y z t)
:precision binary64
(if (<= y 1.32e-216)
(fma (- x) z x)
(if (<= y 23.0)
(+ (* (/ 1.0 (/ (fma (/ y t) x y) t)) (* z y)) x)
(fma (- t x) z x))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.32e-216) {
tmp = fma(-x, z, x);
} else if (y <= 23.0) {
tmp = ((1.0 / (fma((y / t), x, y) / t)) * (z * y)) + x;
} else {
tmp = fma((t - x), z, x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= 1.32e-216) tmp = fma(Float64(-x), z, x); elseif (y <= 23.0) tmp = Float64(Float64(Float64(1.0 / Float64(fma(Float64(y / t), x, y) / t)) * Float64(z * y)) + x); else tmp = fma(Float64(t - x), z, x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, 1.32e-216], N[((-x) * z + x), $MachinePrecision], If[LessEqual[y, 23.0], N[(N[(N[(1.0 / N[(N[(N[(y / t), $MachinePrecision] * x + y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.32 \cdot 10^{-216}:\\
\;\;\;\;\mathsf{fma}\left(-x, z, x\right)\\
\mathbf{elif}\;y \leq 23:\\
\;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(\frac{y}{t}, x, y\right)}{t}} \cdot \left(z \cdot y\right) + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, z, x\right)\\
\end{array}
\end{array}
if y < 1.31999999999999997e-216Initial program 95.1%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6459.9
Applied rewrites59.9%
Taylor expanded in t around 0
Applied rewrites52.9%
if 1.31999999999999997e-216 < y < 23Initial program 99.9%
Taylor expanded in y around inf
lower-/.f64N/A
lower--.f6435.4
Applied rewrites35.4%
Applied rewrites35.4%
Taylor expanded in t around inf
Applied rewrites55.9%
if 23 < y Initial program 83.7%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6481.1
Applied rewrites81.1%
Final simplification60.2%
(FPCore (x y z t)
:precision binary64
(if (<= y 3.2e-105)
(fma (- x) z x)
(if (<= y 3300000.0)
(+ (* (* (/ (* (/ y x) t) (* y y)) x) (* z y)) x)
(fma (- t x) z x))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3.2e-105) {
tmp = fma(-x, z, x);
} else if (y <= 3300000.0) {
tmp = (((((y / x) * t) / (y * y)) * x) * (z * y)) + x;
} else {
tmp = fma((t - x), z, x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= 3.2e-105) tmp = fma(Float64(-x), z, x); elseif (y <= 3300000.0) tmp = Float64(Float64(Float64(Float64(Float64(Float64(y / x) * t) / Float64(y * y)) * x) * Float64(z * y)) + x); else tmp = fma(Float64(t - x), z, x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, 3.2e-105], N[((-x) * z + x), $MachinePrecision], If[LessEqual[y, 3300000.0], N[(N[(N[(N[(N[(N[(y / x), $MachinePrecision] * t), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.2 \cdot 10^{-105}:\\
\;\;\;\;\mathsf{fma}\left(-x, z, x\right)\\
\mathbf{elif}\;y \leq 3300000:\\
\;\;\;\;\left(\frac{\frac{y}{x} \cdot t}{y \cdot y} \cdot x\right) \cdot \left(z \cdot y\right) + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, z, x\right)\\
\end{array}
\end{array}
if y < 3.19999999999999981e-105Initial program 96.0%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6454.9
Applied rewrites54.9%
Taylor expanded in t around 0
Applied rewrites51.9%
if 3.19999999999999981e-105 < y < 3.3e6Initial program 99.8%
Taylor expanded in y around inf
lower-/.f64N/A
lower--.f6441.7
Applied rewrites41.7%
Taylor expanded in t around inf
Applied rewrites59.9%
Applied rewrites63.3%
if 3.3e6 < y Initial program 83.1%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6483.6
Applied rewrites83.6%
Final simplification60.3%
(FPCore (x y z t) :precision binary64 (if (<= y 1.75e-202) (fma (- x) z x) (if (<= y 3300000.0) (+ (* (/ t y) (* z y)) x) (fma (- t x) z x))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.75e-202) {
tmp = fma(-x, z, x);
} else if (y <= 3300000.0) {
tmp = ((t / y) * (z * y)) + x;
} else {
tmp = fma((t - x), z, x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= 1.75e-202) tmp = fma(Float64(-x), z, x); elseif (y <= 3300000.0) tmp = Float64(Float64(Float64(t / y) * Float64(z * y)) + x); else tmp = fma(Float64(t - x), z, x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, 1.75e-202], N[((-x) * z + x), $MachinePrecision], If[LessEqual[y, 3300000.0], N[(N[(N[(t / y), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.75 \cdot 10^{-202}:\\
\;\;\;\;\mathsf{fma}\left(-x, z, x\right)\\
\mathbf{elif}\;y \leq 3300000:\\
\;\;\;\;\frac{t}{y} \cdot \left(z \cdot y\right) + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, z, x\right)\\
\end{array}
\end{array}
if y < 1.75e-202Initial program 95.2%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6458.7
Applied rewrites58.7%
Taylor expanded in t around 0
Applied rewrites52.5%
if 1.75e-202 < y < 3.3e6Initial program 99.9%
Taylor expanded in y around inf
lower-/.f64N/A
lower--.f6436.2
Applied rewrites36.2%
Taylor expanded in t around inf
Applied rewrites55.5%
if 3.3e6 < y Initial program 83.1%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6483.6
Applied rewrites83.6%
Final simplification60.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- t x) z))) (if (<= z -0.66) t_1 (if (<= z 2050000.0) (fma (- x) z x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (t - x) * z;
double tmp;
if (z <= -0.66) {
tmp = t_1;
} else if (z <= 2050000.0) {
tmp = fma(-x, z, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(t - x) * z) tmp = 0.0 if (z <= -0.66) tmp = t_1; elseif (z <= 2050000.0) tmp = fma(Float64(-x), z, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -0.66], t$95$1, If[LessEqual[z, 2050000.0], N[((-x) * z + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - x\right) \cdot z\\
\mathbf{if}\;z \leq -0.66:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2050000:\\
\;\;\;\;\mathsf{fma}\left(-x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -0.660000000000000031 or 2.05e6 < z Initial program 86.7%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6444.1
Applied rewrites44.1%
Taylor expanded in z around inf
Applied rewrites44.1%
if -0.660000000000000031 < z < 2.05e6Initial program 100.0%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6475.3
Applied rewrites75.3%
Taylor expanded in t around 0
Applied rewrites80.9%
(FPCore (x y z t) :precision binary64 (if (<= t -1.7e-160) (* t z) (if (<= t 1.6e-8) (* (- x) z) (* t z))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.7e-160) {
tmp = t * z;
} else if (t <= 1.6e-8) {
tmp = -x * z;
} else {
tmp = t * 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 (t <= (-1.7d-160)) then
tmp = t * z
else if (t <= 1.6d-8) then
tmp = -x * z
else
tmp = t * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.7e-160) {
tmp = t * z;
} else if (t <= 1.6e-8) {
tmp = -x * z;
} else {
tmp = t * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.7e-160: tmp = t * z elif t <= 1.6e-8: tmp = -x * z else: tmp = t * z return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.7e-160) tmp = Float64(t * z); elseif (t <= 1.6e-8) tmp = Float64(Float64(-x) * z); else tmp = Float64(t * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.7e-160) tmp = t * z; elseif (t <= 1.6e-8) tmp = -x * z; else tmp = t * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.7e-160], N[(t * z), $MachinePrecision], If[LessEqual[t, 1.6e-8], N[((-x) * z), $MachinePrecision], N[(t * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.7 \cdot 10^{-160}:\\
\;\;\;\;t \cdot z\\
\mathbf{elif}\;t \leq 1.6 \cdot 10^{-8}:\\
\;\;\;\;\left(-x\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;t \cdot z\\
\end{array}
\end{array}
if t < -1.70000000000000011e-160 or 1.6000000000000001e-8 < t Initial program 96.3%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6456.3
Applied rewrites56.3%
Taylor expanded in t around inf
Applied rewrites24.5%
if -1.70000000000000011e-160 < t < 1.6000000000000001e-8Initial program 88.9%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6466.2
Applied rewrites66.2%
Taylor expanded in z around inf
Applied rewrites29.9%
Taylor expanded in t around 0
Applied rewrites23.6%
(FPCore (x y z t) :precision binary64 (if (<= y 2e-91) (fma (- x) z x) (fma (- t x) z x)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2e-91) {
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 <= 2e-91) 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, 2e-91], N[((-x) * z + x), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * z + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2 \cdot 10^{-91}:\\
\;\;\;\;\mathsf{fma}\left(-x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, z, x\right)\\
\end{array}
\end{array}
if y < 2.00000000000000004e-91Initial program 96.1%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6453.5
Applied rewrites53.5%
Taylor expanded in t around 0
Applied rewrites51.2%
if 2.00000000000000004e-91 < y Initial program 87.6%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6474.8
Applied rewrites74.8%
(FPCore (x y z t) :precision binary64 (* (- t x) z))
double code(double x, double y, double z, double t) {
return (t - x) * 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 - x) * z
end function
public static double code(double x, double y, double z, double t) {
return (t - x) * z;
}
def code(x, y, z, t): return (t - x) * z
function code(x, y, z, t) return Float64(Float64(t - x) * z) end
function tmp = code(x, y, z, t) tmp = (t - x) * z; end
code[x_, y_, z_, t_] := N[(N[(t - x), $MachinePrecision] * z), $MachinePrecision]
\begin{array}{l}
\\
\left(t - x\right) \cdot z
\end{array}
Initial program 93.5%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6460.1
Applied rewrites60.1%
Taylor expanded in z around inf
Applied rewrites27.9%
(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 93.5%
Taylor expanded in y around inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6460.1
Applied rewrites60.1%
Taylor expanded in t around inf
Applied rewrites18.8%
(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 2024244
(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))))))