
(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}
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (if (<= y_m 3.8e+213) (+ x (* y_m (- (* z (tanh (/ t y_m))) (* z (tanh (/ x y_m)))))) (+ x (* z (- t x)))))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 3.8e+213) {
tmp = x + (y_m * ((z * tanh((t / y_m))) - (z * tanh((x / y_m)))));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y_m <= 3.8d+213) then
tmp = x + (y_m * ((z * tanh((t / y_m))) - (z * tanh((x / y_m)))))
else
tmp = x + (z * (t - x))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 3.8e+213) {
tmp = x + (y_m * ((z * Math.tanh((t / y_m))) - (z * Math.tanh((x / y_m)))));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z, t): tmp = 0 if y_m <= 3.8e+213: tmp = x + (y_m * ((z * math.tanh((t / y_m))) - (z * math.tanh((x / y_m))))) else: tmp = x + (z * (t - x)) return tmp
y_m = abs(y) function code(x, y_m, z, t) tmp = 0.0 if (y_m <= 3.8e+213) tmp = Float64(x + Float64(y_m * Float64(Float64(z * tanh(Float64(t / y_m))) - Float64(z * tanh(Float64(x / y_m)))))); else tmp = Float64(x + Float64(z * Float64(t - x))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z, t) tmp = 0.0; if (y_m <= 3.8e+213) tmp = x + (y_m * ((z * tanh((t / y_m))) - (z * tanh((x / y_m))))); else tmp = x + (z * (t - x)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_, t_] := If[LessEqual[y$95$m, 3.8e+213], N[(x + N[(y$95$m * N[(N[(z * N[Tanh[N[(t / y$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(z * N[Tanh[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 3.8 \cdot 10^{+213}:\\
\;\;\;\;x + y\_m \cdot \left(z \cdot \tanh \left(\frac{t}{y\_m}\right) - z \cdot \tanh \left(\frac{x}{y\_m}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 3.7999999999999997e213Initial program 95.0%
sub-neg95.0%
distribute-lft-in90.1%
Applied egg-rr90.1%
distribute-rgt-neg-out90.1%
distribute-lft-neg-in90.1%
add-sqr-sqrt44.7%
sqrt-unprod82.7%
sqr-neg82.7%
sqrt-unprod44.4%
add-sqr-sqrt79.5%
cancel-sign-sub-inv79.5%
associate-*l*78.7%
associate-*l*81.7%
distribute-lft-out--82.1%
add-sqr-sqrt45.7%
sqrt-unprod87.9%
Applied egg-rr98.2%
if 3.7999999999999997e213 < y Initial program 67.9%
Taylor expanded in y around inf 95.2%
Final simplification98.0%
y_m = (fabs.f64 y)
(FPCore (x y_m z t)
:precision binary64
(let* ((t_1 (tanh (/ t y_m))))
(if (<= y_m 3.3e+93)
(+ x (* (* y_m z) (- t_1 (tanh (/ x y_m)))))
(+ x (* z (- (* y_m t_1) x))))))y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double t_1 = tanh((t / y_m));
double tmp;
if (y_m <= 3.3e+93) {
tmp = x + ((y_m * z) * (t_1 - tanh((x / y_m))));
} else {
tmp = x + (z * ((y_m * t_1) - x));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = tanh((t / y_m))
if (y_m <= 3.3d+93) then
tmp = x + ((y_m * z) * (t_1 - tanh((x / y_m))))
else
tmp = x + (z * ((y_m * t_1) - x))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
double t_1 = Math.tanh((t / y_m));
double tmp;
if (y_m <= 3.3e+93) {
tmp = x + ((y_m * z) * (t_1 - Math.tanh((x / y_m))));
} else {
tmp = x + (z * ((y_m * t_1) - x));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z, t): t_1 = math.tanh((t / y_m)) tmp = 0 if y_m <= 3.3e+93: tmp = x + ((y_m * z) * (t_1 - math.tanh((x / y_m)))) else: tmp = x + (z * ((y_m * t_1) - x)) return tmp
y_m = abs(y) function code(x, y_m, z, t) t_1 = tanh(Float64(t / y_m)) tmp = 0.0 if (y_m <= 3.3e+93) tmp = Float64(x + Float64(Float64(y_m * z) * Float64(t_1 - tanh(Float64(x / y_m))))); else tmp = Float64(x + Float64(z * Float64(Float64(y_m * t_1) - x))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z, t) t_1 = tanh((t / y_m)); tmp = 0.0; if (y_m <= 3.3e+93) tmp = x + ((y_m * z) * (t_1 - tanh((x / y_m)))); else tmp = x + (z * ((y_m * t_1) - x)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_, t_] := Block[{t$95$1 = N[Tanh[N[(t / y$95$m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$95$m, 3.3e+93], N[(x + N[(N[(y$95$m * z), $MachinePrecision] * N[(t$95$1 - N[Tanh[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(N[(y$95$m * t$95$1), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_1 := \tanh \left(\frac{t}{y\_m}\right)\\
\mathbf{if}\;y\_m \leq 3.3 \cdot 10^{+93}:\\
\;\;\;\;x + \left(y\_m \cdot z\right) \cdot \left(t\_1 - \tanh \left(\frac{x}{y\_m}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y\_m \cdot t\_1 - x\right)\\
\end{array}
\end{array}
if y < 3.30000000000000009e93Initial program 96.1%
if 3.30000000000000009e93 < y Initial program 78.1%
Taylor expanded in x around 0 55.0%
+-commutative55.0%
Simplified91.9%
Taylor expanded in z around 0 55.0%
associate-/l*55.0%
rec-exp55.0%
rec-exp55.0%
tanh-def-a91.9%
Simplified91.9%
Final simplification95.4%
y_m = (fabs.f64 y)
(FPCore (x y_m z t)
:precision binary64
(let* ((t_1 (tanh (/ t y_m))))
(if (<= t -1.9e-69)
(+ x (* y_m (* z t_1)))
(if (<= t 32000000.0)
(+ x (* z (- t (* y_m (tanh (/ x y_m))))))
(+ x (* t_1 (* y_m z)))))))y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double t_1 = tanh((t / y_m));
double tmp;
if (t <= -1.9e-69) {
tmp = x + (y_m * (z * t_1));
} else if (t <= 32000000.0) {
tmp = x + (z * (t - (y_m * tanh((x / y_m)))));
} else {
tmp = x + (t_1 * (y_m * z));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = tanh((t / y_m))
if (t <= (-1.9d-69)) then
tmp = x + (y_m * (z * t_1))
else if (t <= 32000000.0d0) then
tmp = x + (z * (t - (y_m * tanh((x / y_m)))))
else
tmp = x + (t_1 * (y_m * z))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
double t_1 = Math.tanh((t / y_m));
double tmp;
if (t <= -1.9e-69) {
tmp = x + (y_m * (z * t_1));
} else if (t <= 32000000.0) {
tmp = x + (z * (t - (y_m * Math.tanh((x / y_m)))));
} else {
tmp = x + (t_1 * (y_m * z));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z, t): t_1 = math.tanh((t / y_m)) tmp = 0 if t <= -1.9e-69: tmp = x + (y_m * (z * t_1)) elif t <= 32000000.0: tmp = x + (z * (t - (y_m * math.tanh((x / y_m))))) else: tmp = x + (t_1 * (y_m * z)) return tmp
y_m = abs(y) function code(x, y_m, z, t) t_1 = tanh(Float64(t / y_m)) tmp = 0.0 if (t <= -1.9e-69) tmp = Float64(x + Float64(y_m * Float64(z * t_1))); elseif (t <= 32000000.0) tmp = Float64(x + Float64(z * Float64(t - Float64(y_m * tanh(Float64(x / y_m)))))); else tmp = Float64(x + Float64(t_1 * Float64(y_m * z))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z, t) t_1 = tanh((t / y_m)); tmp = 0.0; if (t <= -1.9e-69) tmp = x + (y_m * (z * t_1)); elseif (t <= 32000000.0) tmp = x + (z * (t - (y_m * tanh((x / y_m))))); else tmp = x + (t_1 * (y_m * z)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_, t_] := Block[{t$95$1 = N[Tanh[N[(t / y$95$m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, -1.9e-69], N[(x + N[(y$95$m * N[(z * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 32000000.0], N[(x + N[(z * N[(t - N[(y$95$m * N[Tanh[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t$95$1 * N[(y$95$m * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_1 := \tanh \left(\frac{t}{y\_m}\right)\\
\mathbf{if}\;t \leq -1.9 \cdot 10^{-69}:\\
\;\;\;\;x + y\_m \cdot \left(z \cdot t\_1\right)\\
\mathbf{elif}\;t \leq 32000000:\\
\;\;\;\;x + z \cdot \left(t - y\_m \cdot \tanh \left(\frac{x}{y\_m}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + t\_1 \cdot \left(y\_m \cdot z\right)\\
\end{array}
\end{array}
if t < -1.8999999999999999e-69Initial program 92.5%
+-commutative92.5%
associate-*l*98.0%
fma-define98.0%
Simplified98.0%
Taylor expanded in x around 0 9.8%
associate-/r*9.8%
div-sub9.8%
rec-exp9.8%
rec-exp9.8%
tanh-def-a93.5%
Simplified93.5%
fma-undefine93.5%
Applied egg-rr93.5%
if -1.8999999999999999e-69 < t < 3.2e7Initial program 91.7%
sub-neg91.7%
distribute-lft-in87.2%
Applied egg-rr87.2%
Taylor expanded in t around 0 33.3%
+-commutative33.3%
mul-1-neg33.3%
associate-/l*33.3%
associate-/l*33.3%
rec-exp33.3%
rec-exp33.3%
tanh-def-a93.4%
Simplified86.9%
Taylor expanded in z around 0 33.3%
associate-/r*33.3%
div-sub33.3%
rec-exp33.3%
rec-exp33.3%
tanh-def-a93.5%
Simplified93.5%
if 3.2e7 < t Initial program 95.2%
Taylor expanded in x around 0 10.9%
associate-*r*10.6%
associate-/r*10.6%
div-sub10.6%
rec-exp10.6%
rec-exp10.6%
tanh-def-a85.0%
Simplified85.0%
Final simplification91.4%
y_m = (fabs.f64 y)
(FPCore (x y_m z t)
:precision binary64
(let* ((t_1 (tanh (/ t y_m))))
(if (<= y_m 4.4e-41)
(+ x (* t_1 (* y_m z)))
(+ x (* z (- (* y_m t_1) x))))))y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double t_1 = tanh((t / y_m));
double tmp;
if (y_m <= 4.4e-41) {
tmp = x + (t_1 * (y_m * z));
} else {
tmp = x + (z * ((y_m * t_1) - x));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = tanh((t / y_m))
if (y_m <= 4.4d-41) then
tmp = x + (t_1 * (y_m * z))
else
tmp = x + (z * ((y_m * t_1) - x))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
double t_1 = Math.tanh((t / y_m));
double tmp;
if (y_m <= 4.4e-41) {
tmp = x + (t_1 * (y_m * z));
} else {
tmp = x + (z * ((y_m * t_1) - x));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z, t): t_1 = math.tanh((t / y_m)) tmp = 0 if y_m <= 4.4e-41: tmp = x + (t_1 * (y_m * z)) else: tmp = x + (z * ((y_m * t_1) - x)) return tmp
y_m = abs(y) function code(x, y_m, z, t) t_1 = tanh(Float64(t / y_m)) tmp = 0.0 if (y_m <= 4.4e-41) tmp = Float64(x + Float64(t_1 * Float64(y_m * z))); else tmp = Float64(x + Float64(z * Float64(Float64(y_m * t_1) - x))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z, t) t_1 = tanh((t / y_m)); tmp = 0.0; if (y_m <= 4.4e-41) tmp = x + (t_1 * (y_m * z)); else tmp = x + (z * ((y_m * t_1) - x)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_, t_] := Block[{t$95$1 = N[Tanh[N[(t / y$95$m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$95$m, 4.4e-41], N[(x + N[(t$95$1 * N[(y$95$m * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(N[(y$95$m * t$95$1), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_1 := \tanh \left(\frac{t}{y\_m}\right)\\
\mathbf{if}\;y\_m \leq 4.4 \cdot 10^{-41}:\\
\;\;\;\;x + t\_1 \cdot \left(y\_m \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y\_m \cdot t\_1 - x\right)\\
\end{array}
\end{array}
if y < 4.4e-41Initial program 96.2%
Taylor expanded in x around 0 25.1%
associate-*r*24.9%
associate-/r*24.9%
div-sub24.9%
rec-exp24.9%
rec-exp24.9%
tanh-def-a85.1%
Simplified85.1%
if 4.4e-41 < y Initial program 84.0%
Taylor expanded in x around 0 44.1%
+-commutative44.1%
Simplified87.7%
Taylor expanded in z around 0 44.1%
associate-/l*44.1%
rec-exp44.1%
rec-exp44.1%
tanh-def-a87.7%
Simplified87.7%
Final simplification85.8%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (if (<= y_m 1.08e+120) (+ x (* (tanh (/ t y_m)) (* y_m z))) (+ x (* z (- t x)))))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 1.08e+120) {
tmp = x + (tanh((t / y_m)) * (y_m * z));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y_m <= 1.08d+120) then
tmp = x + (tanh((t / y_m)) * (y_m * z))
else
tmp = x + (z * (t - x))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 1.08e+120) {
tmp = x + (Math.tanh((t / y_m)) * (y_m * z));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z, t): tmp = 0 if y_m <= 1.08e+120: tmp = x + (math.tanh((t / y_m)) * (y_m * z)) else: tmp = x + (z * (t - x)) return tmp
y_m = abs(y) function code(x, y_m, z, t) tmp = 0.0 if (y_m <= 1.08e+120) tmp = Float64(x + Float64(tanh(Float64(t / y_m)) * Float64(y_m * z))); else tmp = Float64(x + Float64(z * Float64(t - x))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z, t) tmp = 0.0; if (y_m <= 1.08e+120) tmp = x + (tanh((t / y_m)) * (y_m * z)); else tmp = x + (z * (t - x)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_, t_] := If[LessEqual[y$95$m, 1.08e+120], N[(x + N[(N[Tanh[N[(t / y$95$m), $MachinePrecision]], $MachinePrecision] * N[(y$95$m * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 1.08 \cdot 10^{+120}:\\
\;\;\;\;x + \tanh \left(\frac{t}{y\_m}\right) \cdot \left(y\_m \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 1.0799999999999999e120Initial program 95.4%
Taylor expanded in x around 0 25.1%
associate-*r*25.0%
associate-/r*25.0%
div-sub25.0%
rec-exp25.0%
rec-exp25.0%
tanh-def-a83.8%
Simplified83.8%
if 1.0799999999999999e120 < y Initial program 78.3%
Taylor expanded in y around inf 92.8%
Final simplification85.2%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (if (<= y_m 1.22e+120) (+ x (* y_m (* z (tanh (/ t y_m))))) (+ x (* z (- t x)))))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 1.22e+120) {
tmp = x + (y_m * (z * tanh((t / y_m))));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y_m <= 1.22d+120) then
tmp = x + (y_m * (z * tanh((t / y_m))))
else
tmp = x + (z * (t - x))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 1.22e+120) {
tmp = x + (y_m * (z * Math.tanh((t / y_m))));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z, t): tmp = 0 if y_m <= 1.22e+120: tmp = x + (y_m * (z * math.tanh((t / y_m)))) else: tmp = x + (z * (t - x)) return tmp
y_m = abs(y) function code(x, y_m, z, t) tmp = 0.0 if (y_m <= 1.22e+120) tmp = Float64(x + Float64(y_m * Float64(z * tanh(Float64(t / y_m))))); else tmp = Float64(x + Float64(z * Float64(t - x))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z, t) tmp = 0.0; if (y_m <= 1.22e+120) tmp = x + (y_m * (z * tanh((t / y_m)))); else tmp = x + (z * (t - x)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_, t_] := If[LessEqual[y$95$m, 1.22e+120], N[(x + N[(y$95$m * N[(z * N[Tanh[N[(t / y$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 1.22 \cdot 10^{+120}:\\
\;\;\;\;x + y\_m \cdot \left(z \cdot \tanh \left(\frac{t}{y\_m}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 1.22e120Initial program 95.4%
+-commutative95.4%
associate-*l*98.0%
fma-define98.0%
Simplified98.0%
Taylor expanded in x around 0 25.1%
associate-/r*25.1%
div-sub25.1%
rec-exp25.1%
rec-exp25.1%
tanh-def-a83.8%
Simplified83.8%
fma-undefine83.8%
Applied egg-rr83.8%
if 1.22e120 < y Initial program 78.3%
Taylor expanded in y around inf 92.8%
Final simplification85.2%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (if (<= y_m 4.4e-41) x (fma z (- t x) x)))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 4.4e-41) {
tmp = x;
} else {
tmp = fma(z, (t - x), x);
}
return tmp;
}
y_m = abs(y) function code(x, y_m, z, t) tmp = 0.0 if (y_m <= 4.4e-41) tmp = x; else tmp = fma(z, Float64(t - x), x); end return tmp end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_, t_] := If[LessEqual[y$95$m, 4.4e-41], x, N[(z * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 4.4 \cdot 10^{-41}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t - x, x\right)\\
\end{array}
\end{array}
if y < 4.4e-41Initial program 96.2%
Taylor expanded in x around inf 69.2%
if 4.4e-41 < y Initial program 84.0%
Taylor expanded in y around inf 77.6%
+-commutative77.6%
fma-define77.6%
Simplified77.6%
Final simplification71.6%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (if (<= y_m 2.3e-41) x (+ x (* z (- t x)))))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 2.3e-41) {
tmp = x;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y_m <= 2.3d-41) then
tmp = x
else
tmp = x + (z * (t - x))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 2.3e-41) {
tmp = x;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z, t): tmp = 0 if y_m <= 2.3e-41: tmp = x else: tmp = x + (z * (t - x)) return tmp
y_m = abs(y) function code(x, y_m, z, t) tmp = 0.0 if (y_m <= 2.3e-41) tmp = x; else tmp = Float64(x + Float64(z * Float64(t - x))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z, t) tmp = 0.0; if (y_m <= 2.3e-41) tmp = x; else tmp = x + (z * (t - x)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_, t_] := If[LessEqual[y$95$m, 2.3e-41], x, N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 2.3 \cdot 10^{-41}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 2.3000000000000001e-41Initial program 96.2%
Taylor expanded in x around inf 69.2%
if 2.3000000000000001e-41 < y Initial program 84.0%
Taylor expanded in y around inf 77.6%
Final simplification71.6%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (if (<= y_m 4.4e-41) x (* x (- 1.0 z))))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 4.4e-41) {
tmp = x;
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y_m <= 4.4d-41) then
tmp = x
else
tmp = x * (1.0d0 - z)
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 4.4e-41) {
tmp = x;
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z, t): tmp = 0 if y_m <= 4.4e-41: tmp = x else: tmp = x * (1.0 - z) return tmp
y_m = abs(y) function code(x, y_m, z, t) tmp = 0.0 if (y_m <= 4.4e-41) tmp = x; else tmp = Float64(x * Float64(1.0 - z)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z, t) tmp = 0.0; if (y_m <= 4.4e-41) tmp = x; else tmp = x * (1.0 - z); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_, t_] := If[LessEqual[y$95$m, 4.4e-41], x, N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 4.4 \cdot 10^{-41}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if y < 4.4e-41Initial program 96.2%
Taylor expanded in x around inf 69.2%
if 4.4e-41 < y Initial program 84.0%
Taylor expanded in x around 0 44.1%
+-commutative44.1%
Simplified87.7%
Taylor expanded in x around inf 55.5%
mul-1-neg55.5%
unsub-neg55.5%
Simplified55.5%
Final simplification65.3%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (if (<= y_m 8e-34) x (+ x (* z t))))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 8e-34) {
tmp = x;
} else {
tmp = x + (z * t);
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y_m <= 8d-34) then
tmp = x
else
tmp = x + (z * t)
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 8e-34) {
tmp = x;
} else {
tmp = x + (z * t);
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z, t): tmp = 0 if y_m <= 8e-34: tmp = x else: tmp = x + (z * t) return tmp
y_m = abs(y) function code(x, y_m, z, t) tmp = 0.0 if (y_m <= 8e-34) tmp = x; else tmp = Float64(x + Float64(z * t)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z, t) tmp = 0.0; if (y_m <= 8e-34) tmp = x; else tmp = x + (z * t); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_, t_] := If[LessEqual[y$95$m, 8e-34], x, N[(x + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 8 \cdot 10^{-34}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot t\\
\end{array}
\end{array}
if y < 7.99999999999999942e-34Initial program 96.2%
Taylor expanded in x around inf 69.2%
if 7.99999999999999942e-34 < y Initial program 84.0%
+-commutative84.0%
associate-*l*97.2%
fma-define97.2%
Simplified97.2%
Taylor expanded in x around 0 34.2%
associate-/r*34.2%
div-sub34.2%
rec-exp34.2%
rec-exp34.2%
tanh-def-a78.2%
Simplified78.2%
Taylor expanded in y around inf 69.4%
*-commutative69.4%
Simplified69.4%
Final simplification69.2%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (if (<= z -1.6e+211) (* z t) x))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double tmp;
if (z <= -1.6e+211) {
tmp = z * t;
} else {
tmp = x;
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.6d+211)) then
tmp = z * t
else
tmp = x
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
double tmp;
if (z <= -1.6e+211) {
tmp = z * t;
} else {
tmp = x;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z, t): tmp = 0 if z <= -1.6e+211: tmp = z * t else: tmp = x return tmp
y_m = abs(y) function code(x, y_m, z, t) tmp = 0.0 if (z <= -1.6e+211) tmp = Float64(z * t); else tmp = x; end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z, t) tmp = 0.0; if (z <= -1.6e+211) tmp = z * t; else tmp = x; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_, t_] := If[LessEqual[z, -1.6e+211], N[(z * t), $MachinePrecision], x]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{+211}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.59999999999999988e211Initial program 80.2%
+-commutative80.2%
associate-*l*94.6%
fma-define94.6%
Simplified94.6%
Taylor expanded in x around 0 1.2%
associate-/r*1.2%
div-sub1.2%
rec-exp1.2%
rec-exp1.2%
tanh-def-a70.5%
Simplified70.5%
Taylor expanded in t around 0 43.7%
Taylor expanded in z around inf 49.3%
*-commutative49.3%
Simplified49.3%
if -1.59999999999999988e211 < z Initial program 93.8%
Taylor expanded in x around inf 67.2%
Final simplification65.9%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 x)
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
return x;
}
y_m = abs(y)
real(8) function code(x, y_m, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
return x;
}
y_m = math.fabs(y) def code(x, y_m, z, t): return x
y_m = abs(y) function code(x, y_m, z, t) return x end
y_m = abs(y); function tmp = code(x, y_m, z, t) tmp = x; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_, t_] := x
\begin{array}{l}
y_m = \left|y\right|
\\
x
\end{array}
Initial program 92.8%
Taylor expanded in x around inf 63.6%
Final simplification63.6%
(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 2024054
(FPCore (x y z t)
:name "SynthBasics:moogVCF from YampaSynth-0.2"
:precision binary64
:alt
(+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y))))))
(+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))