
(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 12 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 2.3e+158) (fma y (* z (- (tanh (/ t y)) (tanh (/ x y)))) x) (+ x (* z (- t x)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.3e+158) {
tmp = fma(y, (z * (tanh((t / y)) - tanh((x / y)))), x);
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 2.3e+158) tmp = fma(y, Float64(z * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))), 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, 2.3e+158], N[(y * N[(z * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.3 \cdot 10^{+158}:\\
\;\;\;\;\mathsf{fma}\left(y, z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 2.29999999999999986e158Initial program 94.8%
+-commutative94.8%
associate-*l*98.6%
fma-def98.6%
Simplified98.6%
if 2.29999999999999986e158 < y Initial program 78.7%
associate-*l*87.3%
Simplified87.3%
Taylor expanded in y around inf 94.5%
Final simplification98.1%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (or (<= t -2.2e-26) (not (<= t 2.8e-64))) (+ x (* y (* z (tanh (/ t y))))) (fma y (* z (- (/ t y) (tanh (/ x y)))) x)))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.2e-26) || !(t <= 2.8e-64)) {
tmp = x + (y * (z * tanh((t / y))));
} else {
tmp = fma(y, (z * ((t / y) - tanh((x / y)))), x);
}
return tmp;
}
y = abs(y) function code(x, y, z, t) tmp = 0.0 if ((t <= -2.2e-26) || !(t <= 2.8e-64)) tmp = Float64(x + Float64(y * Float64(z * tanh(Float64(t / y))))); else tmp = fma(y, Float64(z * Float64(Float64(t / y) - tanh(Float64(x / y)))), x); end return tmp end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.2e-26], N[Not[LessEqual[t, 2.8e-64]], $MachinePrecision]], N[(x + N[(y * N[(z * N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(z * N[(N[(t / y), $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.2 \cdot 10^{-26} \lor \neg \left(t \leq 2.8 \cdot 10^{-64}\right):\\
\;\;\;\;x + y \cdot \left(z \cdot \tanh \left(\frac{t}{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, z \cdot \left(\frac{t}{y} - \tanh \left(\frac{x}{y}\right)\right), x\right)\\
\end{array}
\end{array}
if t < -2.2000000000000001e-26 or 2.80000000000000004e-64 < t Initial program 95.7%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in x around 0 12.0%
associate-/r*12.0%
div-sub12.0%
rec-exp12.0%
rec-exp12.0%
tanh-def-a92.1%
Simplified92.1%
if -2.2000000000000001e-26 < t < 2.80000000000000004e-64Initial program 88.3%
+-commutative88.3%
associate-*l*92.9%
fma-def92.9%
Simplified92.9%
Taylor expanded in t around 0 87.2%
Final simplification90.2%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 1.85e+158) (+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y)))))) (+ x (* z (- t x)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.85e+158) {
tmp = x + (y * (z * (tanh((t / y)) - tanh((x / y)))));
} 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.85d+158) then
tmp = x + (y * (z * (tanh((t / y)) - tanh((x / y)))))
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.85e+158) {
tmp = x + (y * (z * (Math.tanh((t / y)) - Math.tanh((x / y)))));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 1.85e+158: tmp = x + (y * (z * (math.tanh((t / y)) - math.tanh((x / y))))) else: tmp = x + (z * (t - x)) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 1.85e+158) tmp = Float64(x + Float64(y * Float64(z * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))))); 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.85e+158) tmp = x + (y * (z * (tanh((t / y)) - tanh((x / y))))); 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.85e+158], 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], N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.85 \cdot 10^{+158}:\\
\;\;\;\;x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 1.85000000000000005e158Initial program 94.8%
associate-*l*98.6%
Simplified98.6%
if 1.85000000000000005e158 < y Initial program 78.7%
associate-*l*87.3%
Simplified87.3%
Taylor expanded in y around inf 94.5%
Final simplification98.1%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (or (<= t -4.2e-28) (not (<= t 2.8e-63))) (+ x (* y (* z (tanh (/ t y))))) (+ x (* (- (/ t y) (tanh (/ x y))) (* y z)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.2e-28) || !(t <= 2.8e-63)) {
tmp = x + (y * (z * tanh((t / y))));
} else {
tmp = x + (((t / y) - tanh((x / y))) * (y * 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 ((t <= (-4.2d-28)) .or. (.not. (t <= 2.8d-63))) then
tmp = x + (y * (z * tanh((t / y))))
else
tmp = x + (((t / y) - tanh((x / y))) * (y * 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 ((t <= -4.2e-28) || !(t <= 2.8e-63)) {
tmp = x + (y * (z * Math.tanh((t / y))));
} else {
tmp = x + (((t / y) - Math.tanh((x / y))) * (y * z));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if (t <= -4.2e-28) or not (t <= 2.8e-63): tmp = x + (y * (z * math.tanh((t / y)))) else: tmp = x + (((t / y) - math.tanh((x / y))) * (y * z)) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if ((t <= -4.2e-28) || !(t <= 2.8e-63)) tmp = Float64(x + Float64(y * Float64(z * tanh(Float64(t / y))))); else tmp = Float64(x + Float64(Float64(Float64(t / y) - tanh(Float64(x / y))) * Float64(y * z))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -4.2e-28) || ~((t <= 2.8e-63))) tmp = x + (y * (z * tanh((t / y)))); else tmp = x + (((t / y) - tanh((x / y))) * (y * z)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[Or[LessEqual[t, -4.2e-28], N[Not[LessEqual[t, 2.8e-63]], $MachinePrecision]], N[(x + N[(y * N[(z * N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(t / y), $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.2 \cdot 10^{-28} \lor \neg \left(t \leq 2.8 \cdot 10^{-63}\right):\\
\;\;\;\;x + y \cdot \left(z \cdot \tanh \left(\frac{t}{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\frac{t}{y} - \tanh \left(\frac{x}{y}\right)\right) \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if t < -4.20000000000000013e-28 or 2.8000000000000002e-63 < t Initial program 95.7%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in x around 0 12.0%
associate-/r*12.0%
div-sub12.0%
rec-exp12.0%
rec-exp12.0%
tanh-def-a92.1%
Simplified92.1%
if -4.20000000000000013e-28 < t < 2.8000000000000002e-63Initial program 88.3%
Taylor expanded in t around 0 83.6%
Final simplification88.8%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (or (<= t -1.65e-136) (not (<= t 2.85e-65))) (+ x (* y (* z (tanh (/ t y))))) (+ x (* z (- t x)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.65e-136) || !(t <= 2.85e-65)) {
tmp = x + (y * (z * tanh((t / y))));
} 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 ((t <= (-1.65d-136)) .or. (.not. (t <= 2.85d-65))) then
tmp = x + (y * (z * tanh((t / y))))
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 ((t <= -1.65e-136) || !(t <= 2.85e-65)) {
tmp = x + (y * (z * Math.tanh((t / y))));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if (t <= -1.65e-136) or not (t <= 2.85e-65): tmp = x + (y * (z * math.tanh((t / y)))) else: tmp = x + (z * (t - x)) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if ((t <= -1.65e-136) || !(t <= 2.85e-65)) tmp = Float64(x + Float64(y * Float64(z * tanh(Float64(t / y))))); 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 ((t <= -1.65e-136) || ~((t <= 2.85e-65))) tmp = x + (y * (z * tanh((t / y)))); 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[Or[LessEqual[t, -1.65e-136], N[Not[LessEqual[t, 2.85e-65]], $MachinePrecision]], N[(x + N[(y * N[(z * N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.65 \cdot 10^{-136} \lor \neg \left(t \leq 2.85 \cdot 10^{-65}\right):\\
\;\;\;\;x + y \cdot \left(z \cdot \tanh \left(\frac{t}{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if t < -1.65000000000000009e-136 or 2.8500000000000001e-65 < t Initial program 94.4%
associate-*l*98.8%
Simplified98.8%
Taylor expanded in x around 0 13.4%
associate-/r*13.4%
div-sub13.4%
rec-exp13.4%
rec-exp13.4%
tanh-def-a90.0%
Simplified90.0%
if -1.65000000000000009e-136 < t < 2.8500000000000001e-65Initial program 89.4%
associate-*l*93.8%
Simplified93.8%
Taylor expanded in y around inf 81.3%
Final simplification87.1%
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+42) (+ x (* y (* z t_1))) (+ x (* z (- (* y t_1) 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+42) {
tmp = x + (y * (z * t_1));
} else {
tmp = x + (z * ((y * t_1) - 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 = tanh((t / y))
if (y <= 3.4d+42) then
tmp = x + (y * (z * t_1))
else
tmp = x + (z * ((y * t_1) - 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 = Math.tanh((t / y));
double tmp;
if (y <= 3.4e+42) {
tmp = x + (y * (z * t_1));
} else {
tmp = x + (z * ((y * t_1) - x));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): t_1 = math.tanh((t / y)) tmp = 0 if y <= 3.4e+42: tmp = x + (y * (z * t_1)) else: tmp = x + (z * ((y * t_1) - 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+42) tmp = Float64(x + Float64(y * Float64(z * t_1))); else tmp = Float64(x + Float64(z * Float64(Float64(y * t_1) - x))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) t_1 = tanh((t / y)); tmp = 0.0; if (y <= 3.4e+42) tmp = x + (y * (z * t_1)); else tmp = x + (z * ((y * t_1) - 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[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 3.4e+42], N[(x + N[(y * N[(z * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(N[(y * t$95$1), $MachinePrecision] - 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^{+42}:\\
\;\;\;\;x + y \cdot \left(z \cdot t_1\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y \cdot t_1 - x\right)\\
\end{array}
\end{array}
if y < 3.39999999999999975e42Initial program 94.8%
associate-*l*98.5%
Simplified98.5%
Taylor expanded in x around 0 23.9%
associate-/r*23.9%
div-sub23.9%
rec-exp23.9%
rec-exp23.9%
tanh-def-a82.3%
Simplified82.3%
if 3.39999999999999975e42 < y Initial program 84.9%
associate-*l*92.1%
Simplified92.1%
Taylor expanded in x around 0 45.4%
+-commutative45.4%
Simplified89.6%
Final simplification83.8%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 3.8e+47) x (if (or (<= y 4e+134) (not (<= y 1.4e+200))) (* x (- 1.0 z)) (* z t))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3.8e+47) {
tmp = x;
} else if ((y <= 4e+134) || !(y <= 1.4e+200)) {
tmp = x * (1.0 - z);
} else {
tmp = z * t;
}
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.8d+47) then
tmp = x
else if ((y <= 4d+134) .or. (.not. (y <= 1.4d+200))) then
tmp = x * (1.0d0 - z)
else
tmp = z * t
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.8e+47) {
tmp = x;
} else if ((y <= 4e+134) || !(y <= 1.4e+200)) {
tmp = x * (1.0 - z);
} else {
tmp = z * t;
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 3.8e+47: tmp = x elif (y <= 4e+134) or not (y <= 1.4e+200): tmp = x * (1.0 - z) else: tmp = z * t return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 3.8e+47) tmp = x; elseif ((y <= 4e+134) || !(y <= 1.4e+200)) tmp = Float64(x * Float64(1.0 - z)); else tmp = Float64(z * t); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 3.8e+47) tmp = x; elseif ((y <= 4e+134) || ~((y <= 1.4e+200))) tmp = x * (1.0 - z); else tmp = z * t; end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 3.8e+47], x, If[Or[LessEqual[y, 4e+134], N[Not[LessEqual[y, 1.4e+200]], $MachinePrecision]], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(z * t), $MachinePrecision]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.8 \cdot 10^{+47}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 4 \cdot 10^{+134} \lor \neg \left(y \leq 1.4 \cdot 10^{+200}\right):\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if y < 3.8000000000000003e47Initial program 94.4%
Taylor expanded in x around inf 65.3%
if 3.8000000000000003e47 < y < 3.99999999999999969e134 or 1.39999999999999992e200 < y Initial program 82.0%
associate-*l*89.3%
Simplified89.3%
Taylor expanded in y around inf 78.9%
Taylor expanded in x around inf 48.3%
mul-1-neg48.3%
unsub-neg48.3%
Simplified48.3%
if 3.99999999999999969e134 < y < 1.39999999999999992e200Initial program 99.9%
+-commutative99.9%
associate-*l*99.6%
fma-def99.6%
Simplified99.6%
Taylor expanded in t around 0 85.1%
Taylor expanded in t around inf 55.6%
Final simplification62.2%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 1.2e+47) x (- (* z t) (* x (+ z -1.0)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.2e+47) {
tmp = x;
} else {
tmp = (z * t) - (x * (z + -1.0));
}
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.2d+47) then
tmp = x
else
tmp = (z * t) - (x * (z + (-1.0d0)))
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.2e+47) {
tmp = x;
} else {
tmp = (z * t) - (x * (z + -1.0));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 1.2e+47: tmp = x else: tmp = (z * t) - (x * (z + -1.0)) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 1.2e+47) tmp = x; else tmp = Float64(Float64(z * t) - Float64(x * Float64(z + -1.0))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 1.2e+47) tmp = x; else tmp = (z * t) - (x * (z + -1.0)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 1.2e+47], x, N[(N[(z * t), $MachinePrecision] - N[(x * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.2 \cdot 10^{+47}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot t - x \cdot \left(z + -1\right)\\
\end{array}
\end{array}
if y < 1.20000000000000009e47Initial program 94.4%
Taylor expanded in x around inf 65.3%
if 1.20000000000000009e47 < y Initial program 86.5%
associate-*l*91.9%
Simplified91.9%
Taylor expanded in y around inf 78.1%
expm1-log1p-u46.8%
expm1-udef41.4%
associate-/l*41.5%
Applied egg-rr41.5%
expm1-def45.2%
expm1-log1p72.6%
associate-*r/67.0%
Simplified67.0%
Taylor expanded in x around -inf 80.5%
+-commutative80.5%
mul-1-neg80.5%
unsub-neg80.5%
sub-neg80.5%
metadata-eval80.5%
Simplified80.5%
Final simplification68.4%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (or (<= y 3.3e+132) (and (not (<= y 5.8e+289)) (<= y 7.2e+300))) x (* z t)))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= 3.3e+132) || (!(y <= 5.8e+289) && (y <= 7.2e+300))) {
tmp = x;
} else {
tmp = z * t;
}
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.3d+132) .or. (.not. (y <= 5.8d+289)) .and. (y <= 7.2d+300)) then
tmp = x
else
tmp = z * t
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.3e+132) || (!(y <= 5.8e+289) && (y <= 7.2e+300))) {
tmp = x;
} else {
tmp = z * t;
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if (y <= 3.3e+132) or (not (y <= 5.8e+289) and (y <= 7.2e+300)): tmp = x else: tmp = z * t return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if ((y <= 3.3e+132) || (!(y <= 5.8e+289) && (y <= 7.2e+300))) tmp = x; else tmp = Float64(z * t); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= 3.3e+132) || (~((y <= 5.8e+289)) && (y <= 7.2e+300))) tmp = x; else tmp = z * t; end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[Or[LessEqual[y, 3.3e+132], And[N[Not[LessEqual[y, 5.8e+289]], $MachinePrecision], LessEqual[y, 7.2e+300]]], x, N[(z * t), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.3 \cdot 10^{+132} \lor \neg \left(y \leq 5.8 \cdot 10^{+289}\right) \land y \leq 7.2 \cdot 10^{+300}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if y < 3.3000000000000003e132 or 5.79999999999999967e289 < y < 7.2000000000000004e300Initial program 94.4%
Taylor expanded in x around inf 61.7%
if 3.3000000000000003e132 < y < 5.79999999999999967e289 or 7.2000000000000004e300 < y Initial program 81.7%
+-commutative81.7%
associate-*l*90.3%
fma-def90.3%
Simplified90.3%
Taylor expanded in t around 0 82.1%
Taylor expanded in t around inf 52.0%
Final simplification60.5%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 1.05e+47) x (+ x (* z (- t x)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.05e+47) {
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 <= 1.05d+47) 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 <= 1.05e+47) {
tmp = x;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 1.05e+47: tmp = x else: tmp = x + (z * (t - x)) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 1.05e+47) 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 <= 1.05e+47) 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, 1.05e+47], x, N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.05 \cdot 10^{+47}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 1.05e47Initial program 94.4%
Taylor expanded in x around inf 65.3%
if 1.05e47 < y Initial program 86.5%
associate-*l*91.9%
Simplified91.9%
Taylor expanded in y around inf 80.5%
Final simplification68.4%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 1.45e+47) x (+ x (* z t))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.45e+47) {
tmp = x;
} else {
tmp = x + (z * t);
}
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.45d+47) then
tmp = x
else
tmp = x + (z * t)
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.45e+47) {
tmp = x;
} else {
tmp = x + (z * t);
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 1.45e+47: tmp = x else: tmp = x + (z * t) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 1.45e+47) tmp = x; else tmp = Float64(x + Float64(z * t)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 1.45e+47) tmp = x; else tmp = x + (z * t); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 1.45e+47], x, N[(x + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.45 \cdot 10^{+47}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot t\\
\end{array}
\end{array}
if y < 1.4499999999999999e47Initial program 94.4%
Taylor expanded in x around inf 65.3%
if 1.4499999999999999e47 < y Initial program 86.5%
Taylor expanded in t around 0 70.6%
Taylor expanded in y around 0 56.3%
+-commutative56.3%
*-commutative56.3%
Simplified56.3%
Final simplification63.5%
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 92.8%
Taylor expanded in x around inf 55.9%
Final simplification55.9%
(FPCore (x y z t) :precision binary64 (+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y)))))))
double code(double x, double y, double z, double t) {
return x + (y * (z * (tanh((t / y)) - tanh((x / y)))));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + (y * (z * (tanh((t / y)) - tanh((x / y)))))
end function
public static double code(double x, double y, double z, double t) {
return x + (y * (z * (Math.tanh((t / y)) - Math.tanh((x / y)))));
}
def code(x, y, z, t): return x + (y * (z * (math.tanh((t / y)) - math.tanh((x / y)))))
function code(x, y, z, t) return Float64(x + Float64(y * Float64(z * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))))) end
function tmp = code(x, y, z, t) tmp = x + (y * (z * (tanh((t / y)) - tanh((x / y))))); end
code[x_, y_, z_, t_] := N[(x + N[(y * N[(z * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)
\end{array}
herbie shell --seed 2023311
(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))))))