
(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}
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 2.1e+197) (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 <= 2.1e+197) {
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 <= 2.1e+197) 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, 2.1e+197], 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 2.1 \cdot 10^{+197}:\\
\;\;\;\;\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 < 2.10000000000000006e197Initial program 95.4%
+-commutative95.4%
*-commutative95.4%
associate-*l*98.7%
fma-def98.7%
Simplified98.7%
if 2.10000000000000006e197 < y Initial program 64.6%
+-commutative64.6%
*-commutative64.6%
associate-*l*91.2%
fma-def91.2%
Simplified91.2%
Taylor expanded in y around inf 100.0%
Final simplification98.9%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 9.2e+197) (+ 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 <= 9.2e+197) {
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 <= 9.2d+197) 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 <= 9.2e+197) {
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 <= 9.2e+197: 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 <= 9.2e+197) 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 <= 9.2e+197) 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, 9.2e+197], 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 9.2 \cdot 10^{+197}:\\
\;\;\;\;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 < 9.2000000000000002e197Initial program 95.4%
associate-*l*98.1%
Simplified98.1%
if 9.2000000000000002e197 < y Initial program 64.6%
+-commutative64.6%
*-commutative64.6%
associate-*l*91.2%
fma-def91.2%
Simplified91.2%
Taylor expanded in y around inf 100.0%
Final simplification98.2%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (or (<= t -3.15e-66) (not (<= t 1.55e-34))) (+ x (* y (* z (tanh (/ t y))))) (+ x (* z (- t (* y (tanh (/ x y))))))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.15e-66) || !(t <= 1.55e-34)) {
tmp = x + (y * (z * tanh((t / y))));
} else {
tmp = x + (z * (t - (y * tanh((x / y)))));
}
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 ((t <= (-3.15d-66)) .or. (.not. (t <= 1.55d-34))) then
tmp = x + (y * (z * tanh((t / y))))
else
tmp = x + (z * (t - (y * tanh((x / y)))))
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 ((t <= -3.15e-66) || !(t <= 1.55e-34)) {
tmp = x + (y * (z * Math.tanh((t / y))));
} else {
tmp = x + (z * (t - (y * Math.tanh((x / y)))));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if (t <= -3.15e-66) or not (t <= 1.55e-34): tmp = x + (y * (z * math.tanh((t / y)))) else: tmp = x + (z * (t - (y * math.tanh((x / y))))) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if ((t <= -3.15e-66) || !(t <= 1.55e-34)) tmp = Float64(x + Float64(y * Float64(z * tanh(Float64(t / y))))); else tmp = Float64(x + Float64(z * Float64(t - Float64(y * tanh(Float64(x / y)))))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -3.15e-66) || ~((t <= 1.55e-34))) tmp = x + (y * (z * tanh((t / y)))); else tmp = x + (z * (t - (y * tanh((x / y))))); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3.15e-66], N[Not[LessEqual[t, 1.55e-34]], $MachinePrecision]], N[(x + N[(y * N[(z * N[Tanh[N[(t / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(t - N[(y * N[Tanh[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.15 \cdot 10^{-66} \lor \neg \left(t \leq 1.55 \cdot 10^{-34}\right):\\
\;\;\;\;x + y \cdot \left(z \cdot \tanh \left(\frac{t}{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - y \cdot \tanh \left(\frac{x}{y}\right)\right)\\
\end{array}
\end{array}
if t < -3.15e-66 or 1.5499999999999999e-34 < t Initial program 92.7%
associate-*l*99.5%
Simplified99.5%
Taylor expanded in x around 0 10.0%
*-commutative10.0%
associate-/r*10.0%
div-sub10.0%
rec-exp10.0%
rec-exp10.0%
tanh-def-a86.6%
Simplified86.6%
if -3.15e-66 < t < 1.5499999999999999e-34Initial program 92.0%
+-commutative92.0%
*-commutative92.0%
associate-*l*95.5%
fma-def95.5%
Simplified95.5%
Taylor expanded in t around 0 92.7%
fma-udef92.7%
Applied egg-rr92.7%
Taylor expanded in t around -inf 32.2%
+-commutative32.2%
mul-1-neg32.2%
unsub-neg32.2%
associate-/r*32.2%
Simplified96.3%
Final simplification90.9%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 1.04e+108) (+ x (* y (* z (tanh (/ t y))))) (+ x (* z (- t x)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.04e+108) {
tmp = x + (y * (z * tanh((t / 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 <= 1.04d+108) then
tmp = x + (y * (z * tanh((t / 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 <= 1.04e+108) {
tmp = x + (y * (z * Math.tanh((t / y))));
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 1.04e+108: tmp = x + (y * (z * math.tanh((t / y)))) else: tmp = x + (z * (t - x)) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 1.04e+108) tmp = Float64(x + Float64(y * Float64(z * tanh(Float64(t / 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 <= 1.04e+108) tmp = x + (y * (z * tanh((t / 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, 1.04e+108], N[(x + N[(y * N[(z * N[Tanh[N[(t / y), $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 1.04 \cdot 10^{+108}:\\
\;\;\;\;x + y \cdot \left(z \cdot \tanh \left(\frac{t}{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 1.04e108Initial program 95.1%
associate-*l*98.0%
Simplified98.0%
Taylor expanded in x around 0 29.7%
*-commutative29.7%
associate-/r*29.7%
div-sub29.7%
rec-exp29.7%
rec-exp29.7%
tanh-def-a80.7%
Simplified80.7%
if 1.04e108 < y Initial program 76.7%
+-commutative76.7%
*-commutative76.7%
associate-*l*94.2%
fma-def94.2%
Simplified94.2%
Taylor expanded in y around inf 95.1%
Final simplification82.8%
NOTE: y should be positive before calling this function
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* z t))))
(if (<= y 1.85e+19)
x
(if (<= y 7.4e+77)
t_1
(if (<= y 1.35e+82)
x
(if (or (<= y 2.2e+118) (not (<= y 2.65e+278)))
(* x (- 1.0 z))
t_1))))))y = abs(y);
double code(double x, double y, double z, double t) {
double t_1 = x + (z * t);
double tmp;
if (y <= 1.85e+19) {
tmp = x;
} else if (y <= 7.4e+77) {
tmp = t_1;
} else if (y <= 1.35e+82) {
tmp = x;
} else if ((y <= 2.2e+118) || !(y <= 2.65e+278)) {
tmp = x * (1.0 - z);
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = x + (z * t)
if (y <= 1.85d+19) then
tmp = x
else if (y <= 7.4d+77) then
tmp = t_1
else if (y <= 1.35d+82) then
tmp = x
else if ((y <= 2.2d+118) .or. (.not. (y <= 2.65d+278))) then
tmp = x * (1.0d0 - z)
else
tmp = t_1
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
double t_1 = x + (z * t);
double tmp;
if (y <= 1.85e+19) {
tmp = x;
} else if (y <= 7.4e+77) {
tmp = t_1;
} else if (y <= 1.35e+82) {
tmp = x;
} else if ((y <= 2.2e+118) || !(y <= 2.65e+278)) {
tmp = x * (1.0 - z);
} else {
tmp = t_1;
}
return tmp;
}
y = abs(y) def code(x, y, z, t): t_1 = x + (z * t) tmp = 0 if y <= 1.85e+19: tmp = x elif y <= 7.4e+77: tmp = t_1 elif y <= 1.35e+82: tmp = x elif (y <= 2.2e+118) or not (y <= 2.65e+278): tmp = x * (1.0 - z) else: tmp = t_1 return tmp
y = abs(y) function code(x, y, z, t) t_1 = Float64(x + Float64(z * t)) tmp = 0.0 if (y <= 1.85e+19) tmp = x; elseif (y <= 7.4e+77) tmp = t_1; elseif (y <= 1.35e+82) tmp = x; elseif ((y <= 2.2e+118) || !(y <= 2.65e+278)) tmp = Float64(x * Float64(1.0 - z)); else tmp = t_1; end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) t_1 = x + (z * t); tmp = 0.0; if (y <= 1.85e+19) tmp = x; elseif (y <= 7.4e+77) tmp = t_1; elseif (y <= 1.35e+82) tmp = x; elseif ((y <= 2.2e+118) || ~((y <= 2.65e+278))) tmp = x * (1.0 - z); else tmp = t_1; end tmp_2 = tmp; end
NOTE: y should be positive before calling this function
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.85e+19], x, If[LessEqual[y, 7.4e+77], t$95$1, If[LessEqual[y, 1.35e+82], x, If[Or[LessEqual[y, 2.2e+118], N[Not[LessEqual[y, 2.65e+278]], $MachinePrecision]], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
t_1 := x + z \cdot t\\
\mathbf{if}\;y \leq 1.85 \cdot 10^{+19}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 7.4 \cdot 10^{+77}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+82}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{+118} \lor \neg \left(y \leq 2.65 \cdot 10^{+278}\right):\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < 1.85e19 or 7.3999999999999999e77 < y < 1.35e82Initial program 95.0%
associate-*l*98.0%
Simplified98.0%
Taylor expanded in x around inf 66.4%
if 1.85e19 < y < 7.3999999999999999e77 or 2.19999999999999986e118 < y < 2.64999999999999996e278Initial program 85.7%
associate-*l*93.3%
Simplified93.3%
Taylor expanded in x around 0 35.7%
*-commutative35.7%
associate-/r*35.7%
div-sub35.7%
rec-exp35.7%
rec-exp35.7%
tanh-def-a77.3%
Simplified77.3%
Taylor expanded in y around inf 79.4%
if 1.35e82 < y < 2.19999999999999986e118 or 2.64999999999999996e278 < y Initial program 80.0%
+-commutative80.0%
*-commutative80.0%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in y around inf 90.5%
Taylor expanded in t around 0 79.2%
associate-*r*79.2%
distribute-lft1-in79.2%
*-commutative79.2%
+-commutative79.2%
mul-1-neg79.2%
unsub-neg79.2%
Simplified79.2%
Final simplification69.5%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 2.3e+82) x (if (or (<= y 1.02e+221) (not (<= y 1.4e+264))) (* x (- 1.0 z)) (* z t))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.3e+82) {
tmp = x;
} else if ((y <= 1.02e+221) || !(y <= 1.4e+264)) {
tmp = x * (1.0 - z);
} 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 <= 2.3d+82) then
tmp = x
else if ((y <= 1.02d+221) .or. (.not. (y <= 1.4d+264))) then
tmp = x * (1.0d0 - z)
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 <= 2.3e+82) {
tmp = x;
} else if ((y <= 1.02e+221) || !(y <= 1.4e+264)) {
tmp = x * (1.0 - z);
} else {
tmp = z * t;
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 2.3e+82: tmp = x elif (y <= 1.02e+221) or not (y <= 1.4e+264): tmp = x * (1.0 - z) else: tmp = z * t return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 2.3e+82) tmp = x; elseif ((y <= 1.02e+221) || !(y <= 1.4e+264)) tmp = Float64(x * Float64(1.0 - z)); 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 <= 2.3e+82) tmp = x; elseif ((y <= 1.02e+221) || ~((y <= 1.4e+264))) tmp = x * (1.0 - z); 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, 2.3e+82], x, If[Or[LessEqual[y, 1.02e+221], N[Not[LessEqual[y, 1.4e+264]], $MachinePrecision]], N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(z * t), $MachinePrecision]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.3 \cdot 10^{+82}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.02 \cdot 10^{+221} \lor \neg \left(y \leq 1.4 \cdot 10^{+264}\right):\\
\;\;\;\;x \cdot \left(1 - z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if y < 2.29999999999999988e82Initial program 95.3%
associate-*l*97.9%
Simplified97.9%
Taylor expanded in x around inf 66.8%
if 2.29999999999999988e82 < y < 1.01999999999999991e221 or 1.39999999999999999e264 < y Initial program 82.4%
+-commutative82.4%
*-commutative82.4%
associate-*l*97.4%
fma-def97.4%
Simplified97.4%
Taylor expanded in y around inf 90.3%
Taylor expanded in t around 0 69.3%
associate-*r*69.3%
distribute-lft1-in69.3%
*-commutative69.3%
+-commutative69.3%
mul-1-neg69.3%
unsub-neg69.3%
Simplified69.3%
if 1.01999999999999991e221 < y < 1.39999999999999999e264Initial program 68.9%
+-commutative68.9%
*-commutative68.9%
associate-*l*87.8%
fma-def87.8%
Simplified87.8%
Taylor expanded in t around 0 87.8%
fma-udef87.8%
Applied egg-rr87.8%
Taylor expanded in t around inf 70.3%
Final simplification67.3%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 1850000.0) x (+ x (* z (- t x)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1850000.0) {
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 <= 1850000.0d0) 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 <= 1850000.0) {
tmp = x;
} else {
tmp = x + (z * (t - x));
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 1850000.0: tmp = x else: tmp = x + (z * (t - x)) return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 1850000.0) 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 <= 1850000.0) 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, 1850000.0], x, N[(x + N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1850000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(t - x\right)\\
\end{array}
\end{array}
if y < 1.85e6Initial program 95.0%
associate-*l*98.0%
Simplified98.0%
Taylor expanded in x around inf 66.4%
if 1.85e6 < y Initial program 84.6%
+-commutative84.6%
*-commutative84.6%
associate-*l*96.5%
fma-def96.5%
Simplified96.5%
Taylor expanded in y around inf 85.5%
Final simplification71.1%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 8e+193) x (if (<= y 2.9e+277) (* z t) (* x (- z)))))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 8e+193) {
tmp = x;
} else if (y <= 2.9e+277) {
tmp = z * t;
} else {
tmp = x * -z;
}
return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 8d+193) then
tmp = x
else if (y <= 2.9d+277) then
tmp = z * t
else
tmp = x * -z
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 8e+193) {
tmp = x;
} else if (y <= 2.9e+277) {
tmp = z * t;
} else {
tmp = x * -z;
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 8e+193: tmp = x elif y <= 2.9e+277: tmp = z * t else: tmp = x * -z return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 8e+193) tmp = x; elseif (y <= 2.9e+277) tmp = Float64(z * t); else tmp = Float64(x * Float64(-z)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 8e+193) tmp = x; elseif (y <= 2.9e+277) tmp = z * t; else tmp = x * -z; end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[y, 8e+193], x, If[LessEqual[y, 2.9e+277], N[(z * t), $MachinePrecision], N[(x * (-z)), $MachinePrecision]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 8 \cdot 10^{+193}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{+277}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-z\right)\\
\end{array}
\end{array}
if y < 8.00000000000000053e193Initial program 95.4%
associate-*l*98.0%
Simplified98.0%
Taylor expanded in x around inf 65.3%
if 8.00000000000000053e193 < y < 2.89999999999999983e277Initial program 68.5%
+-commutative68.5%
*-commutative68.5%
associate-*l*88.5%
fma-def88.5%
Simplified88.5%
Taylor expanded in t around 0 88.5%
fma-udef88.5%
Applied egg-rr88.5%
Taylor expanded in t around inf 59.0%
if 2.89999999999999983e277 < y Initial program 59.1%
+-commutative59.1%
*-commutative59.1%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in t around 0 86.0%
associate-*r*86.0%
distribute-lft1-in86.0%
*-commutative86.0%
+-commutative86.0%
mul-1-neg86.0%
unsub-neg86.0%
Simplified86.0%
Taylor expanded in z around inf 58.3%
mul-1-neg58.3%
distribute-rgt-neg-in58.3%
Simplified58.3%
Final simplification64.6%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= y 1.08e+194) x (* z t)))
y = abs(y);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.08e+194) {
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 <= 1.08d+194) 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 <= 1.08e+194) {
tmp = x;
} else {
tmp = z * t;
}
return tmp;
}
y = abs(y) def code(x, y, z, t): tmp = 0 if y <= 1.08e+194: tmp = x else: tmp = z * t return tmp
y = abs(y) function code(x, y, z, t) tmp = 0.0 if (y <= 1.08e+194) 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 <= 1.08e+194) 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, 1.08e+194], x, N[(z * t), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.08 \cdot 10^{+194}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if y < 1.08e194Initial program 95.4%
associate-*l*98.0%
Simplified98.0%
Taylor expanded in x around inf 65.3%
if 1.08e194 < y Initial program 65.9%
+-commutative65.9%
*-commutative65.9%
associate-*l*91.6%
fma-def91.6%
Simplified91.6%
Taylor expanded in t around 0 91.6%
fma-udef91.6%
Applied egg-rr91.6%
Taylor expanded in t around inf 47.3%
Final simplification63.5%
NOTE: y should be positive before calling this function (FPCore (x y z t) :precision binary64 x)
y = abs(y);
double code(double x, double y, double z, double t) {
return x;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
y = Math.abs(y);
public static double code(double x, double y, double z, double t) {
return x;
}
y = abs(y) def code(x, y, z, t): return x
y = abs(y) function code(x, y, z, t) return x end
y = abs(y) function tmp = code(x, y, z, t) tmp = x; end
NOTE: y should be positive before calling this function code[x_, y_, z_, t_] := x
\begin{array}{l}
y = |y|\\
\\
x
\end{array}
Initial program 92.4%
associate-*l*97.4%
Simplified97.4%
Taylor expanded in x around inf 61.6%
Final simplification61.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 2023238
(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))))))