
(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 8e+186) (fma y (* z (- (tanh (/ t y)) (tanh (/ x y)))) x) (- (* z t) (* x (+ z -1.0)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 8e+186) {
tmp = fma(y, (z * (tanh((t / y)) - tanh((x / y)))), 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 <= 8e+186) tmp = fma(y, Float64(z * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))), x); else tmp = Float64(Float64(z * t) - Float64(x * Float64(z + -1.0))); end return tmp end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 8e+186], N[(y * N[(z * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], 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 8 \cdot 10^{+186}:\\
\;\;\;\;\mathsf{fma}\left(y, z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot t - x \cdot \left(z + -1\right)\\
\end{array}
\end{array}
if y < 7.99999999999999984e186Initial program 94.9%
+-commutative94.9%
associate-*l*96.5%
fma-def96.5%
Simplified96.5%
if 7.99999999999999984e186 < y Initial program 69.3%
associate-*l*80.7%
Simplified80.7%
Taylor expanded in y around inf 99.9%
Taylor expanded in x around -inf 99.9%
+-commutative99.9%
mul-1-neg99.9%
unsub-neg99.9%
*-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification96.8%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 7.5e+184) (+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y)))))) (- (* z t) (* x (+ z -1.0)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 7.5e+184) {
tmp = x + (y * (z * (tanh((t / y)) - tanh((x / y)))));
} 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 <= 7.5d+184) then
tmp = x + (y * (z * (tanh((t / y)) - tanh((x / y)))))
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 <= 7.5e+184) {
tmp = x + (y * (z * (Math.tanh((t / y)) - Math.tanh((x / y)))));
} else {
tmp = (z * t) - (x * (z + -1.0));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 7.5e+184: tmp = x + (y * (z * (math.tanh((t / y)) - math.tanh((x / y))))) else: tmp = (z * t) - (x * (z + -1.0)) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 7.5e+184) tmp = Float64(x + Float64(y * Float64(z * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))))); 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 <= 7.5e+184) tmp = x + (y * (z * (tanh((t / y)) - tanh((x / y))))); 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, 7.5e+184], 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[(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 7.5 \cdot 10^{+184}:\\
\;\;\;\;x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot t - x \cdot \left(z + -1\right)\\
\end{array}
\end{array}
if y < 7.49999999999999985e184Initial program 94.9%
associate-*l*96.5%
Simplified96.5%
if 7.49999999999999985e184 < y Initial program 69.3%
associate-*l*80.7%
Simplified80.7%
Taylor expanded in y around inf 99.9%
Taylor expanded in x around -inf 99.9%
+-commutative99.9%
mul-1-neg99.9%
unsub-neg99.9%
*-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification96.8%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 6.8e+73) (fma y (* z (tanh (/ t y))) x) (fma z (- t x) x)))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 6.8e+73) {
tmp = fma(y, (z * tanh((t / y))), x);
} else {
tmp = fma(z, (t - x), x);
}
return tmp;
}
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 6.8e+73) tmp = fma(y, Float64(z * tanh(Float64(t / y))), 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, 6.8e+73], N[(y * N[(z * N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.8 \cdot 10^{+73}:\\
\;\;\;\;\mathsf{fma}\left(y, z \cdot \tanh \left(\frac{t}{y}\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\
\end{array}
\end{array}
if y < 6.8000000000000003e73Initial program 94.8%
+-commutative94.8%
associate-*l*96.7%
fma-def96.7%
Simplified96.7%
Taylor expanded in x around 0 25.9%
associate-/r*25.9%
rec-exp25.9%
div-sub25.9%
rec-exp25.9%
tanh-def-a78.7%
Simplified78.7%
if 6.8000000000000003e73 < y Initial program 82.3%
associate-*l*87.4%
Simplified87.4%
Taylor expanded in y around inf 94.4%
+-commutative94.4%
fma-def94.5%
Simplified94.5%
Final simplification81.8%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 2.5e+75) (+ x (* (tanh (/ t 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 <= 2.5e+75) {
tmp = x + (tanh((t / 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 <= 2.5e+75) tmp = Float64(x + Float64(tanh(Float64(t / 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, 2.5e+75], N[(x + N[(N[Tanh[N[(t / y), $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 2.5 \cdot 10^{+75}:\\
\;\;\;\;x + \tanh \left(\frac{t}{y}\right) \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\
\end{array}
\end{array}
if y < 2.5000000000000001e75Initial program 94.8%
Taylor expanded in x around 0 25.7%
associate-/r*25.7%
rec-exp25.7%
div-sub25.7%
rec-exp25.7%
tanh-def-a80.0%
Simplified80.0%
if 2.5000000000000001e75 < y Initial program 82.3%
associate-*l*87.4%
Simplified87.4%
Taylor expanded in y around inf 94.4%
+-commutative94.4%
fma-def94.5%
Simplified94.5%
Final simplification82.7%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 1.8e+37) x (fma z (- t x) x)))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.8e+37) {
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 <= 1.8e+37) 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, 1.8e+37], x, N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.8 \cdot 10^{+37}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\
\end{array}
\end{array}
if y < 1.79999999999999999e37Initial program 94.6%
associate-*l*96.5%
Simplified96.5%
Taylor expanded in x around inf 68.2%
if 1.79999999999999999e37 < y Initial program 85.1%
associate-*l*89.4%
Simplified89.4%
Taylor expanded in y around inf 88.8%
+-commutative88.8%
fma-def88.9%
Simplified88.9%
Final simplification72.9%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 5.5e+37) x (if (<= y 3.6e+223) (* x (- 1.0 z)) (* z (- t x)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5.5e+37) {
tmp = x;
} else if (y <= 3.6e+223) {
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 <= 5.5d+37) then
tmp = x
else if (y <= 3.6d+223) 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 <= 5.5e+37) {
tmp = x;
} else if (y <= 3.6e+223) {
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 <= 5.5e+37: tmp = x elif y <= 3.6e+223: 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 <= 5.5e+37) tmp = x; elseif (y <= 3.6e+223) 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 <= 5.5e+37) tmp = x; elseif (y <= 3.6e+223) 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, 5.5e+37], x, If[LessEqual[y, 3.6e+223], 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 5.5 \cdot 10^{+37}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 3.6 \cdot 10^{+223}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 5.50000000000000016e37Initial program 94.6%
associate-*l*96.6%
Simplified96.6%
Taylor expanded in x around inf 67.9%
if 5.50000000000000016e37 < y < 3.59999999999999991e223Initial program 95.4%
associate-*l*96.8%
Simplified96.8%
Taylor expanded in y around inf 84.6%
Taylor expanded in x around inf 64.5%
neg-mul-164.5%
unsub-neg64.5%
Simplified64.5%
if 3.59999999999999991e223 < y Initial program 55.1%
associate-*l*68.0%
Simplified68.0%
Taylor expanded in y around inf 99.8%
Taylor expanded in z around inf 82.1%
Final simplification68.1%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 4.9e+38) x (if (<= y 8.8e+238) (* x (- 1.0 z)) (+ x (* z t)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.9e+38) {
tmp = x;
} else if (y <= 8.8e+238) {
tmp = x * (1.0 - z);
} 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 <= 4.9d+38) then
tmp = x
else if (y <= 8.8d+238) then
tmp = x * (1.0d0 - z)
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 <= 4.9e+38) {
tmp = x;
} else if (y <= 8.8e+238) {
tmp = x * (1.0 - z);
} else {
tmp = x + (z * t);
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 4.9e+38: tmp = x elif y <= 8.8e+238: tmp = x * (1.0 - z) else: tmp = x + (z * t) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 4.9e+38) tmp = x; elseif (y <= 8.8e+238) tmp = Float64(x * Float64(1.0 - z)); 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 <= 4.9e+38) tmp = x; elseif (y <= 8.8e+238) tmp = x * (1.0 - z); 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, 4.9e+38], x, If[LessEqual[y, 8.8e+238], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.9 \cdot 10^{+38}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 8.8 \cdot 10^{+238}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot t\\
\end{array}
\end{array}
if y < 4.90000000000000002e38Initial program 94.6%
associate-*l*96.6%
Simplified96.6%
Taylor expanded in x around inf 67.9%
if 4.90000000000000002e38 < y < 8.8000000000000002e238Initial program 95.4%
associate-*l*96.8%
Simplified96.8%
Taylor expanded in y around inf 84.6%
Taylor expanded in x around inf 64.5%
neg-mul-164.5%
unsub-neg64.5%
Simplified64.5%
if 8.8000000000000002e238 < y Initial program 55.1%
Taylor expanded in x around 0 23.7%
associate-/r*23.7%
rec-exp23.7%
div-sub23.7%
rec-exp23.7%
tanh-def-a53.9%
Simplified53.9%
Taylor expanded in y around inf 71.6%
+-commutative71.6%
*-commutative71.6%
Simplified71.6%
Final simplification67.5%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 1.8e+37) x (+ x (* z (- t x)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.8e+37) {
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.8d+37) 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.8e+37) {
tmp = x;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 1.8e+37: 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.8e+37) 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.8e+37) 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.8e+37], x, N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.8 \cdot 10^{+37}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 1.79999999999999999e37Initial program 94.6%
associate-*l*96.5%
Simplified96.5%
Taylor expanded in x around inf 68.2%
if 1.79999999999999999e37 < y Initial program 85.1%
associate-*l*89.4%
Simplified89.4%
Taylor expanded in y around inf 88.8%
Final simplification72.9%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 4.6e+37) x (* x (- 1.0 z))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.6e+37) {
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 <= 4.6d+37) 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 <= 4.6e+37) {
tmp = x;
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 4.6e+37: tmp = x else: tmp = x * (1.0 - z) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 4.6e+37) 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 <= 4.6e+37) 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, 4.6e+37], x, N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.6 \cdot 10^{+37}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if y < 4.60000000000000005e37Initial program 94.6%
associate-*l*96.6%
Simplified96.6%
Taylor expanded in x around inf 67.9%
if 4.60000000000000005e37 < y Initial program 84.8%
associate-*l*89.2%
Simplified89.2%
Taylor expanded in y around inf 88.6%
Taylor expanded in x around inf 60.4%
neg-mul-160.4%
unsub-neg60.4%
Simplified60.4%
Final simplification66.2%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 3.55e+239) x (* z t)))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3.55e+239) {
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.55d+239) 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.55e+239) {
tmp = x;
} else {
tmp = z * t;
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 3.55e+239: tmp = x else: tmp = z * t return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 3.55e+239) 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.55e+239) 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[LessEqual[y, 3.55e+239], x, N[(z * t), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.55 \cdot 10^{+239}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if y < 3.54999999999999998e239Initial program 94.7%
associate-*l*96.6%
Simplified96.6%
Taylor expanded in x around inf 64.2%
if 3.54999999999999998e239 < y Initial program 55.1%
associate-*l*68.0%
Simplified68.0%
Taylor expanded in y around inf 99.8%
Taylor expanded in x around -inf 99.9%
+-commutative99.9%
mul-1-neg99.9%
unsub-neg99.9%
*-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 53.5%
*-commutative53.5%
Simplified53.5%
Final simplification63.6%
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.4%
associate-*l*94.9%
Simplified94.9%
Taylor expanded in x around inf 61.4%
Final simplification61.4%
(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 2023318
(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))))))