
(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 10 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 (+ 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}
Initial program 95.1%
associate-*l*98.0%
Simplified98.0%
Final simplification98.0%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.75e-87) (not (<= t 1.5e-89))) (+ x (* (tanh (/ t y)) (* y z))) (+ x (* (* y z) (- (/ t y) (tanh (/ x y)))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.75e-87) || !(t <= 1.5e-89)) {
tmp = x + (tanh((t / y)) * (y * z));
} else {
tmp = x + ((y * z) * ((t / y) - tanh((x / y))));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-1.75d-87)) .or. (.not. (t <= 1.5d-89))) then
tmp = x + (tanh((t / y)) * (y * z))
else
tmp = x + ((y * z) * ((t / y) - tanh((x / y))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.75e-87) || !(t <= 1.5e-89)) {
tmp = x + (Math.tanh((t / y)) * (y * z));
} else {
tmp = x + ((y * z) * ((t / y) - Math.tanh((x / y))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.75e-87) or not (t <= 1.5e-89): tmp = x + (math.tanh((t / y)) * (y * z)) else: tmp = x + ((y * z) * ((t / y) - math.tanh((x / y)))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.75e-87) || !(t <= 1.5e-89)) tmp = Float64(x + Float64(tanh(Float64(t / y)) * Float64(y * z))); else tmp = Float64(x + Float64(Float64(y * z) * Float64(Float64(t / y) - tanh(Float64(x / y))))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.75e-87) || ~((t <= 1.5e-89))) tmp = x + (tanh((t / y)) * (y * z)); else tmp = x + ((y * z) * ((t / y) - tanh((x / y)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.75e-87], N[Not[LessEqual[t, 1.5e-89]], $MachinePrecision]], N[(x + N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] * N[(N[(t / y), $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.75 \cdot 10^{-87} \lor \neg \left(t \leq 1.5 \cdot 10^{-89}\right):\\
\;\;\;\;x + \tanh \left(\frac{t}{y}\right) \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y \cdot z\right) \cdot \left(\frac{t}{y} - \tanh \left(\frac{x}{y}\right)\right)\\
\end{array}
\end{array}
if t < -1.75000000000000006e-87 or 1.5e-89 < t Initial program 95.4%
associate-*l*97.9%
Simplified97.9%
Taylor expanded in x around 0 9.7%
associate-*r*9.6%
associate-/r*9.6%
div-sub9.6%
rec-exp9.6%
rec-exp9.6%
tanh-def-a88.7%
Simplified88.7%
if -1.75000000000000006e-87 < t < 1.5e-89Initial program 94.7%
Taylor expanded in t around 0 88.8%
Final simplification88.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (tanh (/ t y))))
(if (<= y 9.8e-157)
x
(if (<= y 3.4e-54) (+ x (* t_1 (* y z))) (+ x (* z (- (* y t_1) x)))))))
double code(double x, double y, double z, double t) {
double t_1 = tanh((t / y));
double tmp;
if (y <= 9.8e-157) {
tmp = x;
} else if (y <= 3.4e-54) {
tmp = x + (t_1 * (y * z));
} else {
tmp = x + (z * ((y * t_1) - x));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = tanh((t / y))
if (y <= 9.8d-157) then
tmp = x
else if (y <= 3.4d-54) then
tmp = x + (t_1 * (y * z))
else
tmp = x + (z * ((y * t_1) - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.tanh((t / y));
double tmp;
if (y <= 9.8e-157) {
tmp = x;
} else if (y <= 3.4e-54) {
tmp = x + (t_1 * (y * z));
} else {
tmp = x + (z * ((y * t_1) - x));
}
return tmp;
}
def code(x, y, z, t): t_1 = math.tanh((t / y)) tmp = 0 if y <= 9.8e-157: tmp = x elif y <= 3.4e-54: tmp = x + (t_1 * (y * z)) else: tmp = x + (z * ((y * t_1) - x)) return tmp
function code(x, y, z, t) t_1 = tanh(Float64(t / y)) tmp = 0.0 if (y <= 9.8e-157) tmp = x; elseif (y <= 3.4e-54) tmp = Float64(x + Float64(t_1 * Float64(y * z))); else tmp = Float64(x + Float64(z * Float64(Float64(y * t_1) - x))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = tanh((t / y)); tmp = 0.0; if (y <= 9.8e-157) tmp = x; elseif (y <= 3.4e-54) tmp = x + (t_1 * (y * z)); else tmp = x + (z * ((y * t_1) - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 9.8e-157], x, If[LessEqual[y, 3.4e-54], N[(x + N[(t$95$1 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(N[(y * t$95$1), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tanh \left(\frac{t}{y}\right)\\
\mathbf{if}\;y \leq 9.8 \cdot 10^{-157}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 3.4 \cdot 10^{-54}:\\
\;\;\;\;x + t_1 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y \cdot t_1 - x\right)\\
\end{array}
\end{array}
if y < 9.7999999999999995e-157Initial program 95.5%
associate-*l*98.8%
Simplified98.8%
Taylor expanded in y around inf 56.5%
Taylor expanded in z around 0 66.4%
if 9.7999999999999995e-157 < y < 3.39999999999999987e-54Initial program 99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in x around 0 23.9%
associate-*r*23.9%
associate-/r*23.9%
div-sub23.9%
rec-exp23.9%
rec-exp23.9%
tanh-def-a84.0%
Simplified84.0%
if 3.39999999999999987e-54 < y Initial program 92.3%
associate-*l*95.3%
Simplified95.3%
Taylor expanded in x around 0 49.6%
+-commutative49.6%
Simplified84.9%
Final simplification72.6%
(FPCore (x y z t) :precision binary64 (if (<= y 1e-156) x (if (<= y 6.5e+138) (+ x (* (tanh (/ t y)) (* y z))) (+ x (* z (- t x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1e-156) {
tmp = x;
} else if (y <= 6.5e+138) {
tmp = x + (tanh((t / y)) * (y * z));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 1d-156) then
tmp = x
else if (y <= 6.5d+138) then
tmp = x + (tanh((t / y)) * (y * z))
else
tmp = x + (z * (t - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1e-156) {
tmp = x;
} else if (y <= 6.5e+138) {
tmp = x + (Math.tanh((t / y)) * (y * z));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 1e-156: tmp = x elif y <= 6.5e+138: tmp = x + (math.tanh((t / y)) * (y * z)) else: tmp = x + (z * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 1e-156) tmp = x; elseif (y <= 6.5e+138) tmp = Float64(x + Float64(tanh(Float64(t / y)) * Float64(y * z))); else tmp = Float64(x + Float64(z * Float64(t - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 1e-156) tmp = x; elseif (y <= 6.5e+138) tmp = x + (tanh((t / y)) * (y * z)); else tmp = x + (z * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 1e-156], x, If[LessEqual[y, 6.5e+138], N[(x + N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 10^{-156}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{+138}:\\
\;\;\;\;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.00000000000000004e-156Initial program 95.5%
associate-*l*98.8%
Simplified98.8%
Taylor expanded in y around inf 56.5%
Taylor expanded in z around 0 66.4%
if 1.00000000000000004e-156 < y < 6.50000000000000054e138Initial program 99.9%
associate-*l*98.3%
Simplified98.3%
Taylor expanded in x around 0 28.2%
associate-*r*28.2%
associate-/r*28.2%
div-sub28.2%
rec-exp28.2%
rec-exp28.2%
tanh-def-a79.9%
Simplified79.9%
if 6.50000000000000054e138 < y Initial program 82.7%
associate-*l*92.8%
Simplified92.8%
Taylor expanded in y around inf 93.6%
Final simplification72.5%
(FPCore (x y z t) :precision binary64 (if (<= y 4600000000.0) x (+ x (* z (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4600000000.0) {
tmp = x;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 4600000000.0d0) then
tmp = x
else
tmp = x + (z * (t - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4600000000.0) {
tmp = x;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 4600000000.0: tmp = x else: tmp = x + (z * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 4600000000.0) tmp = x; else tmp = Float64(x + Float64(z * Float64(t - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 4600000000.0) tmp = x; else tmp = x + (z * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 4600000000.0], x, N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4600000000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 4.6e9Initial program 96.3%
associate-*l*99.0%
Simplified99.0%
Taylor expanded in y around inf 56.7%
Taylor expanded in z around 0 66.3%
if 4.6e9 < y Initial program 90.1%
associate-*l*93.9%
Simplified93.9%
Taylor expanded in y around inf 78.8%
Final simplification68.7%
(FPCore (x y z t) :precision binary64 (if (<= y 1.85e-52) x (* x (- 1.0 z))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.85e-52) {
tmp = x;
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 1.85d-52) then
tmp = x
else
tmp = x * (1.0d0 - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.85e-52) {
tmp = x;
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 1.85e-52: tmp = x else: tmp = x * (1.0 - z) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 1.85e-52) tmp = x; else tmp = Float64(x * Float64(1.0 - z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 1.85e-52) tmp = x; else tmp = x * (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 1.85e-52], x, N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.85 \cdot 10^{-52}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if y < 1.8499999999999999e-52Initial program 96.0%
associate-*l*98.9%
Simplified98.9%
Taylor expanded in y around inf 56.1%
Taylor expanded in z around 0 66.3%
if 1.8499999999999999e-52 < y Initial program 92.3%
associate-*l*95.3%
Simplified95.3%
Taylor expanded in y around inf 75.8%
Taylor expanded in x around inf 59.1%
mul-1-neg59.1%
unsub-neg59.1%
Simplified59.1%
Final simplification64.5%
(FPCore (x y z t) :precision binary64 (if (<= z 4.7e+107) x (* z (- t x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 4.7e+107) {
tmp = x;
} else {
tmp = z * (t - x);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 4.7d+107) then
tmp = x
else
tmp = z * (t - x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 4.7e+107) {
tmp = x;
} else {
tmp = z * (t - x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 4.7e+107: tmp = x else: tmp = z * (t - x) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 4.7e+107) tmp = x; else tmp = Float64(z * Float64(t - x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 4.7e+107) tmp = x; else tmp = z * (t - x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 4.7e+107], x, N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 4.7 \cdot 10^{+107}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < 4.7000000000000001e107Initial program 97.4%
associate-*l*99.1%
Simplified99.1%
Taylor expanded in y around inf 59.5%
Taylor expanded in z around 0 68.5%
if 4.7000000000000001e107 < z Initial program 82.0%
associate-*l*92.2%
Simplified92.2%
Taylor expanded in y around inf 69.1%
Taylor expanded in z around inf 69.1%
Final simplification68.6%
(FPCore (x y z t) :precision binary64 (if (<= y 9.5e+15) x (+ x (* z t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 9.5e+15) {
tmp = x;
} else {
tmp = x + (z * t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 9.5d+15) then
tmp = x
else
tmp = x + (z * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 9.5e+15) {
tmp = x;
} else {
tmp = x + (z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 9.5e+15: tmp = x else: tmp = x + (z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 9.5e+15) tmp = x; else tmp = Float64(x + Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 9.5e+15) tmp = x; else tmp = x + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 9.5e+15], x, N[(x + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9.5 \cdot 10^{+15}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot t\\
\end{array}
\end{array}
if y < 9.5e15Initial program 96.3%
associate-*l*99.0%
Simplified99.0%
Taylor expanded in y around inf 56.9%
Taylor expanded in z around 0 66.2%
if 9.5e15 < y Initial program 89.4%
associate-*l*93.6%
Simplified93.6%
Taylor expanded in x around 0 35.1%
associate-*r*34.8%
associate-/r*34.8%
div-sub34.8%
rec-exp34.8%
rec-exp34.8%
tanh-def-a74.4%
Simplified74.4%
Taylor expanded in y around inf 66.8%
*-commutative66.8%
Simplified66.8%
Final simplification66.3%
(FPCore (x y z t) :precision binary64 (if (<= z 2.5e+171) x (* x (- z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 2.5e+171) {
tmp = x;
} else {
tmp = x * -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 (z <= 2.5d+171) then
tmp = x
else
tmp = x * -z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 2.5e+171) {
tmp = x;
} else {
tmp = x * -z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 2.5e+171: tmp = x else: tmp = x * -z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 2.5e+171) tmp = x; else tmp = Float64(x * Float64(-z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 2.5e+171) tmp = x; else tmp = x * -z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 2.5e+171], x, N[(x * (-z)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.5 \cdot 10^{+171}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-z\right)\\
\end{array}
\end{array}
if z < 2.5000000000000002e171Initial program 95.5%
associate-*l*98.3%
Simplified98.3%
Taylor expanded in y around inf 59.5%
Taylor expanded in z around 0 65.3%
if 2.5000000000000002e171 < z Initial program 89.7%
associate-*l*94.8%
Simplified94.8%
Taylor expanded in y around inf 79.4%
associate-/l*74.2%
Simplified74.2%
Taylor expanded in t around 0 44.4%
mul-1-neg44.4%
associate-/l*43.8%
distribute-neg-frac43.8%
Simplified43.8%
distribute-frac-neg43.8%
distribute-rgt-neg-out43.8%
div-inv43.7%
add-sqr-sqrt27.5%
sqrt-unprod27.8%
sqr-neg27.8%
sqrt-unprod0.4%
add-sqr-sqrt1.2%
clear-num1.2%
associate-*r*1.0%
clear-num1.0%
div-inv1.1%
associate-*r/1.3%
sub-neg1.3%
associate-*r/1.1%
div-inv1.0%
clear-num1.0%
associate-*r*1.2%
Applied egg-rr43.6%
associate-*r/44.4%
associate-*l/44.4%
*-commutative44.4%
Simplified44.4%
Taylor expanded in z around inf 44.7%
mul-1-neg44.7%
*-commutative44.7%
distribute-rgt-neg-in44.7%
Simplified44.7%
Final simplification63.7%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 95.1%
associate-*l*98.0%
Simplified98.0%
Taylor expanded in y around inf 61.0%
Taylor expanded in z around 0 61.7%
Final simplification61.7%
(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 2023306
(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))))))