
(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 9.5e+191) (fma (* y (- (tanh (/ t y)) (tanh (/ x y)))) z x) (fma z (- t x) x)))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 9.5e+191) {
tmp = fma((y * (tanh((t / y)) - tanh((x / y)))), z, x);
} else {
tmp = fma(z, (t - x), x);
}
return tmp;
}
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 9.5e+191) tmp = fma(Float64(y * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))), z, x); else tmp = fma(z, Float64(t - x), x); end return tmp end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 9.5e+191], N[(N[(y * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z + x), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9.5 \cdot 10^{+191}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\
\end{array}
\end{array}
if y < 9.4999999999999998e191Initial program 92.3%
+-commutative92.3%
*-commutative92.3%
associate-*r*97.3%
fma-def97.3%
Applied egg-rr97.3%
if 9.4999999999999998e191 < y Initial program 70.1%
Taylor expanded in y around inf 93.0%
+-commutative93.0%
fma-def93.0%
Simplified93.0%
Final simplification96.9%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 1.85e+187) (+ x (* (- (tanh (/ t y)) (tanh (/ x y))) (* y z))) (fma z (- t x) x)))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.85e+187) {
tmp = x + ((tanh((t / y)) - tanh((x / y))) * (y * z));
} else {
tmp = fma(z, (t - x), x);
}
return tmp;
}
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 1.85e+187) tmp = Float64(x + Float64(Float64(tanh(Float64(t / y)) - tanh(Float64(x / y))) * Float64(y * z))); else tmp = fma(z, Float64(t - x), x); end return tmp end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 1.85e+187], 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[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.85 \cdot 10^{+187}:\\
\;\;\;\;x + \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\
\end{array}
\end{array}
if y < 1.85000000000000009e187Initial program 92.3%
if 1.85000000000000009e187 < y Initial program 70.1%
Taylor expanded in y around inf 93.0%
+-commutative93.0%
fma-def93.0%
Simplified93.0%
Final simplification92.4%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (or (<= t -4e-96) (not (<= t 3.8e+36))) (+ x (* y (* (tanh (/ t y)) z))) (+ x (* z (- t (* y (tanh (/ x y))))))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4e-96) || !(t <= 3.8e+36)) {
tmp = x + (y * (tanh((t / y)) * z));
} else {
tmp = x + (z * (t - (y * tanh((x / y)))));
}
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 <= (-4d-96)) .or. (.not. (t <= 3.8d+36))) then
tmp = x + (y * (tanh((t / y)) * z))
else
tmp = x + (z * (t - (y * tanh((x / y)))))
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 <= -4e-96) || !(t <= 3.8e+36)) {
tmp = x + (y * (Math.tanh((t / y)) * z));
} else {
tmp = x + (z * (t - (y * Math.tanh((x / y)))));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if (t <= -4e-96) or not (t <= 3.8e+36): tmp = x + (y * (math.tanh((t / y)) * z)) else: tmp = x + (z * (t - (y * math.tanh((x / y))))) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if ((t <= -4e-96) || !(t <= 3.8e+36)) tmp = Float64(x + Float64(y * Float64(tanh(Float64(t / y)) * z))); else tmp = Float64(x + Float64(z * Float64(t - Float64(y * tanh(Float64(x / y)))))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -4e-96) || ~((t <= 3.8e+36))) tmp = x + (y * (tanh((t / y)) * z)); else tmp = x + (z * (t - (y * tanh((x / y))))); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[Or[LessEqual[t, -4e-96], N[Not[LessEqual[t, 3.8e+36]], $MachinePrecision]], N[(x + N[(y * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(t - N[(y * N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4 \cdot 10^{-96} \lor \neg \left(t \leq 3.8 \cdot 10^{+36}\right):\\
\;\;\;\;x + y \cdot \left(\tanh \left(\frac{t}{y}\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - y \cdot \tanh \left(\frac{x}{y}\right)\right)\\
\end{array}
\end{array}
if t < -3.9999999999999996e-96 or 3.80000000000000025e36 < t Initial program 94.3%
Taylor expanded in x around 0 13.1%
associate-/r*13.1%
div-sub13.1%
rec-exp13.2%
rec-exp13.2%
tanh-def-a85.3%
Simplified85.3%
if -3.9999999999999996e-96 < t < 3.80000000000000025e36Initial program 85.1%
Taylor expanded in t around 0 79.3%
Taylor expanded in t around -inf 37.6%
+-commutative37.6%
mul-1-neg37.6%
unsub-neg37.6%
associate-*r*35.0%
Simplified83.3%
Taylor expanded in z around 0 37.6%
cancel-sign-sub-inv37.6%
associate-/r*37.6%
div-sub37.6%
Simplified89.9%
Final simplification87.4%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 3.5e+136) (+ x (* y (* (tanh (/ t y)) z))) (fma z (- t x) x)))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3.5e+136) {
tmp = x + (y * (tanh((t / y)) * z));
} else {
tmp = fma(z, (t - x), x);
}
return tmp;
}
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 3.5e+136) tmp = Float64(x + Float64(y * Float64(tanh(Float64(t / y)) * z))); else tmp = fma(z, Float64(t - x), x); end return tmp end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 3.5e+136], N[(x + N[(y * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.5 \cdot 10^{+136}:\\
\;\;\;\;x + y \cdot \left(\tanh \left(\frac{t}{y}\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\
\end{array}
\end{array}
if y < 3.50000000000000001e136Initial program 92.5%
Taylor expanded in x around 0 25.5%
associate-/r*25.5%
div-sub25.5%
rec-exp25.5%
rec-exp25.5%
tanh-def-a78.9%
Simplified78.9%
if 3.50000000000000001e136 < y Initial program 72.7%
Taylor expanded in y around inf 90.3%
+-commutative90.3%
fma-def90.3%
Simplified90.3%
Final simplification80.3%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 2.1e-49) x (fma z (- t x) x)))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.1e-49) {
tmp = x;
} else {
tmp = fma(z, (t - x), x);
}
return tmp;
}
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 2.1e-49) tmp = x; else tmp = fma(z, Float64(t - x), x); end return tmp end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 2.1e-49], x, N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.1 \cdot 10^{-49}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\
\end{array}
\end{array}
if y < 2.0999999999999999e-49Initial program 93.2%
Taylor expanded in x around inf 62.6%
if 2.0999999999999999e-49 < y Initial program 81.2%
Taylor expanded in y around inf 76.4%
+-commutative76.4%
fma-def76.4%
Simplified76.4%
Final simplification66.2%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 2.2e+14) x (if (or (<= y 1.2e+206) (not (<= y 1.42e+251))) (* x (- 1.0 z)) (* t z))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.2e+14) {
tmp = x;
} else if ((y <= 1.2e+206) || !(y <= 1.42e+251)) {
tmp = x * (1.0 - z);
} 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 <= 2.2d+14) then
tmp = x
else if ((y <= 1.2d+206) .or. (.not. (y <= 1.42d+251))) then
tmp = x * (1.0d0 - z)
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 <= 2.2e+14) {
tmp = x;
} else if ((y <= 1.2e+206) || !(y <= 1.42e+251)) {
tmp = x * (1.0 - z);
} else {
tmp = t * z;
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 2.2e+14: tmp = x elif (y <= 1.2e+206) or not (y <= 1.42e+251): tmp = x * (1.0 - z) else: tmp = t * z return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 2.2e+14) tmp = x; elseif ((y <= 1.2e+206) || !(y <= 1.42e+251)) tmp = Float64(x * Float64(1.0 - z)); 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 <= 2.2e+14) tmp = x; elseif ((y <= 1.2e+206) || ~((y <= 1.42e+251))) tmp = x * (1.0 - z); 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, 2.2e+14], x, If[Or[LessEqual[y, 1.2e+206], N[Not[LessEqual[y, 1.42e+251]], $MachinePrecision]], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(t * z), $MachinePrecision]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.2 \cdot 10^{+14}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+206} \lor \neg \left(y \leq 1.42 \cdot 10^{+251}\right):\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot z\\
\end{array}
\end{array}
if y < 2.2e14Initial program 93.6%
Taylor expanded in x around inf 62.7%
if 2.2e14 < y < 1.2e206 or 1.41999999999999995e251 < y Initial program 76.7%
Taylor expanded in y around inf 75.7%
Taylor expanded in x around inf 53.1%
mul-1-neg53.1%
Simplified53.1%
Taylor expanded in x around 0 53.1%
if 1.2e206 < y < 1.41999999999999995e251Initial program 84.0%
Taylor expanded in y around inf 84.9%
Taylor expanded in z around inf 52.9%
Taylor expanded in t around inf 52.8%
Final simplification60.6%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 2.5e-49) x (- (+ x (* t z)) (* x z))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.5e-49) {
tmp = x;
} else {
tmp = (x + (t * z)) - (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 <= 2.5d-49) then
tmp = x
else
tmp = (x + (t * z)) - (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 <= 2.5e-49) {
tmp = x;
} else {
tmp = (x + (t * z)) - (x * z);
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 2.5e-49: tmp = x else: tmp = (x + (t * z)) - (x * z) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 2.5e-49) tmp = x; else tmp = Float64(Float64(x + Float64(t * z)) - Float64(x * z)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 2.5e-49) tmp = x; else tmp = (x + (t * z)) - (x * z); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 2.5e-49], x, N[(N[(x + N[(t * z), $MachinePrecision]), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.5 \cdot 10^{-49}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\left(x + t \cdot z\right) - x \cdot z\\
\end{array}
\end{array}
if y < 2.4999999999999999e-49Initial program 93.2%
Taylor expanded in x around inf 62.6%
if 2.4999999999999999e-49 < y Initial program 81.2%
Taylor expanded in t around 0 63.6%
Taylor expanded in t around -inf 49.3%
+-commutative49.3%
mul-1-neg49.3%
unsub-neg49.3%
associate-*r*43.2%
Simplified67.4%
Taylor expanded in y around inf 76.4%
Final simplification66.2%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 2.6e+98) x (if (<= y 1.6e+253) (* z (- t x)) (* x (- 1.0 z)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.6e+98) {
tmp = x;
} else if (y <= 1.6e+253) {
tmp = z * (t - 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 <= 2.6d+98) then
tmp = x
else if (y <= 1.6d+253) then
tmp = z * (t - 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 <= 2.6e+98) {
tmp = x;
} else if (y <= 1.6e+253) {
tmp = z * (t - x);
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 2.6e+98: tmp = x elif y <= 1.6e+253: tmp = z * (t - x) else: tmp = x * (1.0 - z) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 2.6e+98) tmp = x; elseif (y <= 1.6e+253) tmp = Float64(z * Float64(t - 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 <= 2.6e+98) tmp = x; elseif (y <= 1.6e+253) tmp = z * (t - 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, 2.6e+98], x, If[LessEqual[y, 1.6e+253], N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.6 \cdot 10^{+98}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+253}:\\
\;\;\;\;z \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if y < 2.6e98Initial program 93.2%
Taylor expanded in x around inf 62.6%
if 2.6e98 < y < 1.6000000000000002e253Initial program 72.7%
Taylor expanded in y around inf 81.0%
Taylor expanded in z around inf 58.1%
if 1.6000000000000002e253 < y Initial program 67.8%
Taylor expanded in y around inf 93.9%
Taylor expanded in x around inf 55.3%
mul-1-neg55.3%
Simplified55.3%
Taylor expanded in x around 0 55.3%
Final simplification61.8%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 1.55e-50) x (+ x (* z (- t x)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.55e-50) {
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.55d-50) 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.55e-50) {
tmp = x;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 1.55e-50: 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.55e-50) 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.55e-50) 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.55e-50], x, N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.55 \cdot 10^{-50}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 1.5500000000000001e-50Initial program 93.2%
Taylor expanded in x around inf 62.6%
if 1.5500000000000001e-50 < y Initial program 81.2%
Taylor expanded in y around inf 76.4%
Final simplification66.2%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= x -1.7e-280) x (if (<= x 3e-169) (* t z) x)))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.7e-280) {
tmp = x;
} else if (x <= 3e-169) {
tmp = t * z;
} else {
tmp = 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 (x <= (-1.7d-280)) then
tmp = x
else if (x <= 3d-169) then
tmp = t * z
else
tmp = 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 (x <= -1.7e-280) {
tmp = x;
} else if (x <= 3e-169) {
tmp = t * z;
} else {
tmp = x;
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if x <= -1.7e-280: tmp = x elif x <= 3e-169: tmp = t * z else: tmp = x return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (x <= -1.7e-280) tmp = x; elseif (x <= 3e-169) tmp = Float64(t * z); else tmp = x; end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.7e-280) tmp = x; elseif (x <= 3e-169) tmp = t * z; else tmp = x; end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[x, -1.7e-280], x, If[LessEqual[x, 3e-169], N[(t * z), $MachinePrecision], x]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{-280}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3 \cdot 10^{-169}:\\
\;\;\;\;t \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.6999999999999999e-280 or 2.9999999999999999e-169 < x Initial program 92.6%
Taylor expanded in x around inf 65.2%
if -1.6999999999999999e-280 < x < 2.9999999999999999e-169Initial program 76.4%
Taylor expanded in y around inf 70.8%
Taylor expanded in z around inf 59.5%
Taylor expanded in t around inf 55.0%
Final simplification63.5%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 2.8e-51) x (+ x (* t z))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.8e-51) {
tmp = x;
} else {
tmp = x + (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 <= 2.8d-51) then
tmp = x
else
tmp = x + (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 <= 2.8e-51) {
tmp = x;
} else {
tmp = x + (t * z);
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 2.8e-51: tmp = x else: tmp = x + (t * z) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 2.8e-51) tmp = x; else tmp = Float64(x + Float64(t * z)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 2.8e-51) tmp = x; else tmp = x + (t * z); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 2.8e-51], x, N[(x + N[(t * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.8 \cdot 10^{-51}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot z\\
\end{array}
\end{array}
if y < 2.8e-51Initial program 93.2%
Taylor expanded in x around inf 62.6%
if 2.8e-51 < y Initial program 81.2%
Taylor expanded in y around inf 76.4%
Taylor expanded in t around inf 67.8%
Final simplification63.9%
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 90.0%
Taylor expanded in x around inf 58.3%
Final simplification58.3%
(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 2023271
(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))))))