
(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 10 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}
(FPCore (x y z t) :precision binary64 (fma (* y (- (tanh (/ t y)) (tanh (/ x y)))) z x))
double code(double x, double y, double z, double t) {
return fma((y * (tanh((t / y)) - tanh((x / y)))), z, x);
}
function code(x, y, z, t) return fma(Float64(y * Float64(tanh(Float64(t / y)) - tanh(Float64(x / y)))), z, x) end
code[x_, y_, z_, t_] := N[(N[(y * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right), z, x\right)
\end{array}
Initial program 96.2%
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
fma-defineN/A
fma-lowering-fma.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
tanh-lowering-tanh.f64N/A
/-lowering-/.f64N/A
tanh-lowering-tanh.f64N/A
/-lowering-/.f6499.1%
Applied egg-rr99.1%
Final simplification99.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (tanh (/ t y))))
(if (<= y 4.5e+94)
(+ x (* (- t_1 (tanh (/ x y))) (* y z)))
(fma (* y (- t_1 (/ x y))) z x))))
double code(double x, double y, double z, double t) {
double t_1 = tanh((t / y));
double tmp;
if (y <= 4.5e+94) {
tmp = x + ((t_1 - tanh((x / y))) * (y * z));
} else {
tmp = fma((y * (t_1 - (x / y))), z, x);
}
return tmp;
}
function code(x, y, z, t) t_1 = tanh(Float64(t / y)) tmp = 0.0 if (y <= 4.5e+94) tmp = Float64(x + Float64(Float64(t_1 - tanh(Float64(x / y))) * Float64(y * z))); else tmp = fma(Float64(y * Float64(t_1 - Float64(x / y))), z, x); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 4.5e+94], N[(x + N[(N[(t$95$1 - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(t$95$1 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \tanh \left(\frac{t}{y}\right)\\
\mathbf{if}\;y \leq 4.5 \cdot 10^{+94}:\\
\;\;\;\;x + \left(t\_1 - \tanh \left(\frac{x}{y}\right)\right) \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \left(t\_1 - \frac{x}{y}\right), z, x\right)\\
\end{array}
\end{array}
if y < 4.49999999999999972e94Initial program 97.7%
if 4.49999999999999972e94 < y Initial program 88.8%
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
fma-defineN/A
fma-lowering-fma.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
tanh-lowering-tanh.f64N/A
/-lowering-/.f64N/A
tanh-lowering-tanh.f64N/A
/-lowering-/.f6497.2%
Applied egg-rr97.2%
Taylor expanded in x around 0
/-lowering-/.f6492.7%
Simplified92.7%
Final simplification96.9%
(FPCore (x y z t) :precision binary64 (if (<= y 9.5e-139) x (fma (* y (- (tanh (/ t y)) (/ x y))) z x)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 9.5e-139) {
tmp = x;
} else {
tmp = fma((y * (tanh((t / y)) - (x / y))), z, x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= 9.5e-139) tmp = x; else tmp = fma(Float64(y * Float64(tanh(Float64(t / y)) - Float64(x / y))), z, x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, 9.5e-139], x, N[(N[(y * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9.5 \cdot 10^{-139}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right), z, x\right)\\
\end{array}
\end{array}
if y < 9.5000000000000006e-139Initial program 97.1%
Taylor expanded in x around inf
Simplified62.6%
if 9.5000000000000006e-139 < y Initial program 94.5%
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
fma-defineN/A
fma-lowering-fma.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
tanh-lowering-tanh.f64N/A
/-lowering-/.f64N/A
tanh-lowering-tanh.f64N/A
/-lowering-/.f6498.6%
Applied egg-rr98.6%
Taylor expanded in x around 0
/-lowering-/.f6487.3%
Simplified87.3%
Final simplification71.0%
(FPCore (x y z t) :precision binary64 (+ x (* y (* (- (tanh (/ t y)) (tanh (/ x y))) z))))
double code(double x, double y, double z, double t) {
return x + (y * ((tanh((t / y)) - tanh((x / y))) * z));
}
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 * ((tanh((t / y)) - tanh((x / y))) * z))
end function
public static double code(double x, double y, double z, double t) {
return x + (y * ((Math.tanh((t / y)) - Math.tanh((x / y))) * z));
}
def code(x, y, z, t): return x + (y * ((math.tanh((t / y)) - math.tanh((x / y))) * z))
function code(x, y, z, t) return Float64(x + Float64(y * Float64(Float64(tanh(Float64(t / y)) - tanh(Float64(x / y))) * z))) end
function tmp = code(x, y, z, t) tmp = x + (y * ((tanh((t / y)) - tanh((x / y))) * z)); end
code[x_, y_, z_, t_] := N[(x + N[(y * N[(N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \left(\left(\tanh \left(\frac{t}{y}\right) - \tanh \left(\frac{x}{y}\right)\right) \cdot z\right)
\end{array}
Initial program 96.2%
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
tanh-lowering-tanh.f64N/A
/-lowering-/.f64N/A
tanh-lowering-tanh.f64N/A
/-lowering-/.f6498.9%
Applied egg-rr98.9%
Final simplification98.9%
(FPCore (x y z t)
:precision binary64
(if (<= y 1.15e-145)
x
(if (<= y 4.8e+128)
(+ x (- (* (tanh (/ t y)) (* y z)) (* x z)))
(+ x (* z (- t x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.15e-145) {
tmp = x;
} else if (y <= 4.8e+128) {
tmp = x + ((tanh((t / y)) * (y * z)) - (x * z));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
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.15d-145) then
tmp = x
else if (y <= 4.8d+128) then
tmp = x + ((tanh((t / y)) * (y * z)) - (x * z))
else
tmp = x + (z * (t - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.15e-145) {
tmp = x;
} else if (y <= 4.8e+128) {
tmp = x + ((Math.tanh((t / y)) * (y * z)) - (x * z));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 1.15e-145: tmp = x elif y <= 4.8e+128: tmp = x + ((math.tanh((t / y)) * (y * z)) - (x * z)) else: tmp = x + (z * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 1.15e-145) tmp = x; elseif (y <= 4.8e+128) tmp = Float64(x + Float64(Float64(tanh(Float64(t / y)) * Float64(y * z)) - Float64(x * z))); else tmp = Float64(x + Float64(z * Float64(t - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 1.15e-145) tmp = x; elseif (y <= 4.8e+128) tmp = x + ((tanh((t / y)) * (y * z)) - (x * z)); else tmp = x + (z * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 1.15e-145], x, If[LessEqual[y, 4.8e+128], N[(x + N[(N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.15 \cdot 10^{-145}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{+128}:\\
\;\;\;\;x + \left(\tanh \left(\frac{t}{y}\right) \cdot \left(y \cdot z\right) - x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 1.15000000000000004e-145Initial program 97.1%
Taylor expanded in x around inf
Simplified62.6%
if 1.15000000000000004e-145 < y < 4.8000000000000004e128Initial program 99.8%
sub-negN/A
distribute-lft-inN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
tanh-lowering-tanh.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
neg-sub0N/A
--lowering--.f64N/A
tanh-lowering-tanh.f64N/A
/-lowering-/.f6497.9%
Applied egg-rr97.9%
Taylor expanded in y around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f6486.0%
Simplified86.0%
if 4.8000000000000004e128 < y Initial program 87.1%
Taylor expanded in y around inf
+-lowering-+.f64N/A
*-lowering-*.f64N/A
--lowering--.f6494.4%
Simplified94.4%
Final simplification71.8%
(FPCore (x y z t)
:precision binary64
(if (<= y 7.2e-140)
x
(if (<= y 4.8e+180)
(+ x (* (* y z) (- (tanh (/ t y)) (/ x y))))
(+ x (* z (- t x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 7.2e-140) {
tmp = x;
} else if (y <= 4.8e+180) {
tmp = x + ((y * z) * (tanh((t / y)) - (x / y)));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
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-140) then
tmp = x
else if (y <= 4.8d+180) then
tmp = x + ((y * z) * (tanh((t / y)) - (x / y)))
else
tmp = x + (z * (t - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 7.2e-140) {
tmp = x;
} else if (y <= 4.8e+180) {
tmp = x + ((y * z) * (Math.tanh((t / y)) - (x / y)));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 7.2e-140: tmp = x elif y <= 4.8e+180: tmp = x + ((y * z) * (math.tanh((t / y)) - (x / y))) else: tmp = x + (z * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 7.2e-140) tmp = x; elseif (y <= 4.8e+180) tmp = Float64(x + Float64(Float64(y * z) * Float64(tanh(Float64(t / y)) - Float64(x / y)))); else tmp = Float64(x + Float64(z * Float64(t - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 7.2e-140) tmp = x; elseif (y <= 4.8e+180) tmp = x + ((y * z) * (tanh((t / y)) - (x / y))); else tmp = x + (z * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 7.2e-140], x, If[LessEqual[y, 4.8e+180], N[(x + N[(N[(y * z), $MachinePrecision] * N[(N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision] - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.2 \cdot 10^{-140}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{+180}:\\
\;\;\;\;x + \left(y \cdot z\right) \cdot \left(\tanh \left(\frac{t}{y}\right) - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 7.2000000000000001e-140Initial program 97.1%
Taylor expanded in x around inf
Simplified62.6%
if 7.2000000000000001e-140 < y < 4.7999999999999997e180Initial program 96.9%
Taylor expanded in x around 0
/-lowering-/.f6483.4%
Simplified83.4%
if 4.7999999999999997e180 < y Initial program 87.0%
Taylor expanded in y around inf
+-lowering-+.f64N/A
*-lowering-*.f64N/A
--lowering--.f6495.5%
Simplified95.5%
(FPCore (x y z t) :precision binary64 (if (<= y 3.8e-72) x (+ x (* z (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3.8e-72) {
tmp = x;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
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.8d-72) then
tmp = x
else
tmp = x + (z * (t - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3.8e-72) {
tmp = x;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 3.8e-72: tmp = x else: tmp = x + (z * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 3.8e-72) tmp = x; else tmp = Float64(x + Float64(z * Float64(t - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 3.8e-72) tmp = x; else tmp = x + (z * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 3.8e-72], x, N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.8 \cdot 10^{-72}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 3.80000000000000002e-72Initial program 97.3%
Taylor expanded in x around inf
Simplified62.3%
if 3.80000000000000002e-72 < y Initial program 93.6%
Taylor expanded in y around inf
+-lowering-+.f64N/A
*-lowering-*.f64N/A
--lowering--.f6476.7%
Simplified76.7%
(FPCore (x y z t) :precision binary64 (if (<= y 2.05e-72) x (+ x (* t z))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.05e-72) {
tmp = x;
} else {
tmp = x + (t * z);
}
return tmp;
}
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.05d-72) then
tmp = x
else
tmp = x + (t * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.05e-72) {
tmp = x;
} else {
tmp = x + (t * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 2.05e-72: tmp = x else: tmp = x + (t * z) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 2.05e-72) tmp = x; else tmp = Float64(x + Float64(t * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 2.05e-72) tmp = x; else tmp = x + (t * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 2.05e-72], x, N[(x + N[(t * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.05 \cdot 10^{-72}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot z\\
\end{array}
\end{array}
if y < 2.05000000000000002e-72Initial program 97.3%
Taylor expanded in x around inf
Simplified62.3%
if 2.05000000000000002e-72 < y Initial program 93.6%
Taylor expanded in y around inf
/-lowering-/.f64N/A
--lowering--.f6467.8%
Simplified67.8%
Taylor expanded in t around inf
*-commutativeN/A
*-lowering-*.f6466.5%
Simplified66.5%
Final simplification63.5%
(FPCore (x y z t) :precision binary64 (if (<= y 2.4e-45) x (* x (- 1.0 z))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.4e-45) {
tmp = x;
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
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.4d-45) then
tmp = x
else
tmp = x * (1.0d0 - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.4e-45) {
tmp = x;
} else {
tmp = x * (1.0 - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 2.4e-45: tmp = x else: tmp = x * (1.0 - z) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 2.4e-45) tmp = x; else tmp = Float64(x * Float64(1.0 - z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 2.4e-45) tmp = x; else tmp = x * (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 2.4e-45], x, N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.4 \cdot 10^{-45}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if y < 2.3999999999999999e-45Initial program 97.4%
Taylor expanded in x around inf
Simplified62.0%
if 2.3999999999999999e-45 < y Initial program 93.3%
Taylor expanded in y around inf
/-lowering-/.f64N/A
--lowering--.f6468.7%
Simplified68.7%
Taylor expanded in x around inf
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f6454.8%
Simplified54.8%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
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
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 96.2%
Taylor expanded in x around inf
Simplified57.1%
(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 2024161
(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))))))