
(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 8 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 9.5e+229) (+ x (* y_m (* z (- (tanh (/ t y_m)) (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 <= 9.5e+229) {
tmp = x + (y_m * (z * (tanh((t / y_m)) - 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 <= 9.5d+229) then
tmp = x + (y_m * (z * (tanh((t / y_m)) - 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 <= 9.5e+229) {
tmp = x + (y_m * (z * (Math.tanh((t / y_m)) - 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 <= 9.5e+229: tmp = x + (y_m * (z * (math.tanh((t / y_m)) - 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 <= 9.5e+229) tmp = Float64(x + Float64(y_m * Float64(z * Float64(tanh(Float64(t / y_m)) - 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 <= 9.5e+229) tmp = x + (y_m * (z * (tanh((t / y_m)) - 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, 9.5e+229], N[(x + N[(y$95$m * N[(z * N[(N[Tanh[N[(t / y$95$m), $MachinePrecision]], $MachinePrecision] - 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 9.5 \cdot 10^{+229}:\\
\;\;\;\;x + y\_m \cdot \left(z \cdot \left(\tanh \left(\frac{t}{y\_m}\right) - \tanh \left(\frac{x}{y\_m}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 9.5e229Initial program 95.2%
sub-neg95.2%
distribute-lft-in91.8%
Applied egg-rr91.8%
distribute-lft-out95.2%
sub-neg95.2%
associate-*l*97.5%
Simplified97.5%
if 9.5e229 < y Initial program 65.9%
Taylor expanded in y around inf 100.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.55e-230)
x
(if (<= y_m 3.3e+27)
(+ 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 <= 3.55e-230) {
tmp = x;
} else if (y_m <= 3.3e+27) {
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 <= 3.55d-230) then
tmp = x
else if (y_m <= 3.3d+27) 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 <= 3.55e-230) {
tmp = x;
} else if (y_m <= 3.3e+27) {
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 <= 3.55e-230: tmp = x elif y_m <= 3.3e+27: 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 <= 3.55e-230) tmp = x; elseif (y_m <= 3.3e+27) 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 <= 3.55e-230) tmp = x; elseif (y_m <= 3.3e+27) 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, 3.55e-230], x, If[LessEqual[y$95$m, 3.3e+27], 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 3.55 \cdot 10^{-230}:\\
\;\;\;\;x\\
\mathbf{elif}\;y\_m \leq 3.3 \cdot 10^{+27}:\\
\;\;\;\;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 < 3.55000000000000009e-230Initial program 94.5%
+-commutative94.5%
associate-*l*96.9%
fma-define96.9%
Simplified96.9%
Taylor expanded in y around 0 64.2%
if 3.55000000000000009e-230 < y < 3.2999999999999998e27Initial program 99.9%
Taylor expanded in x around 0 20.0%
associate-*r*20.0%
associate-/r*20.0%
div-sub20.0%
rec-exp20.0%
rec-exp20.0%
tanh-def-a88.8%
Simplified88.8%
if 3.2999999999999998e27 < y Initial program 80.9%
Taylor expanded in x around 0 64.4%
+-commutative64.4%
Simplified91.7%
Taylor expanded in z around 0 64.4%
associate-/l*64.4%
rec-exp64.4%
rec-exp64.4%
tanh-def-a91.7%
Simplified91.7%
Final simplification74.5%
y_m = (fabs.f64 y)
(FPCore (x y_m z t)
:precision binary64
(if (<= y_m 3.55e-230)
x
(if (<= y_m 5.2e+117)
(+ 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 <= 3.55e-230) {
tmp = x;
} else if (y_m <= 5.2e+117) {
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 <= 3.55d-230) then
tmp = x
else if (y_m <= 5.2d+117) 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 <= 3.55e-230) {
tmp = x;
} else if (y_m <= 5.2e+117) {
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 <= 3.55e-230: tmp = x elif y_m <= 5.2e+117: 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 <= 3.55e-230) tmp = x; elseif (y_m <= 5.2e+117) 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 <= 3.55e-230) tmp = x; elseif (y_m <= 5.2e+117) 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, 3.55e-230], x, If[LessEqual[y$95$m, 5.2e+117], 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 3.55 \cdot 10^{-230}:\\
\;\;\;\;x\\
\mathbf{elif}\;y\_m \leq 5.2 \cdot 10^{+117}:\\
\;\;\;\;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 < 3.55000000000000009e-230Initial program 94.5%
+-commutative94.5%
associate-*l*96.9%
fma-define96.9%
Simplified96.9%
Taylor expanded in y around 0 64.2%
if 3.55000000000000009e-230 < y < 5.1999999999999999e117Initial program 99.9%
Taylor expanded in x around 0 30.2%
associate-*r*30.2%
associate-/r*30.2%
div-sub30.2%
rec-exp30.2%
rec-exp30.2%
tanh-def-a90.7%
Simplified90.7%
if 5.1999999999999999e117 < y Initial program 75.0%
Taylor expanded in y around inf 91.7%
Final simplification74.9%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (if (<= x -4e-204) x (if (<= x 1.55e-261) (* z t) x)))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double tmp;
if (x <= -4e-204) {
tmp = x;
} else if (x <= 1.55e-261) {
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 (x <= (-4d-204)) then
tmp = x
else if (x <= 1.55d-261) 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 (x <= -4e-204) {
tmp = x;
} else if (x <= 1.55e-261) {
tmp = z * t;
} else {
tmp = x;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z, t): tmp = 0 if x <= -4e-204: tmp = x elif x <= 1.55e-261: tmp = z * t else: tmp = x return tmp
y_m = abs(y) function code(x, y_m, z, t) tmp = 0.0 if (x <= -4e-204) tmp = x; elseif (x <= 1.55e-261) 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 (x <= -4e-204) tmp = x; elseif (x <= 1.55e-261) 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[x, -4e-204], x, If[LessEqual[x, 1.55e-261], N[(z * t), $MachinePrecision], x]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-204}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-261}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -4e-204 or 1.5499999999999999e-261 < x Initial program 94.2%
+-commutative94.2%
associate-*l*97.8%
fma-define97.8%
Simplified97.8%
Taylor expanded in y around 0 70.5%
if -4e-204 < x < 1.5499999999999999e-261Initial program 87.5%
Taylor expanded in y around inf 51.0%
Taylor expanded in t around inf 51.0%
Taylor expanded in x around inf 46.1%
associate-/l*35.9%
Simplified35.9%
Taylor expanded in x around 0 44.6%
Final simplification66.6%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (if (<= y_m 4.9e+27) 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 <= 4.9e+27) {
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 <= 4.9d+27) 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 <= 4.9e+27) {
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 <= 4.9e+27: 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 <= 4.9e+27) 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 <= 4.9e+27) 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, 4.9e+27], 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 4.9 \cdot 10^{+27}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 4.90000000000000015e27Initial program 95.9%
+-commutative95.9%
associate-*l*97.7%
fma-define97.7%
Simplified97.7%
Taylor expanded in y around 0 65.0%
if 4.90000000000000015e27 < y Initial program 80.9%
Taylor expanded in y around inf 91.7%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (if (<= y_m 1.35e+25) x (+ x (* z t))))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 1.35e+25) {
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 <= 1.35d+25) 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 <= 1.35e+25) {
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 <= 1.35e+25: 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 <= 1.35e+25) 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 <= 1.35e+25) 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, 1.35e+25], x, N[(x + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 1.35 \cdot 10^{+25}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot t\\
\end{array}
\end{array}
if y < 1.35e25Initial program 95.9%
+-commutative95.9%
associate-*l*97.7%
fma-define97.7%
Simplified97.7%
Taylor expanded in y around 0 65.0%
if 1.35e25 < y Initial program 80.9%
Taylor expanded in y around inf 74.8%
Taylor expanded in t around inf 78.5%
*-commutative78.5%
Simplified78.5%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (if (<= y_m 5.8e+27) 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 <= 5.8e+27) {
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 <= 5.8d+27) 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 <= 5.8e+27) {
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 <= 5.8e+27: 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 <= 5.8e+27) 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 <= 5.8e+27) 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, 5.8e+27], 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 5.8 \cdot 10^{+27}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if y < 5.8000000000000002e27Initial program 95.9%
+-commutative95.9%
associate-*l*97.7%
fma-define97.7%
Simplified97.7%
Taylor expanded in y around 0 65.0%
if 5.8000000000000002e27 < y Initial program 80.9%
Taylor expanded in y around inf 74.8%
Taylor expanded in x around inf 68.7%
mul-1-neg68.7%
unsub-neg68.7%
Simplified68.7%
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 93.2%
+-commutative93.2%
associate-*l*96.3%
fma-define96.3%
Simplified96.3%
Taylor expanded in y around 0 63.0%
(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 2024137
(FPCore (x y z t)
:name "SynthBasics:moogVCF from YampaSynth-0.2"
:precision binary64
:alt
(! :herbie-platform default (+ x (* y (* z (- (tanh (/ t y)) (tanh (/ x y)))))))
(+ x (* (* y z) (- (tanh (/ t y)) (tanh (/ x y))))))