
(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}
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 1.65e+187) (fma (* y (- (tanh (/ t y)) (tanh (/ x y)))) z x) (+ x (* z (- t x)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.65e+187) {
tmp = fma((y * (tanh((t / y)) - tanh((x / y)))), z, x);
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 1.65e+187) tmp = fma(Float64(y * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))), z, x); else tmp = Float64(x + Float64(z * Float64(t - x))); end return tmp end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 1.65e+187], N[(N[(y * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z + x), $MachinePrecision], N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.65 \cdot 10^{+187}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), z, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 1.6500000000000001e187Initial program 94.8%
+-commutative94.8%
*-commutative94.8%
associate-*r*98.1%
fma-def98.2%
Applied egg-rr98.2%
if 1.6500000000000001e187 < y Initial program 60.7%
Taylor expanded in y around inf 100.0%
Final simplification98.3%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 3.1e+178) (+ x (* (- (tanh (/ t y)) (tanh (/ x y))) (* y z))) (+ x (* z (- t x)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3.1e+178) {
tmp = x + ((tanh((t / y)) - tanh((x / y))) * (y * z));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
NOTE: y should be positive before calling this function
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 <= 3.1d+178) then
tmp = x + ((tanh((t / y)) - tanh((x / y))) * (y * z))
else
tmp = x + (z * (t - x))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3.1e+178) {
tmp = x + ((Math.tanh((t / y)) - Math.tanh((x / y))) * (y * z));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 3.1e+178: tmp = x + ((math.tanh((t / y)) - math.tanh((x / y))) * (y * z)) else: tmp = x + (z * (t - x)) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 3.1e+178) tmp = Float64(x + Float64(Float64(tanh(Float64(t / y)) - tanh(Float64(x / y))) * Float64(y * z))); else tmp = Float64(x + Float64(z * Float64(t - x))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 3.1e+178) tmp = x + ((tanh((t / y)) - tanh((x / y))) * (y * z)); else tmp = x + (z * (t - x)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 3.1e+178], 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], N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.1 \cdot 10^{+178}:\\
\;\;\;\;x + \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 3.09999999999999991e178Initial program 94.8%
if 3.09999999999999991e178 < y Initial program 64.0%
Taylor expanded in y around inf 96.2%
Final simplification94.9%
NOTE: y should be positive before calling this function
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (tanh (/ t y))))
(if (<= y 3.4e+44)
(fma (* y t_1) z x)
(if (<= y 5.1e+75)
(+ x (* (* y z) (- (/ t y) (tanh (/ x y)))))
(if (<= y 1.55e+113) (+ x (* t_1 (* y z))) (+ x (* z (- t x))))))))y = abs(y);
double code(double x, double y, double z, double t) {
double t_1 = tanh((t / y));
double tmp;
if (y <= 3.4e+44) {
tmp = fma((y * t_1), z, x);
} else if (y <= 5.1e+75) {
tmp = x + ((y * z) * ((t / y) - tanh((x / y))));
} else if (y <= 1.55e+113) {
tmp = x + (t_1 * (y * z));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y = abs(y) function code(x, y, z, t) t_1 = tanh(Float64(t / y)) tmp = 0.0 if (y <= 3.4e+44) tmp = fma(Float64(y * t_1), z, x); elseif (y <= 5.1e+75) tmp = Float64(x + Float64(Float64(y * z) * Float64(Float64(t / y) - tanh(Float64(x / y))))); elseif (y <= 1.55e+113) tmp = Float64(x + Float64(t_1 * Float64(y * z))); else tmp = Float64(x + Float64(z * Float64(t - x))); end return tmp end
NOTE: y should be positive before calling this function
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 3.4e+44], N[(N[(y * t$95$1), $MachinePrecision] * z + x), $MachinePrecision], If[LessEqual[y, 5.1e+75], N[(x + N[(N[(y * z), $MachinePrecision] * N[(N[(t / y), $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.55e+113], N[(x + N[(t$95$1 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
t_1 := \tanh \left(\frac{t}{y}\right)\\
\mathbf{if}\;y \leq 3.4 \cdot 10^{+44}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot t_1, z, x\right)\\
\mathbf{elif}\;y \leq 5.1 \cdot 10^{+75}:\\
\;\;\;\;x + \left(y \cdot z\right) \cdot \left(\frac{t}{y} - \tanh \left(\frac{x}{y}\right)\right)\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{+113}:\\
\;\;\;\;x + t_1 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 3.4e44Initial program 95.0%
+-commutative95.0%
*-commutative95.0%
associate-*r*98.4%
fma-def98.4%
Applied egg-rr98.4%
Taylor expanded in x around 0 25.6%
associate-/r*25.6%
div-sub25.6%
rec-exp25.7%
rec-exp25.7%
tanh-def-a81.8%
Simplified81.8%
if 3.4e44 < y < 5.10000000000000037e75Initial program 99.7%
Taylor expanded in t around 0 83.9%
if 5.10000000000000037e75 < y < 1.54999999999999996e113Initial program 100.0%
Taylor expanded in x around 0 34.3%
*-commutative34.3%
associate-/r*34.3%
div-sub34.3%
rec-exp34.3%
rec-exp34.3%
tanh-def-a88.9%
Simplified88.9%
if 1.54999999999999996e113 < y Initial program 70.7%
Taylor expanded in y around inf 87.2%
Final simplification82.9%
NOTE: y should be positive before calling this function
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* (tanh (/ t y)) (* y z)))))
(if (<= y 2.9e+44)
t_1
(if (<= y 1.36e+76)
(+ x (* (* y z) (- (/ t y) (tanh (/ x y)))))
(if (<= y 4.1e+113) t_1 (+ x (* z (- t x))))))))y = abs(y);
double code(double x, double y, double z, double t) {
double t_1 = x + (tanh((t / y)) * (y * z));
double tmp;
if (y <= 2.9e+44) {
tmp = t_1;
} else if (y <= 1.36e+76) {
tmp = x + ((y * z) * ((t / y) - tanh((x / y))));
} else if (y <= 4.1e+113) {
tmp = t_1;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
NOTE: y should be positive before calling this function
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)) * (y * z))
if (y <= 2.9d+44) then
tmp = t_1
else if (y <= 1.36d+76) then
tmp = x + ((y * z) * ((t / y) - tanh((x / y))))
else if (y <= 4.1d+113) then
tmp = t_1
else
tmp = x + (z * (t - x))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
double t_1 = x + (Math.tanh((t / y)) * (y * z));
double tmp;
if (y <= 2.9e+44) {
tmp = t_1;
} else if (y <= 1.36e+76) {
tmp = x + ((y * z) * ((t / y) - Math.tanh((x / y))));
} else if (y <= 4.1e+113) {
tmp = t_1;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): t_1 = x + (math.tanh((t / y)) * (y * z)) tmp = 0 if y <= 2.9e+44: tmp = t_1 elif y <= 1.36e+76: tmp = x + ((y * z) * ((t / y) - math.tanh((x / y)))) elif y <= 4.1e+113: tmp = t_1 else: tmp = x + (z * (t - x)) return tmp
y = abs(y) function code(x, y, z, t) t_1 = Float64(x + Float64(tanh(Float64(t / y)) * Float64(y * z))) tmp = 0.0 if (y <= 2.9e+44) tmp = t_1; elseif (y <= 1.36e+76) tmp = Float64(x + Float64(Float64(y * z) * Float64(Float64(t / y) - tanh(Float64(x / y))))); elseif (y <= 4.1e+113) tmp = t_1; else tmp = Float64(x + Float64(z * Float64(t - x))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) t_1 = x + (tanh((t / y)) * (y * z)); tmp = 0.0; if (y <= 2.9e+44) tmp = t_1; elseif (y <= 1.36e+76) tmp = x + ((y * z) * ((t / y) - tanh((x / y)))); elseif (y <= 4.1e+113) tmp = t_1; else tmp = x + (z * (t - x)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 2.9e+44], t$95$1, If[LessEqual[y, 1.36e+76], N[(x + N[(N[(y * z), $MachinePrecision] * N[(N[(t / y), $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.1e+113], t$95$1, N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
t_1 := x + \tanh \left(\frac{t}{y}\right) \cdot \left(y \cdot z\right)\\
\mathbf{if}\;y \leq 2.9 \cdot 10^{+44}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.36 \cdot 10^{+76}:\\
\;\;\;\;x + \left(y \cdot z\right) \cdot \left(\frac{t}{y} - \tanh \left(\frac{x}{y}\right)\right)\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{+113}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 2.9000000000000002e44 or 1.36000000000000004e76 < y < 4.09999999999999993e113Initial program 95.3%
Taylor expanded in x around 0 26.0%
*-commutative26.0%
associate-/r*26.0%
div-sub26.0%
rec-exp26.0%
rec-exp26.0%
tanh-def-a81.9%
Simplified81.6%
if 2.9000000000000002e44 < y < 1.36000000000000004e76Initial program 99.7%
Taylor expanded in t around 0 83.9%
if 4.09999999999999993e113 < y Initial program 70.7%
Taylor expanded in y around inf 87.2%
Final simplification82.4%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 1.14e+114) (+ x (* (tanh (/ t y)) (* y z))) (+ x (* z (- t x)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.14e+114) {
tmp = x + (tanh((t / y)) * (y * z));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
NOTE: y should be positive before calling this function
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 <= 1.14d+114) then
tmp = x + (tanh((t / y)) * (y * z))
else
tmp = x + (z * (t - x))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.14e+114) {
tmp = x + (Math.tanh((t / y)) * (y * z));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 1.14e+114: tmp = x + (math.tanh((t / y)) * (y * z)) else: tmp = x + (z * (t - x)) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 1.14e+114) tmp = Float64(x + Float64(tanh(Float64(t / y)) * Float64(y * z))); else tmp = Float64(x + Float64(z * Float64(t - x))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 1.14e+114) tmp = x + (tanh((t / y)) * (y * z)); else tmp = x + (z * (t - x)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 1.14e+114], 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}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.14 \cdot 10^{+114}:\\
\;\;\;\;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 < 1.14e114Initial program 95.4%
Taylor expanded in x around 0 25.3%
*-commutative25.3%
associate-/r*25.3%
div-sub25.3%
rec-exp25.4%
rec-exp25.4%
tanh-def-a80.6%
Simplified80.8%
if 1.14e114 < y Initial program 70.7%
Taylor expanded in y around inf 87.2%
Final simplification81.7%
NOTE: y should be positive before calling this function
(FPCore (x y z t)
:precision binary64
(if (<= y 1.95e+59)
x
(if (or (<= y 6.3e+187) (not (<= y 2.7e+259)))
(* x (- 1.0 z))
(* z (- t x)))))y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.95e+59) {
tmp = x;
} else if ((y <= 6.3e+187) || !(y <= 2.7e+259)) {
tmp = x * (1.0 - z);
} else {
tmp = z * (t - x);
}
return tmp;
}
NOTE: y should be positive before calling this function
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 <= 1.95d+59) then
tmp = x
else if ((y <= 6.3d+187) .or. (.not. (y <= 2.7d+259))) then
tmp = x * (1.0d0 - z)
else
tmp = z * (t - x)
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.95e+59) {
tmp = x;
} else if ((y <= 6.3e+187) || !(y <= 2.7e+259)) {
tmp = x * (1.0 - z);
} else {
tmp = z * (t - x);
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 1.95e+59: tmp = x elif (y <= 6.3e+187) or not (y <= 2.7e+259): tmp = x * (1.0 - z) else: tmp = z * (t - x) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 1.95e+59) tmp = x; elseif ((y <= 6.3e+187) || !(y <= 2.7e+259)) tmp = Float64(x * Float64(1.0 - z)); else tmp = Float64(z * Float64(t - x)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 1.95e+59) tmp = x; elseif ((y <= 6.3e+187) || ~((y <= 2.7e+259))) tmp = x * (1.0 - z); else tmp = z * (t - x); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 1.95e+59], x, If[Or[LessEqual[y, 6.3e+187], N[Not[LessEqual[y, 2.7e+259]], $MachinePrecision]], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.95 \cdot 10^{+59}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 6.3 \cdot 10^{+187} \lor \neg \left(y \leq 2.7 \cdot 10^{+259}\right):\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 1.95000000000000011e59Initial program 95.1%
Taylor expanded in x around inf 65.3%
if 1.95000000000000011e59 < y < 6.30000000000000005e187 or 2.69999999999999988e259 < y Initial program 86.0%
Taylor expanded in y around inf 75.5%
Taylor expanded in x around inf 60.7%
Taylor expanded in z around 0 60.7%
associate-*r*60.7%
distribute-lft1-in60.7%
*-commutative60.7%
+-commutative60.7%
mul-1-neg60.7%
unsub-neg60.7%
Simplified60.7%
if 6.30000000000000005e187 < y < 2.69999999999999988e259Initial program 52.4%
Taylor expanded in y around inf 100.0%
Taylor expanded in z around inf 82.8%
Final simplification65.4%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 8.5e+187) x (if (<= y 1.9e+257) (* t z) (if (<= y 6.1e+294) x (* x (- z))))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 8.5e+187) {
tmp = x;
} else if (y <= 1.9e+257) {
tmp = t * z;
} else if (y <= 6.1e+294) {
tmp = x;
} else {
tmp = x * -z;
}
return tmp;
}
NOTE: y should be positive before calling this function
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 <= 8.5d+187) then
tmp = x
else if (y <= 1.9d+257) then
tmp = t * z
else if (y <= 6.1d+294) then
tmp = x
else
tmp = x * -z
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 8.5e+187) {
tmp = x;
} else if (y <= 1.9e+257) {
tmp = t * z;
} else if (y <= 6.1e+294) {
tmp = x;
} else {
tmp = x * -z;
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 8.5e+187: tmp = x elif y <= 1.9e+257: tmp = t * z elif y <= 6.1e+294: tmp = x else: tmp = x * -z return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 8.5e+187) tmp = x; elseif (y <= 1.9e+257) tmp = Float64(t * z); elseif (y <= 6.1e+294) tmp = x; else tmp = Float64(x * Float64(-z)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 8.5e+187) tmp = x; elseif (y <= 1.9e+257) tmp = t * z; elseif (y <= 6.1e+294) tmp = x; else tmp = x * -z; end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 8.5e+187], x, If[LessEqual[y, 1.9e+257], N[(t * z), $MachinePrecision], If[LessEqual[y, 6.1e+294], x, N[(x * (-z)), $MachinePrecision]]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 8.5 \cdot 10^{+187}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+257}:\\
\;\;\;\;t \cdot z\\
\mathbf{elif}\;y \leq 6.1 \cdot 10^{+294}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-z\right)\\
\end{array}
\end{array}
if y < 8.49999999999999989e187 or 1.89999999999999999e257 < y < 6.1000000000000002e294Initial program 93.9%
Taylor expanded in x around inf 61.5%
if 8.49999999999999989e187 < y < 1.89999999999999999e257Initial program 52.4%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around 0 38.5%
if 6.1000000000000002e294 < y Initial program 37.4%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around inf 37.4%
Taylor expanded in z around inf 7.4%
associate-*r*7.4%
mul-1-neg7.4%
Simplified7.4%
Final simplification60.3%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 4.4e+188) x (if (<= y 2.8e+252) (* t z) (if (<= y 1.65e+275) x (* t z)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.4e+188) {
tmp = x;
} else if (y <= 2.8e+252) {
tmp = t * z;
} else if (y <= 1.65e+275) {
tmp = x;
} else {
tmp = t * z;
}
return tmp;
}
NOTE: y should be positive before calling this function
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 <= 4.4d+188) then
tmp = x
else if (y <= 2.8d+252) then
tmp = t * z
else if (y <= 1.65d+275) then
tmp = x
else
tmp = t * z
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.4e+188) {
tmp = x;
} else if (y <= 2.8e+252) {
tmp = t * z;
} else if (y <= 1.65e+275) {
tmp = x;
} else {
tmp = t * z;
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 4.4e+188: tmp = x elif y <= 2.8e+252: tmp = t * z elif y <= 1.65e+275: tmp = x else: tmp = t * z return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 4.4e+188) tmp = x; elseif (y <= 2.8e+252) tmp = Float64(t * z); elseif (y <= 1.65e+275) tmp = x; else tmp = Float64(t * z); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 4.4e+188) tmp = x; elseif (y <= 2.8e+252) tmp = t * z; elseif (y <= 1.65e+275) tmp = x; else tmp = t * z; end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 4.4e+188], x, If[LessEqual[y, 2.8e+252], N[(t * z), $MachinePrecision], If[LessEqual[y, 1.65e+275], x, N[(t * z), $MachinePrecision]]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.4 \cdot 10^{+188}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{+252}:\\
\;\;\;\;t \cdot z\\
\mathbf{elif}\;y \leq 1.65 \cdot 10^{+275}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t \cdot z\\
\end{array}
\end{array}
if y < 4.39999999999999998e188 or 2.80000000000000003e252 < y < 1.65000000000000011e275Initial program 94.9%
Taylor expanded in x around inf 62.2%
if 4.39999999999999998e188 < y < 2.80000000000000003e252 or 1.65000000000000011e275 < y Initial program 52.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around 0 41.0%
Final simplification60.7%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 4.3e+61) x (+ x (* z (- t x)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.3e+61) {
tmp = x;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
NOTE: y should be positive before calling this function
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 <= 4.3d+61) then
tmp = x
else
tmp = x + (z * (t - x))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.3e+61) {
tmp = x;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 4.3e+61: tmp = x else: tmp = x + (z * (t - x)) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 4.3e+61) tmp = x; else tmp = Float64(x + Float64(z * Float64(t - x))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 4.3e+61) tmp = x; else tmp = x + (z * (t - x)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 4.3e+61], x, N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.3 \cdot 10^{+61}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 4.3000000000000001e61Initial program 95.1%
Taylor expanded in x around inf 65.3%
if 4.3000000000000001e61 < y Initial program 78.5%
Taylor expanded in y around inf 81.0%
Final simplification68.3%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 2e+61) x (* x (- 1.0 z))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2e+61) {
tmp = x;
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
NOTE: y should be positive before calling this function
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 <= 2d+61) then
tmp = x
else
tmp = x * (1.0d0 - z)
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2e+61) {
tmp = x;
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 2e+61: tmp = x else: tmp = x * (1.0 - z) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 2e+61) tmp = x; else tmp = Float64(x * Float64(1.0 - z)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 2e+61) tmp = x; else tmp = x * (1.0 - z); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 2e+61], x, N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2 \cdot 10^{+61}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if y < 1.9999999999999999e61Initial program 95.1%
Taylor expanded in x around inf 65.3%
if 1.9999999999999999e61 < y Initial program 78.5%
Taylor expanded in y around inf 81.0%
Taylor expanded in x around inf 60.7%
Taylor expanded in z around 0 60.7%
associate-*r*60.7%
distribute-lft1-in60.7%
*-commutative60.7%
+-commutative60.7%
mul-1-neg60.7%
unsub-neg60.7%
Simplified60.7%
Final simplification64.4%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 x)
y = abs(y);
double code(double x, double y, double z, double t) {
return x;
}
NOTE: y should be positive before calling this function
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
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
return x;
}
y = abs(y) def code(x, y, z, t): return x
y = abs(y) function code(x, y, z, t) return x end
y = abs(y) function tmp = code(x, y, z, t) tmp = x; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := x
\begin{array}{l}
y = |y|\\
\\
x
\end{array}
Initial program 91.9%
Taylor expanded in x around inf 59.5%
Final simplification59.5%
(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 2023268
(FPCore (x y z t)
:name "SynthBasics:moogVCF from YampaSynth-0.2"
:precision binary64
:herbie-target
(+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y))))))
(+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))