
(FPCore (x y z t) :precision binary64 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
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) - x) / ((t * z) - x))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
def code(x, y, z, t): return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(t * z) - x))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
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) - x) / ((t * z) - x))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
def code(x, y, z, t): return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(t * z) - x))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\end{array}
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* z t) x)) (t_2 (/ (+ x (/ (- (* y z) x) t_1)) (+ x 1.0))))
(if (<= t_2 -5e+41)
(* (/ y (+ x 1.0)) (/ z (fma t z (- x))))
(if (<= t_2 5e+200)
(pow (/ (+ x 1.0) (+ x (/ (fma y z (- x)) t_1))) -1.0)
(/ (+ x (/ y t)) (+ x 1.0))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
double tmp;
if (t_2 <= -5e+41) {
tmp = (y / (x + 1.0)) * (z / fma(t, z, -x));
} else if (t_2 <= 5e+200) {
tmp = pow(((x + 1.0) / (x + (fma(y, z, -x) / t_1))), -1.0);
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(z * t) - x) t_2 = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / t_1)) / Float64(x + 1.0)) tmp = 0.0 if (t_2 <= -5e+41) tmp = Float64(Float64(y / Float64(x + 1.0)) * Float64(z / fma(t, z, Float64(-x)))); elseif (t_2 <= 5e+200) tmp = Float64(Float64(x + 1.0) / Float64(x + Float64(fma(y, z, Float64(-x)) / t_1))) ^ -1.0; else tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+41], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(z / N[(t * z + (-x)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+200], N[Power[N[(N[(x + 1.0), $MachinePrecision] / N[(x + N[(N[(y * z + (-x)), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot t - x\\
t_2 := \frac{x + \frac{y \cdot z - x}{t_1}}{x + 1}\\
\mathbf{if}\;t_2 \leq -5 \cdot 10^{+41}:\\
\;\;\;\;\frac{y}{x + 1} \cdot \frac{z}{\mathsf{fma}\left(t, z, -x\right)}\\
\mathbf{elif}\;t_2 \leq 5 \cdot 10^{+200}:\\
\;\;\;\;{\left(\frac{x + 1}{x + \frac{\mathsf{fma}\left(y, z, -x\right)}{t_1}}\right)}^{-1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < -5.00000000000000022e41Initial program 65.7%
*-commutative65.7%
Simplified65.7%
Taylor expanded in y around inf 65.3%
times-frac93.5%
+-commutative93.5%
fma-neg93.5%
Simplified93.5%
if -5.00000000000000022e41 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 5.00000000000000019e200Initial program 99.2%
*-commutative99.2%
Simplified99.2%
clear-num99.2%
inv-pow99.2%
fma-neg99.2%
Applied egg-rr99.2%
if 5.00000000000000019e200 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 18.8%
*-commutative18.8%
Simplified18.8%
Taylor expanded in z around inf 87.2%
Final simplification97.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0))))
(if (<= t_1 -2e+80)
(* (/ y (+ x 1.0)) (/ z (fma t z (- x))))
(if (<= t_1 5e+200) t_1 (/ (+ x (/ y t)) (+ x 1.0))))))
double code(double x, double y, double z, double t) {
double t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_1 <= -2e+80) {
tmp = (y / (x + 1.0)) * (z / fma(t, z, -x));
} else if (t_1 <= 5e+200) {
tmp = t_1;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(z * t) - x))) / Float64(x + 1.0)) tmp = 0.0 if (t_1 <= -2e+80) tmp = Float64(Float64(y / Float64(x + 1.0)) * Float64(z / fma(t, z, Float64(-x)))); elseif (t_1 <= 5e+200) tmp = t_1; else tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+80], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(z / N[(t * z + (-x)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+200], t$95$1, N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{+80}:\\
\;\;\;\;\frac{y}{x + 1} \cdot \frac{z}{\mathsf{fma}\left(t, z, -x\right)}\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+200}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < -2e80Initial program 62.1%
*-commutative62.1%
Simplified62.1%
Taylor expanded in y around inf 61.7%
times-frac92.9%
+-commutative92.9%
fma-neg92.9%
Simplified92.9%
if -2e80 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 5.00000000000000019e200Initial program 99.2%
if 5.00000000000000019e200 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 18.8%
*-commutative18.8%
Simplified18.8%
Taylor expanded in z around inf 87.2%
Final simplification97.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.5e+232) (not (<= z 1.25e+112))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.5e+232) || !(z <= 1.25e+112)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
}
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 ((z <= (-3.5d+232)) .or. (.not. (z <= 1.25d+112))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.5e+232) || !(z <= 1.25e+112)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.5e+232) or not (z <= 1.25e+112): tmp = (x + (y / t)) / (x + 1.0) else: tmp = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.5e+232) || !(z <= 1.25e+112)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(z * t) - x))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.5e+232) || ~((z <= 1.25e+112))) tmp = (x + (y / t)) / (x + 1.0); else tmp = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.5e+232], N[Not[LessEqual[z, 1.25e+112]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+232} \lor \neg \left(z \leq 1.25 \cdot 10^{+112}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\
\end{array}
\end{array}
if z < -3.50000000000000013e232 or 1.25e112 < z Initial program 59.6%
*-commutative59.6%
Simplified59.6%
Taylor expanded in z around inf 94.4%
if -3.50000000000000013e232 < z < 1.25e112Initial program 96.8%
Final simplification96.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.5e+49) (not (<= z 3.55e-9))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (- x (/ x (- (* z t) x))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.5e+49) || !(z <= 3.55e-9)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x - (x / ((z * t) - x))) / (x + 1.0);
}
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 ((z <= (-6.5d+49)) .or. (.not. (z <= 3.55d-9))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = (x - (x / ((z * t) - x))) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.5e+49) || !(z <= 3.55e-9)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x - (x / ((z * t) - x))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.5e+49) or not (z <= 3.55e-9): tmp = (x + (y / t)) / (x + 1.0) else: tmp = (x - (x / ((z * t) - x))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6.5e+49) || !(z <= 3.55e-9)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(x - Float64(x / Float64(Float64(z * t) - x))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -6.5e+49) || ~((z <= 3.55e-9))) tmp = (x + (y / t)) / (x + 1.0); else tmp = (x - (x / ((z * t) - x))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6.5e+49], N[Not[LessEqual[z, 3.55e-9]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(x / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{+49} \lor \neg \left(z \leq 3.55 \cdot 10^{-9}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - \frac{x}{z \cdot t - x}}{x + 1}\\
\end{array}
\end{array}
if z < -6.5000000000000005e49 or 3.54999999999999994e-9 < z Initial program 73.9%
*-commutative73.9%
Simplified73.9%
Taylor expanded in z around inf 85.5%
if -6.5000000000000005e49 < z < 3.54999999999999994e-9Initial program 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in y around 0 80.6%
Final simplification82.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.8e-146) (not (<= z 4.8e-74))) (/ (+ x (/ y t)) (+ x 1.0)) (+ 1.0 (* y (+ z (/ z (- x)))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.8e-146) || !(z <= 4.8e-74)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + (y * (z + (z / -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 ((z <= (-4.8d-146)) .or. (.not. (z <= 4.8d-74))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 + (y * (z + (z / -x)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.8e-146) || !(z <= 4.8e-74)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + (y * (z + (z / -x)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.8e-146) or not (z <= 4.8e-74): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 + (y * (z + (z / -x))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.8e-146) || !(z <= 4.8e-74)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 + Float64(y * Float64(z + Float64(z / Float64(-x))))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.8e-146) || ~((z <= 4.8e-74))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 + (y * (z + (z / -x))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.8e-146], N[Not[LessEqual[z, 4.8e-74]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * N[(z + N[(z / (-x)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{-146} \lor \neg \left(z \leq 4.8 \cdot 10^{-74}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot \left(z + \frac{z}{-x}\right)\\
\end{array}
\end{array}
if z < -4.8000000000000003e-146 or 4.7999999999999998e-74 < z Initial program 82.0%
*-commutative82.0%
Simplified82.0%
Taylor expanded in z around inf 82.7%
if -4.8000000000000003e-146 < z < 4.7999999999999998e-74Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around 0 79.6%
associate-+r+79.6%
mul-1-neg79.6%
unsub-neg79.6%
+-commutative79.6%
associate-/l*79.6%
+-commutative79.6%
Simplified79.6%
Taylor expanded in x around 0 71.7%
associate--l+71.7%
cancel-sign-sub-inv71.7%
metadata-eval71.7%
*-lft-identity71.7%
fma-def71.7%
associate-*r/71.7%
fma-def71.7%
neg-mul-171.7%
distribute-rgt-neg-in71.7%
distribute-lft-out71.7%
neg-mul-171.7%
metadata-eval71.7%
times-frac71.7%
*-lft-identity71.7%
neg-mul-171.7%
Simplified71.7%
Final simplification79.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.2e-143) (not (<= z 3.5e-75))) (/ (+ x (/ y t)) (+ x 1.0)) 1.0))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.2e-143) || !(z <= 3.5e-75)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
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 ((z <= (-3.2d-143)) .or. (.not. (z <= 3.5d-75))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.2e-143) || !(z <= 3.5e-75)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.2e-143) or not (z <= 3.5e-75): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.2e-143) || !(z <= 3.5e-75)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.2e-143) || ~((z <= 3.5e-75))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.2e-143], N[Not[LessEqual[z, 3.5e-75]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{-143} \lor \neg \left(z \leq 3.5 \cdot 10^{-75}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if z < -3.1999999999999998e-143 or 3.49999999999999985e-75 < z Initial program 82.0%
*-commutative82.0%
Simplified82.0%
Taylor expanded in z around inf 82.7%
if -3.1999999999999998e-143 < z < 3.49999999999999985e-75Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around inf 46.9%
Taylor expanded in x around inf 68.4%
Final simplification77.9%
(FPCore (x y z t) :precision binary64 (if (<= x -5.5e-82) 1.0 (if (<= x -2.4e-148) (/ x (+ x 1.0)) (if (<= x 5.4e-88) (/ y t) 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5.5e-82) {
tmp = 1.0;
} else if (x <= -2.4e-148) {
tmp = x / (x + 1.0);
} else if (x <= 5.4e-88) {
tmp = y / t;
} else {
tmp = 1.0;
}
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 (x <= (-5.5d-82)) then
tmp = 1.0d0
else if (x <= (-2.4d-148)) then
tmp = x / (x + 1.0d0)
else if (x <= 5.4d-88) then
tmp = y / t
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5.5e-82) {
tmp = 1.0;
} else if (x <= -2.4e-148) {
tmp = x / (x + 1.0);
} else if (x <= 5.4e-88) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -5.5e-82: tmp = 1.0 elif x <= -2.4e-148: tmp = x / (x + 1.0) elif x <= 5.4e-88: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -5.5e-82) tmp = 1.0; elseif (x <= -2.4e-148) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 5.4e-88) tmp = Float64(y / t); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -5.5e-82) tmp = 1.0; elseif (x <= -2.4e-148) tmp = x / (x + 1.0); elseif (x <= 5.4e-88) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -5.5e-82], 1.0, If[LessEqual[x, -2.4e-148], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.4e-88], N[(y / t), $MachinePrecision], 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.5 \cdot 10^{-82}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -2.4 \cdot 10^{-148}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 5.4 \cdot 10^{-88}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -5.4999999999999998e-82 or 5.39999999999999989e-88 < x Initial program 87.5%
*-commutative87.5%
Simplified87.5%
Taylor expanded in z around inf 69.2%
Taylor expanded in x around inf 77.9%
if -5.4999999999999998e-82 < x < -2.4000000000000001e-148Initial program 87.9%
*-commutative87.9%
Simplified87.9%
Taylor expanded in t around inf 47.5%
+-commutative47.5%
Simplified47.5%
if -2.4000000000000001e-148 < x < 5.39999999999999989e-88Initial program 88.8%
*-commutative88.8%
Simplified88.8%
Taylor expanded in z around inf 75.3%
Taylor expanded in x around 0 55.9%
Final simplification68.9%
(FPCore (x y z t) :precision binary64 (if (<= x -6.5e-82) 1.0 (if (<= x -1.26e-148) (- x (/ x (* z t))) (if (<= x 7e-88) (/ y t) 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6.5e-82) {
tmp = 1.0;
} else if (x <= -1.26e-148) {
tmp = x - (x / (z * t));
} else if (x <= 7e-88) {
tmp = y / t;
} else {
tmp = 1.0;
}
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 (x <= (-6.5d-82)) then
tmp = 1.0d0
else if (x <= (-1.26d-148)) then
tmp = x - (x / (z * t))
else if (x <= 7d-88) then
tmp = y / t
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6.5e-82) {
tmp = 1.0;
} else if (x <= -1.26e-148) {
tmp = x - (x / (z * t));
} else if (x <= 7e-88) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -6.5e-82: tmp = 1.0 elif x <= -1.26e-148: tmp = x - (x / (z * t)) elif x <= 7e-88: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -6.5e-82) tmp = 1.0; elseif (x <= -1.26e-148) tmp = Float64(x - Float64(x / Float64(z * t))); elseif (x <= 7e-88) tmp = Float64(y / t); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -6.5e-82) tmp = 1.0; elseif (x <= -1.26e-148) tmp = x - (x / (z * t)); elseif (x <= 7e-88) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -6.5e-82], 1.0, If[LessEqual[x, -1.26e-148], N[(x - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7e-88], N[(y / t), $MachinePrecision], 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{-82}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -1.26 \cdot 10^{-148}:\\
\;\;\;\;x - \frac{x}{z \cdot t}\\
\mathbf{elif}\;x \leq 7 \cdot 10^{-88}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -6.4999999999999997e-82 or 7.0000000000000002e-88 < x Initial program 87.5%
*-commutative87.5%
Simplified87.5%
Taylor expanded in z around inf 69.2%
Taylor expanded in x around inf 77.9%
if -6.4999999999999997e-82 < x < -1.25999999999999998e-148Initial program 87.9%
*-commutative87.9%
Simplified87.9%
Taylor expanded in t around -inf 71.4%
mul-1-neg71.4%
distribute-lft-out--71.4%
Simplified71.4%
Taylor expanded in y around 0 55.0%
+-commutative55.0%
Simplified55.0%
Taylor expanded in x around 0 55.0%
sub-neg55.0%
distribute-rgt-in55.0%
distribute-lft-neg-in55.0%
associate-*l/55.0%
*-lft-identity55.0%
associate-/r*53.9%
unsub-neg53.9%
*-lft-identity53.9%
associate-/r*55.0%
Simplified55.0%
if -1.25999999999999998e-148 < x < 7.0000000000000002e-88Initial program 88.8%
*-commutative88.8%
Simplified88.8%
Taylor expanded in z around inf 75.3%
Taylor expanded in x around 0 55.9%
Final simplification69.4%
(FPCore (x y z t) :precision binary64 (if (<= x -7.8e-82) 1.0 (if (<= x 1.75e-87) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.8e-82) {
tmp = 1.0;
} else if (x <= 1.75e-87) {
tmp = y / t;
} else {
tmp = 1.0;
}
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 (x <= (-7.8d-82)) then
tmp = 1.0d0
else if (x <= 1.75d-87) then
tmp = y / t
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.8e-82) {
tmp = 1.0;
} else if (x <= 1.75e-87) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -7.8e-82: tmp = 1.0 elif x <= 1.75e-87: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -7.8e-82) tmp = 1.0; elseif (x <= 1.75e-87) tmp = Float64(y / t); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -7.8e-82) tmp = 1.0; elseif (x <= 1.75e-87) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -7.8e-82], 1.0, If[LessEqual[x, 1.75e-87], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.8 \cdot 10^{-82}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{-87}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -7.79999999999999947e-82 or 1.75000000000000006e-87 < x Initial program 87.5%
*-commutative87.5%
Simplified87.5%
Taylor expanded in z around inf 69.2%
Taylor expanded in x around inf 77.9%
if -7.79999999999999947e-82 < x < 1.75000000000000006e-87Initial program 88.6%
*-commutative88.6%
Simplified88.6%
Taylor expanded in z around inf 73.4%
Taylor expanded in x around 0 49.3%
Final simplification67.0%
(FPCore (x y z t) :precision binary64 1.0)
double code(double x, double y, double z, double t) {
return 1.0;
}
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 = 1.0d0
end function
public static double code(double x, double y, double z, double t) {
return 1.0;
}
def code(x, y, z, t): return 1.0
function code(x, y, z, t) return 1.0 end
function tmp = code(x, y, z, t) tmp = 1.0; end
code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 87.9%
*-commutative87.9%
Simplified87.9%
Taylor expanded in z around inf 70.8%
Taylor expanded in x around inf 53.0%
Final simplification53.0%
(FPCore (x y z t) :precision binary64 (/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0);
}
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 / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0);
}
def code(x, y, z, t): return (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(y / Float64(t - Float64(x / z))) - Float64(x / Float64(Float64(t * z) - x)))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(y / N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \left(\frac{y}{t - \frac{x}{z}} - \frac{x}{t \cdot z - x}\right)}{x + 1}
\end{array}
herbie shell --seed 2024019
(FPCore (x y z t)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:herbie-target
(/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))