
(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 9 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.15e+169) (fma (* y (- (tanh (/ t y)) (tanh (/ x y)))) z x) (+ x (* z (- t x)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.15e+169) {
tmp = fma((y * (tanh((t / y)) - tanh((x / y)))), z, x);
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 2.15e+169) tmp = fma(Float64(y * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))), z, x); else tmp = Float64(x + Float64(z * Float64(t - x))); end return tmp end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 2.15e+169], N[(N[(y * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z + x), $MachinePrecision], N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.15 \cdot 10^{+169}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), z, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 2.1500000000000001e169Initial program 94.0%
+-commutative94.0%
*-commutative94.0%
associate-*r*97.8%
fma-def97.8%
Applied egg-rr97.8%
if 2.1500000000000001e169 < y Initial program 77.1%
Taylor expanded in y around inf 96.9%
Final simplification97.7%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 2.4e+134) (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.4e+134) {
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.4e+134) tmp = fma(Float64(y * 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.4e+134], N[(N[(y * z), $MachinePrecision] * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $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.4 \cdot 10^{+134}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot z, \tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 2.40000000000000005e134Initial program 93.9%
+-commutative93.9%
fma-def93.9%
Simplified93.9%
if 2.40000000000000005e134 < y Initial program 79.2%
Taylor expanded in y around inf 94.5%
Final simplification94.0%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 2.5e+134) (+ x (* (- (tanh (/ t y)) (tanh (/ x y))) (* y z))) (+ x (* z (- t x)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.5e+134) {
tmp = x + ((tanh((t / y)) - tanh((x / y))) * (y * z));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 2.5d+134) then
tmp = x + ((tanh((t / y)) - tanh((x / y))) * (y * z))
else
tmp = x + (z * (t - x))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.5e+134) {
tmp = x + ((Math.tanh((t / y)) - Math.tanh((x / y))) * (y * z));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 2.5e+134: tmp = x + ((math.tanh((t / y)) - math.tanh((x / y))) * (y * z)) else: tmp = x + (z * (t - x)) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 2.5e+134) tmp = Float64(x + Float64(Float64(tanh(Float64(t / y)) - tanh(Float64(x / y))) * Float64(y * z))); else tmp = Float64(x + Float64(z * Float64(t - x))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 2.5e+134) tmp = x + ((tanh((t / y)) - tanh((x / y))) * (y * z)); else tmp = x + (z * (t - x)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 2.5e+134], N[(x + N[(N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.5 \cdot 10^{+134}:\\
\;\;\;\;x + \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 2.4999999999999999e134Initial program 93.9%
if 2.4999999999999999e134 < y Initial program 79.2%
Taylor expanded in y around inf 94.5%
Final simplification94.0%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 4.8e+123) (+ x (* y (* (tanh (/ t y)) z))) (+ x (* z (- t x)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.8e+123) {
tmp = x + (y * (tanh((t / y)) * z));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 4.8d+123) then
tmp = x + (y * (tanh((t / y)) * z))
else
tmp = x + (z * (t - x))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.8e+123) {
tmp = x + (y * (Math.tanh((t / y)) * z));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 4.8e+123: tmp = x + (y * (math.tanh((t / y)) * z)) else: tmp = x + (z * (t - x)) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 4.8e+123) tmp = Float64(x + Float64(y * Float64(tanh(Float64(t / y)) * z))); else tmp = Float64(x + Float64(z * Float64(t - x))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 4.8e+123) tmp = x + (y * (tanh((t / y)) * z)); else tmp = x + (z * (t - x)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 4.8e+123], N[(x + N[(y * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.8 \cdot 10^{+123}:\\
\;\;\;\;x + y \cdot \left(\tanh \left(\frac{t}{y}\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 4.79999999999999978e123Initial program 93.9%
Taylor expanded in x around 0 23.7%
associate-/r*23.7%
div-sub23.7%
rec-exp23.8%
rec-exp23.8%
tanh-def-a78.4%
Simplified78.4%
if 4.79999999999999978e123 < y Initial program 81.0%
Taylor expanded in y around inf 95.0%
Final simplification80.7%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 1.7e+86) x (if (or (<= y 8e+223) (not (<= y 6.9e+248))) (* z (- t x)) x)))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.7e+86) {
tmp = x;
} else if ((y <= 8e+223) || !(y <= 6.9e+248)) {
tmp = z * (t - x);
} 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 (y <= 1.7d+86) then
tmp = x
else if ((y <= 8d+223) .or. (.not. (y <= 6.9d+248))) then
tmp = z * (t - x)
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 (y <= 1.7e+86) {
tmp = x;
} else if ((y <= 8e+223) || !(y <= 6.9e+248)) {
tmp = z * (t - x);
} else {
tmp = x;
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 1.7e+86: tmp = x elif (y <= 8e+223) or not (y <= 6.9e+248): tmp = z * (t - x) else: tmp = x return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 1.7e+86) tmp = x; elseif ((y <= 8e+223) || !(y <= 6.9e+248)) tmp = Float64(z * Float64(t - x)); else tmp = x; end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 1.7e+86) tmp = x; elseif ((y <= 8e+223) || ~((y <= 6.9e+248))) tmp = z * (t - x); else tmp = x; end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 1.7e+86], x, If[Or[LessEqual[y, 8e+223], N[Not[LessEqual[y, 6.9e+248]], $MachinePrecision]], N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.7 \cdot 10^{+86}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+223} \lor \neg \left(y \leq 6.9 \cdot 10^{+248}\right):\\
\;\;\;\;z \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < 1.6999999999999999e86 or 8.00000000000000037e223 < y < 6.89999999999999965e248Initial program 93.7%
Taylor expanded in x around inf 62.1%
if 1.6999999999999999e86 < y < 8.00000000000000037e223 or 6.89999999999999965e248 < y Initial program 83.8%
Taylor expanded in y around inf 91.2%
Taylor expanded in z around inf 73.1%
Final simplification63.9%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 7.4e+92) x (if (<= y 8.2e+223) (* t z) (if (<= y 9e+248) x (* t z)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 7.4e+92) {
tmp = x;
} else if (y <= 8.2e+223) {
tmp = t * z;
} else if (y <= 9e+248) {
tmp = x;
} else {
tmp = t * z;
}
return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 7.4d+92) then
tmp = x
else if (y <= 8.2d+223) then
tmp = t * z
else if (y <= 9d+248) then
tmp = x
else
tmp = t * z
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 7.4e+92) {
tmp = x;
} else if (y <= 8.2e+223) {
tmp = t * z;
} else if (y <= 9e+248) {
tmp = x;
} else {
tmp = t * z;
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 7.4e+92: tmp = x elif y <= 8.2e+223: tmp = t * z elif y <= 9e+248: tmp = x else: tmp = t * z return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 7.4e+92) tmp = x; elseif (y <= 8.2e+223) tmp = Float64(t * z); elseif (y <= 9e+248) tmp = x; else tmp = Float64(t * z); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 7.4e+92) tmp = x; elseif (y <= 8.2e+223) tmp = t * z; elseif (y <= 9e+248) tmp = x; else tmp = t * z; end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 7.4e+92], x, If[LessEqual[y, 8.2e+223], N[(t * z), $MachinePrecision], If[LessEqual[y, 9e+248], x, N[(t * z), $MachinePrecision]]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.4 \cdot 10^{+92}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{+223}:\\
\;\;\;\;t \cdot z\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+248}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t \cdot z\\
\end{array}
\end{array}
if y < 7.39999999999999997e92 or 8.2e223 < y < 8.9999999999999993e248Initial program 93.8%
Taylor expanded in x around inf 61.5%
if 7.39999999999999997e92 < y < 8.2e223 or 8.9999999999999993e248 < y Initial program 82.0%
Taylor expanded in y around inf 92.8%
Taylor expanded in z around inf 75.5%
Taylor expanded in t around inf 47.9%
Final simplification59.6%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 4e+55) x (if (<= y 5.5e+253) (+ x (* t z)) (* z (- t x)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4e+55) {
tmp = x;
} else if (y <= 5.5e+253) {
tmp = x + (t * 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 <= 4d+55) then
tmp = x
else if (y <= 5.5d+253) then
tmp = x + (t * 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 <= 4e+55) {
tmp = x;
} else if (y <= 5.5e+253) {
tmp = x + (t * z);
} else {
tmp = z * (t - x);
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 4e+55: tmp = x elif y <= 5.5e+253: tmp = x + (t * z) else: tmp = z * (t - x) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 4e+55) tmp = x; elseif (y <= 5.5e+253) tmp = Float64(x + Float64(t * 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 <= 4e+55) tmp = x; elseif (y <= 5.5e+253) tmp = x + (t * 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, 4e+55], x, If[LessEqual[y, 5.5e+253], N[(x + N[(t * z), $MachinePrecision]), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4 \cdot 10^{+55}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{+253}:\\
\;\;\;\;x + t \cdot z\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 4.00000000000000004e55Initial program 93.4%
Taylor expanded in x around inf 61.5%
if 4.00000000000000004e55 < y < 5.5000000000000003e253Initial program 90.0%
Taylor expanded in y around inf 87.2%
Taylor expanded in t around inf 70.2%
if 5.5000000000000003e253 < y Initial program 60.5%
Taylor expanded in y around inf 82.2%
Taylor expanded in z around inf 82.2%
Final simplification63.5%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 2.2e-8) x (+ x (* z (- t x)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.2e-8) {
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 <= 2.2d-8) 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 <= 2.2e-8) {
tmp = x;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 2.2e-8: tmp = x else: tmp = x + (z * (t - x)) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 2.2e-8) 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 <= 2.2e-8) 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, 2.2e-8], x, N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.2 \cdot 10^{-8}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 2.1999999999999998e-8Initial program 93.0%
Taylor expanded in x around inf 62.3%
if 2.1999999999999998e-8 < y Initial program 89.4%
Taylor expanded in y around inf 81.9%
Final simplification67.1%
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.1%
Taylor expanded in x around inf 55.3%
Final simplification55.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 2023285
(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))))))