
(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 5.9e+184) (fma z (* y (- (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 <= 5.9e+184) {
tmp = fma(z, (y * (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 <= 5.9e+184) tmp = fma(z, Float64(y * 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, 5.9e+184], N[(z * N[(y * 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 5.9 \cdot 10^{+184}:\\
\;\;\;\;\mathsf{fma}\left(z, y \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 < 5.9000000000000001e184Initial program 96.7%
+-commutative96.7%
*-commutative96.7%
associate-*l*99.2%
fma-def99.2%
Simplified99.2%
if 5.9000000000000001e184 < y Initial program 62.8%
associate-*l*77.3%
Simplified77.3%
Taylor expanded in y around inf 100.0%
Final simplification99.2%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 8.8e+151) (+ 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 <= 8.8e+151) {
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 <= 8.8d+151) 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 <= 8.8e+151) {
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 <= 8.8e+151: 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 <= 8.8e+151) 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 <= 8.8e+151) 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, 8.8e+151], 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 8.8 \cdot 10^{+151}:\\
\;\;\;\;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 < 8.80000000000000027e151Initial program 97.3%
associate-*l*98.6%
Simplified98.6%
if 8.80000000000000027e151 < y Initial program 62.6%
associate-*l*77.0%
Simplified77.0%
Taylor expanded in y around inf 95.7%
Final simplification98.4%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 1.2e+111) (+ x (* (tanh (/ t y)) (* y z))) (+ x (* z (- t x)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.2e+111) {
tmp = x + (tanh((t / 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 <= 1.2d+111) then
tmp = x + (tanh((t / 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 <= 1.2e+111) {
tmp = x + (Math.tanh((t / y)) * (y * z));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 1.2e+111: tmp = x + (math.tanh((t / 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 <= 1.2e+111) tmp = Float64(x + Float64(tanh(Float64(t / 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 <= 1.2e+111) tmp = x + (tanh((t / 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, 1.2e+111], N[(x + N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.2 \cdot 10^{+111}:\\
\;\;\;\;x + \tanh \left(\frac{t}{y}\right) \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 1.20000000000000003e111Initial program 98.1%
associate-*l*98.6%
Simplified98.6%
Taylor expanded in x around 0 26.8%
*-commutative26.8%
associate-/r*26.8%
div-sub26.8%
rec-exp26.8%
rec-exp26.8%
Simplified84.4%
if 1.20000000000000003e111 < y Initial program 66.3%
associate-*l*83.4%
Simplified83.4%
Taylor expanded in y around inf 93.9%
Final simplification85.5%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 6.8e+68) x (if (<= y 1.85e+214) (+ x (* z t)) (* z (- t x)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 6.8e+68) {
tmp = x;
} else if (y <= 1.85e+214) {
tmp = x + (z * t);
} 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 <= 6.8d+68) then
tmp = x
else if (y <= 1.85d+214) then
tmp = x + (z * t)
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 <= 6.8e+68) {
tmp = x;
} else if (y <= 1.85e+214) {
tmp = x + (z * t);
} else {
tmp = z * (t - x);
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 6.8e+68: tmp = x elif y <= 1.85e+214: tmp = x + (z * t) else: tmp = z * (t - x) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 6.8e+68) tmp = x; elseif (y <= 1.85e+214) tmp = Float64(x + Float64(z * t)); 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 <= 6.8e+68) tmp = x; elseif (y <= 1.85e+214) tmp = x + (z * t); 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, 6.8e+68], x, If[LessEqual[y, 1.85e+214], N[(x + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.8 \cdot 10^{+68}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.85 \cdot 10^{+214}:\\
\;\;\;\;x + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 6.8000000000000003e68Initial program 98.0%
associate-*l*98.6%
Simplified98.6%
Taylor expanded in y around inf 52.8%
Taylor expanded in z around 0 68.9%
if 6.8000000000000003e68 < y < 1.8499999999999999e214Initial program 80.8%
Taylor expanded in y around inf 72.4%
Taylor expanded in t around inf 67.6%
Taylor expanded in x around 0 78.0%
if 1.8499999999999999e214 < y Initial program 55.7%
associate-*l*77.8%
Simplified77.8%
Taylor expanded in y around inf 100.0%
Taylor expanded in z around inf 77.5%
Final simplification70.1%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 6.2e+68) x (+ x (* z (- t x)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 6.2e+68) {
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 <= 6.2d+68) 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 <= 6.2e+68) {
tmp = x;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 6.2e+68: tmp = x else: tmp = x + (z * (t - x)) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 6.2e+68) 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 <= 6.2e+68) 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, 6.2e+68], x, N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.2 \cdot 10^{+68}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 6.1999999999999997e68Initial program 98.0%
associate-*l*98.6%
Simplified98.6%
Taylor expanded in y around inf 52.8%
Taylor expanded in z around 0 68.9%
if 6.1999999999999997e68 < y Initial program 71.2%
associate-*l*85.7%
Simplified85.7%
Taylor expanded in y around inf 94.8%
Final simplification72.3%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 8.5e+142) x (* z (- t x))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 8.5e+142) {
tmp = x;
} 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 <= 8.5d+142) then
tmp = x
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 <= 8.5e+142) {
tmp = x;
} else {
tmp = z * (t - x);
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 8.5e+142: tmp = x else: tmp = z * (t - x) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 8.5e+142) tmp = x; 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 <= 8.5e+142) tmp = x; 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, 8.5e+142], x, N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 8.5 \cdot 10^{+142}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 8.49999999999999955e142Initial program 97.3%
associate-*l*98.6%
Simplified98.6%
Taylor expanded in y around inf 55.0%
Taylor expanded in z around 0 67.9%
if 8.49999999999999955e142 < y Initial program 65.8%
associate-*l*79.0%
Simplified79.0%
Taylor expanded in y around inf 92.3%
Taylor expanded in z around inf 67.2%
Final simplification67.8%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 7.2e+214) x (* z (- x))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 7.2e+214) {
tmp = x;
} else {
tmp = z * -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 <= 7.2d+214) then
tmp = x
else
tmp = z * -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 <= 7.2e+214) {
tmp = x;
} else {
tmp = z * -x;
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 7.2e+214: tmp = x else: tmp = z * -x return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 7.2e+214) tmp = x; else tmp = Float64(z * Float64(-x)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 7.2e+214) tmp = x; else tmp = z * -x; end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 7.2e+214], x, N[(z * (-x)), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.2 \cdot 10^{+214}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-x\right)\\
\end{array}
\end{array}
if y < 7.2000000000000002e214Initial program 96.6%
associate-*l*97.9%
Simplified97.9%
Taylor expanded in y around inf 56.3%
Taylor expanded in z around 0 66.6%
if 7.2000000000000002e214 < y Initial program 52.1%
associate-*l*75.9%
Simplified75.9%
Taylor expanded in y around inf 100.0%
Taylor expanded in z around inf 75.6%
Taylor expanded in t around 0 47.8%
associate-*r*47.8%
mul-1-neg47.8%
Simplified47.8%
Final simplification65.7%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 3.5e+213) x (* z t)))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3.5e+213) {
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.5d+213) 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.5e+213) {
tmp = x;
} else {
tmp = z * t;
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 3.5e+213: tmp = x else: tmp = z * t return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 3.5e+213) 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.5e+213) 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.5e+213], x, N[(z * t), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.5 \cdot 10^{+213}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if y < 3.4999999999999997e213Initial program 96.5%
associate-*l*97.9%
Simplified97.9%
Taylor expanded in y around inf 56.2%
Taylor expanded in z around 0 66.9%
if 3.4999999999999997e213 < y Initial program 55.7%
associate-*l*77.8%
Simplified77.8%
Taylor expanded in y around inf 100.0%
Taylor expanded in z around inf 77.5%
Taylor expanded in t around inf 33.1%
Final simplification65.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 94.5%
associate-*l*96.9%
Simplified96.9%
Taylor expanded in y around inf 58.4%
Taylor expanded in z around 0 64.7%
Final simplification64.7%
(FPCore (x y z t) :precision binary64 (+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y)))))))
double code(double x, double y, double z, double t) {
return x + (y * (z * (tanh((t / y)) - tanh((x / y)))));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + (y * (z * (tanh((t / y)) - tanh((x / y)))))
end function
public static double code(double x, double y, double z, double t) {
return x + (y * (z * (Math.tanh((t / y)) - Math.tanh((x / y)))));
}
def code(x, y, z, t): return x + (y * (z * (math.tanh((t / y)) - math.tanh((x / y)))))
function code(x, y, z, t) return Float64(x + Float64(y * Float64(z * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))))) end
function tmp = code(x, y, z, t) tmp = x + (y * (z * (tanh((t / y)) - tanh((x / y))))); end
code[x_, y_, z_, t_] := N[(x + N[(y * N[(z * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right)\right)
\end{array}
herbie shell --seed 2023213
(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))))))