
(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 (- (* y z) x))
(t_2 (- (* z t) x))
(t_3 (/ (+ x (/ t_1 t_2)) (+ x 1.0))))
(if (<= t_3 -1e+25)
(/ y (/ (* (+ x 1.0) t_2) z))
(if (or (<= t_3 2e-27) (not (<= t_3 1e+253)))
(-
(+ (/ y (* t (+ x 1.0))) (/ x (+ x 1.0)))
(/ x (* (+ x 1.0) (* z t))))
(/ (+ x (/ 1.0 (/ t_2 t_1))) (+ x 1.0))))))
double code(double x, double y, double z, double t) {
double t_1 = (y * z) - x;
double t_2 = (z * t) - x;
double t_3 = (x + (t_1 / t_2)) / (x + 1.0);
double tmp;
if (t_3 <= -1e+25) {
tmp = y / (((x + 1.0) * t_2) / z);
} else if ((t_3 <= 2e-27) || !(t_3 <= 1e+253)) {
tmp = ((y / (t * (x + 1.0))) + (x / (x + 1.0))) - (x / ((x + 1.0) * (z * t)));
} else {
tmp = (x + (1.0 / (t_2 / t_1))) / (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) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = (y * z) - x
t_2 = (z * t) - x
t_3 = (x + (t_1 / t_2)) / (x + 1.0d0)
if (t_3 <= (-1d+25)) then
tmp = y / (((x + 1.0d0) * t_2) / z)
else if ((t_3 <= 2d-27) .or. (.not. (t_3 <= 1d+253))) then
tmp = ((y / (t * (x + 1.0d0))) + (x / (x + 1.0d0))) - (x / ((x + 1.0d0) * (z * t)))
else
tmp = (x + (1.0d0 / (t_2 / t_1))) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y * z) - x;
double t_2 = (z * t) - x;
double t_3 = (x + (t_1 / t_2)) / (x + 1.0);
double tmp;
if (t_3 <= -1e+25) {
tmp = y / (((x + 1.0) * t_2) / z);
} else if ((t_3 <= 2e-27) || !(t_3 <= 1e+253)) {
tmp = ((y / (t * (x + 1.0))) + (x / (x + 1.0))) - (x / ((x + 1.0) * (z * t)));
} else {
tmp = (x + (1.0 / (t_2 / t_1))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (y * z) - x t_2 = (z * t) - x t_3 = (x + (t_1 / t_2)) / (x + 1.0) tmp = 0 if t_3 <= -1e+25: tmp = y / (((x + 1.0) * t_2) / z) elif (t_3 <= 2e-27) or not (t_3 <= 1e+253): tmp = ((y / (t * (x + 1.0))) + (x / (x + 1.0))) - (x / ((x + 1.0) * (z * t))) else: tmp = (x + (1.0 / (t_2 / t_1))) / (x + 1.0) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y * z) - x) t_2 = Float64(Float64(z * t) - x) t_3 = Float64(Float64(x + Float64(t_1 / t_2)) / Float64(x + 1.0)) tmp = 0.0 if (t_3 <= -1e+25) tmp = Float64(y / Float64(Float64(Float64(x + 1.0) * t_2) / z)); elseif ((t_3 <= 2e-27) || !(t_3 <= 1e+253)) tmp = Float64(Float64(Float64(y / Float64(t * Float64(x + 1.0))) + Float64(x / Float64(x + 1.0))) - Float64(x / Float64(Float64(x + 1.0) * Float64(z * t)))); else tmp = Float64(Float64(x + Float64(1.0 / Float64(t_2 / t_1))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y * z) - x; t_2 = (z * t) - x; t_3 = (x + (t_1 / t_2)) / (x + 1.0); tmp = 0.0; if (t_3 <= -1e+25) tmp = y / (((x + 1.0) * t_2) / z); elseif ((t_3 <= 2e-27) || ~((t_3 <= 1e+253))) tmp = ((y / (t * (x + 1.0))) + (x / (x + 1.0))) - (x / ((x + 1.0) * (z * t))); else tmp = (x + (1.0 / (t_2 / t_1))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x + N[(t$95$1 / t$95$2), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -1e+25], N[(y / N[(N[(N[(x + 1.0), $MachinePrecision] * t$95$2), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t$95$3, 2e-27], N[Not[LessEqual[t$95$3, 1e+253]], $MachinePrecision]], N[(N[(N[(y / N[(t * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[(N[(x + 1.0), $MachinePrecision] * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(1.0 / N[(t$95$2 / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot z - x\\
t_2 := z \cdot t - x\\
t_3 := \frac{x + \frac{t_1}{t_2}}{x + 1}\\
\mathbf{if}\;t_3 \leq -1 \cdot 10^{+25}:\\
\;\;\;\;\frac{y}{\frac{\left(x + 1\right) \cdot t_2}{z}}\\
\mathbf{elif}\;t_3 \leq 2 \cdot 10^{-27} \lor \neg \left(t_3 \leq 10^{+253}\right):\\
\;\;\;\;\left(\frac{y}{t \cdot \left(x + 1\right)} + \frac{x}{x + 1}\right) - \frac{x}{\left(x + 1\right) \cdot \left(z \cdot t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{1}{\frac{t_2}{t_1}}}{x + 1}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < -1.00000000000000009e25Initial program 82.0%
*-commutative82.0%
Simplified82.0%
Taylor expanded in y around inf 82.1%
associate-/l*97.2%
*-commutative97.2%
+-commutative97.2%
Simplified97.2%
if -1.00000000000000009e25 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 2.0000000000000001e-27 or 9.9999999999999994e252 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 65.9%
*-commutative65.9%
Simplified65.9%
Taylor expanded in t around inf 92.1%
if 2.0000000000000001e-27 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 9.9999999999999994e252Initial program 99.9%
*-commutative99.9%
Simplified99.9%
clear-num99.9%
inv-pow99.9%
Applied egg-rr99.9%
unpow-199.9%
*-commutative99.9%
*-commutative99.9%
Simplified99.9%
Final simplification97.6%
(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+17)
(/ y (/ (* (+ x 1.0) t_1) z))
(if (<= t_2 1e+253) t_2 (/ (+ 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+17) {
tmp = y / (((x + 1.0) * t_1) / z);
} else if (t_2 <= 1e+253) {
tmp = t_2;
} else {
tmp = (x + (y / t)) / (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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (z * t) - x
t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0d0)
if (t_2 <= (-5d+17)) then
tmp = y / (((x + 1.0d0) * t_1) / z)
else if (t_2 <= 1d+253) then
tmp = t_2
else
tmp = (x + (y / t)) / (x + 1.0d0)
end if
code = tmp
end function
public static 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+17) {
tmp = y / (((x + 1.0) * t_1) / z);
} else if (t_2 <= 1e+253) {
tmp = t_2;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * t) - x t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0) tmp = 0 if t_2 <= -5e+17: tmp = y / (((x + 1.0) * t_1) / z) elif t_2 <= 1e+253: tmp = t_2 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+17) tmp = Float64(y / Float64(Float64(Float64(x + 1.0) * t_1) / z)); elseif (t_2 <= 1e+253) tmp = t_2; else tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * t) - x; t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0); tmp = 0.0; if (t_2 <= -5e+17) tmp = y / (((x + 1.0) * t_1) / z); elseif (t_2 <= 1e+253) tmp = t_2; else tmp = (x + (y / t)) / (x + 1.0); end tmp_2 = 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+17], N[(y / N[(N[(N[(x + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+253], t$95$2, 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^{+17}:\\
\;\;\;\;\frac{y}{\frac{\left(x + 1\right) \cdot t_1}{z}}\\
\mathbf{elif}\;t_2 \leq 10^{+253}:\\
\;\;\;\;t_2\\
\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)) < -5e17Initial program 82.4%
*-commutative82.4%
Simplified82.4%
Taylor expanded in y around inf 82.5%
associate-/l*97.3%
*-commutative97.3%
+-commutative97.3%
Simplified97.3%
if -5e17 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 9.9999999999999994e252Initial program 97.4%
if 9.9999999999999994e252 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 16.9%
*-commutative16.9%
Simplified16.9%
Taylor expanded in z around inf 75.2%
Final simplification95.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- (* z t) x))) (/ (+ (* y (/ z t_1)) (- x (/ x t_1))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
return ((y * (z / t_1)) + (x - (x / t_1))) / (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
real(8) :: t_1
t_1 = (z * t) - x
code = ((y * (z / t_1)) + (x - (x / t_1))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
return ((y * (z / t_1)) + (x - (x / t_1))) / (x + 1.0);
}
def code(x, y, z, t): t_1 = (z * t) - x return ((y * (z / t_1)) + (x - (x / t_1))) / (x + 1.0)
function code(x, y, z, t) t_1 = Float64(Float64(z * t) - x) return Float64(Float64(Float64(y * Float64(z / t_1)) + Float64(x - Float64(x / t_1))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) t_1 = (z * t) - x; tmp = ((y * (z / t_1)) + (x - (x / t_1))) / (x + 1.0); end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]}, N[(N[(N[(y * N[(z / t$95$1), $MachinePrecision]), $MachinePrecision] + N[(x - N[(x / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot t - x\\
\frac{y \cdot \frac{z}{t_1} + \left(x - \frac{x}{t_1}\right)}{x + 1}
\end{array}
\end{array}
Initial program 88.9%
*-commutative88.9%
Simplified88.9%
+-commutative88.9%
div-sub88.9%
associate-+l-88.9%
*-un-lft-identity88.9%
times-frac94.5%
fma-neg94.5%
Applied egg-rr94.5%
fma-udef94.5%
/-rgt-identity94.5%
Applied egg-rr94.5%
Final simplification94.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6e-175) (not (<= z 4.3e-128))) (/ (+ 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 <= -6e-175) || !(z <= 4.3e-128)) {
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 <= (-6d-175)) .or. (.not. (z <= 4.3d-128))) 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 <= -6e-175) || !(z <= 4.3e-128)) {
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 <= -6e-175) or not (z <= 4.3e-128): 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 <= -6e-175) || !(z <= 4.3e-128)) 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 <= -6e-175) || ~((z <= 4.3e-128))) 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, -6e-175], N[Not[LessEqual[z, 4.3e-128]], $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 \cdot 10^{-175} \lor \neg \left(z \leq 4.3 \cdot 10^{-128}\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 < -6e-175 or 4.29999999999999994e-128 < z Initial program 84.1%
*-commutative84.1%
Simplified84.1%
Taylor expanded in z around inf 81.7%
if -6e-175 < z < 4.29999999999999994e-128Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 79.0%
+-commutative79.0%
Simplified79.0%
Final simplification80.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.5e-175) (not (<= z 3.15e-223))) (/ (+ x (/ y t)) (+ x 1.0)) 1.0))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.5e-175) || !(z <= 3.15e-223)) {
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 <= (-2.5d-175)) .or. (.not. (z <= 3.15d-223))) 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 <= -2.5e-175) || !(z <= 3.15e-223)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.5e-175) or not (z <= 3.15e-223): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.5e-175) || !(z <= 3.15e-223)) 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 <= -2.5e-175) || ~((z <= 3.15e-223))) 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, -2.5e-175], N[Not[LessEqual[z, 3.15e-223]], $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 -2.5 \cdot 10^{-175} \lor \neg \left(z \leq 3.15 \cdot 10^{-223}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if z < -2.5e-175 or 3.14999999999999993e-223 < z Initial program 85.7%
*-commutative85.7%
Simplified85.7%
Taylor expanded in z around inf 80.2%
if -2.5e-175 < z < 3.14999999999999993e-223Initial program 99.8%
*-commutative99.8%
Simplified99.8%
+-commutative99.8%
div-sub99.8%
associate-+l-99.8%
*-un-lft-identity99.8%
times-frac99.8%
fma-neg99.8%
Applied egg-rr99.8%
Taylor expanded in z around 0 69.8%
Final simplification77.9%
(FPCore (x y z t) :precision binary64 (if (<= x -3.25e-72) (/ x (+ x 1.0)) (if (<= x 5e-42) (/ y t) (- 1.0 (* (/ z x) (/ y x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.25e-72) {
tmp = x / (x + 1.0);
} else if (x <= 5e-42) {
tmp = y / t;
} else {
tmp = 1.0 - ((z / x) * (y / 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 (x <= (-3.25d-72)) then
tmp = x / (x + 1.0d0)
else if (x <= 5d-42) then
tmp = y / t
else
tmp = 1.0d0 - ((z / x) * (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.25e-72) {
tmp = x / (x + 1.0);
} else if (x <= 5e-42) {
tmp = y / t;
} else {
tmp = 1.0 - ((z / x) * (y / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.25e-72: tmp = x / (x + 1.0) elif x <= 5e-42: tmp = y / t else: tmp = 1.0 - ((z / x) * (y / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.25e-72) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 5e-42) tmp = Float64(y / t); else tmp = Float64(1.0 - Float64(Float64(z / x) * Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.25e-72) tmp = x / (x + 1.0); elseif (x <= 5e-42) tmp = y / t; else tmp = 1.0 - ((z / x) * (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.25e-72], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5e-42], N[(y / t), $MachinePrecision], N[(1.0 - N[(N[(z / x), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.25 \cdot 10^{-72}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-42}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{z}{x} \cdot \frac{y}{x}\\
\end{array}
\end{array}
if x < -3.2499999999999998e-72Initial program 90.4%
*-commutative90.4%
Simplified90.4%
Taylor expanded in t around inf 82.1%
+-commutative82.1%
Simplified82.1%
if -3.2499999999999998e-72 < x < 5.00000000000000003e-42Initial program 88.5%
*-commutative88.5%
Simplified88.5%
+-commutative88.5%
div-sub88.5%
associate-+l-88.5%
*-un-lft-identity88.5%
times-frac91.9%
fma-neg91.9%
Applied egg-rr91.9%
Taylor expanded in x around 0 56.7%
if 5.00000000000000003e-42 < x Initial program 87.6%
*-commutative87.6%
Simplified87.6%
Taylor expanded in x around -inf 60.9%
mul-1-neg60.9%
unsub-neg60.9%
distribute-rgt-out--60.9%
unpow260.9%
Simplified60.9%
Taylor expanded in y around inf 74.0%
*-commutative74.0%
unpow274.0%
Simplified74.0%
times-frac78.7%
Applied egg-rr78.7%
Final simplification70.1%
(FPCore (x y z t) :precision binary64 (if (<= x -4e-35) 1.0 (if (<= x -2.65e-73) (- x (* x x)) (if (<= x 4.6e-41) (/ y t) 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4e-35) {
tmp = 1.0;
} else if (x <= -2.65e-73) {
tmp = x - (x * x);
} else if (x <= 4.6e-41) {
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 <= (-4d-35)) then
tmp = 1.0d0
else if (x <= (-2.65d-73)) then
tmp = x - (x * x)
else if (x <= 4.6d-41) 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 <= -4e-35) {
tmp = 1.0;
} else if (x <= -2.65e-73) {
tmp = x - (x * x);
} else if (x <= 4.6e-41) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -4e-35: tmp = 1.0 elif x <= -2.65e-73: tmp = x - (x * x) elif x <= 4.6e-41: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -4e-35) tmp = 1.0; elseif (x <= -2.65e-73) tmp = Float64(x - Float64(x * x)); elseif (x <= 4.6e-41) 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 <= -4e-35) tmp = 1.0; elseif (x <= -2.65e-73) tmp = x - (x * x); elseif (x <= 4.6e-41) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -4e-35], 1.0, If[LessEqual[x, -2.65e-73], N[(x - N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.6e-41], N[(y / t), $MachinePrecision], 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-35}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -2.65 \cdot 10^{-73}:\\
\;\;\;\;x - x \cdot x\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{-41}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -4.00000000000000003e-35 or 4.6000000000000002e-41 < x Initial program 88.7%
*-commutative88.7%
Simplified88.7%
+-commutative88.7%
div-sub88.7%
associate-+l-88.7%
*-un-lft-identity88.7%
times-frac96.4%
fma-neg96.4%
Applied egg-rr96.4%
Taylor expanded in z around 0 80.6%
if -4.00000000000000003e-35 < x < -2.64999999999999986e-73Initial program 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in t around inf 84.1%
+-commutative84.1%
Simplified84.1%
Taylor expanded in x around 0 84.1%
+-commutative84.1%
mul-1-neg84.1%
unsub-neg84.1%
unpow284.1%
Simplified84.1%
if -2.64999999999999986e-73 < x < 4.6000000000000002e-41Initial program 88.5%
*-commutative88.5%
Simplified88.5%
+-commutative88.5%
div-sub88.5%
associate-+l-88.5%
*-un-lft-identity88.5%
times-frac91.9%
fma-neg91.9%
Applied egg-rr91.9%
Taylor expanded in x around 0 56.7%
Final simplification70.1%
(FPCore (x y z t) :precision binary64 (if (<= x -2.7e-36) 1.0 (if (<= x 5.8e-36) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.7e-36) {
tmp = 1.0;
} else if (x <= 5.8e-36) {
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 <= (-2.7d-36)) then
tmp = 1.0d0
else if (x <= 5.8d-36) 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 <= -2.7e-36) {
tmp = 1.0;
} else if (x <= 5.8e-36) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.7e-36: tmp = 1.0 elif x <= 5.8e-36: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.7e-36) tmp = 1.0; elseif (x <= 5.8e-36) 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 <= -2.7e-36) tmp = 1.0; elseif (x <= 5.8e-36) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.7e-36], 1.0, If[LessEqual[x, 5.8e-36], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{-36}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{-36}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -2.70000000000000007e-36 or 5.80000000000000026e-36 < x Initial program 88.7%
*-commutative88.7%
Simplified88.7%
+-commutative88.7%
div-sub88.7%
associate-+l-88.7%
*-un-lft-identity88.7%
times-frac96.4%
fma-neg96.4%
Applied egg-rr96.4%
Taylor expanded in z around 0 80.6%
if -2.70000000000000007e-36 < x < 5.80000000000000026e-36Initial program 89.0%
*-commutative89.0%
Simplified89.0%
+-commutative89.0%
div-sub89.0%
associate-+l-89.0%
*-un-lft-identity89.0%
times-frac92.3%
fma-neg92.3%
Applied egg-rr92.3%
Taylor expanded in x around 0 54.0%
Final simplification68.2%
(FPCore (x y z t) :precision binary64 (if (<= x -1.65e-72) (/ x (+ x 1.0)) (if (<= x 5e-36) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.65e-72) {
tmp = x / (x + 1.0);
} else if (x <= 5e-36) {
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 <= (-1.65d-72)) then
tmp = x / (x + 1.0d0)
else if (x <= 5d-36) 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 <= -1.65e-72) {
tmp = x / (x + 1.0);
} else if (x <= 5e-36) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.65e-72: tmp = x / (x + 1.0) elif x <= 5e-36: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.65e-72) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 5e-36) 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 <= -1.65e-72) tmp = x / (x + 1.0); elseif (x <= 5e-36) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.65e-72], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5e-36], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.65 \cdot 10^{-72}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-36}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.65e-72Initial program 90.4%
*-commutative90.4%
Simplified90.4%
Taylor expanded in t around inf 82.1%
+-commutative82.1%
Simplified82.1%
if -1.65e-72 < x < 5.00000000000000004e-36Initial program 88.5%
*-commutative88.5%
Simplified88.5%
+-commutative88.5%
div-sub88.5%
associate-+l-88.5%
*-un-lft-identity88.5%
times-frac91.9%
fma-neg91.9%
Applied egg-rr91.9%
Taylor expanded in x around 0 56.7%
if 5.00000000000000004e-36 < x Initial program 87.6%
*-commutative87.6%
Simplified87.6%
+-commutative87.6%
div-sub87.6%
associate-+l-87.6%
*-un-lft-identity87.6%
times-frac95.4%
fma-neg95.4%
Applied egg-rr95.4%
Taylor expanded in z around 0 77.8%
Final simplification69.9%
(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 88.9%
*-commutative88.9%
Simplified88.9%
+-commutative88.9%
div-sub88.9%
associate-+l-88.9%
*-un-lft-identity88.9%
times-frac94.5%
fma-neg94.5%
Applied egg-rr94.5%
Taylor expanded in z around 0 51.2%
Final simplification51.2%
(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 2023252
(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)))