
(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 (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0)))) (if (<= t_1 1000000.0) t_1 (/ (+ x (/ y (- t (/ x z)))) (+ 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 <= 1000000.0) {
tmp = t_1;
} else {
tmp = (x + (y / (t - (x / z)))) / (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) :: tmp
t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0d0)
if (t_1 <= 1000000.0d0) then
tmp = t_1
else
tmp = (x + (y / (t - (x / z)))) / (x + 1.0d0)
end if
code = tmp
end function
public static 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 <= 1000000.0) {
tmp = t_1;
} else {
tmp = (x + (y / (t - (x / z)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0) tmp = 0 if t_1 <= 1000000.0: tmp = t_1 else: tmp = (x + (y / (t - (x / z)))) / (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 <= 1000000.0) tmp = t_1; else tmp = Float64(Float64(x + Float64(y / Float64(t - Float64(x / z)))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0); tmp = 0.0; if (t_1 <= 1000000.0) tmp = t_1; else tmp = (x + (y / (t - (x / z)))) / (x + 1.0); end tmp_2 = 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, 1000000.0], t$95$1, N[(N[(x + N[(y / N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $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 1000000:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y}{t - \frac{x}{z}}}{x + 1}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 1e6Initial program 98.0%
if 1e6 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 61.3%
*-commutative61.3%
Simplified61.3%
Taylor expanded in z around inf 61.3%
mul-1-neg61.3%
unsub-neg61.3%
Simplified61.3%
Taylor expanded in y around inf 99.9%
Final simplification98.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.8e-17) (not (<= y 1.06e-165))) (/ (+ x (/ y (- t (/ x z)))) (+ x 1.0)) (/ (+ x (/ x (- x (* z t)))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.8e-17) || !(y <= 1.06e-165)) {
tmp = (x + (y / (t - (x / z)))) / (x + 1.0);
} else {
tmp = (x + (x / (x - (z * 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) :: tmp
if ((y <= (-3.8d-17)) .or. (.not. (y <= 1.06d-165))) then
tmp = (x + (y / (t - (x / z)))) / (x + 1.0d0)
else
tmp = (x + (x / (x - (z * t)))) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.8e-17) || !(y <= 1.06e-165)) {
tmp = (x + (y / (t - (x / z)))) / (x + 1.0);
} else {
tmp = (x + (x / (x - (z * t)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.8e-17) or not (y <= 1.06e-165): tmp = (x + (y / (t - (x / z)))) / (x + 1.0) else: tmp = (x + (x / (x - (z * t)))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.8e-17) || !(y <= 1.06e-165)) tmp = Float64(Float64(x + Float64(y / Float64(t - Float64(x / z)))) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(x / Float64(x - Float64(z * t)))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3.8e-17) || ~((y <= 1.06e-165))) tmp = (x + (y / (t - (x / z)))) / (x + 1.0); else tmp = (x + (x / (x - (z * t)))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.8e-17], N[Not[LessEqual[y, 1.06e-165]], $MachinePrecision]], N[(N[(x + N[(y / N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(x / N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{-17} \lor \neg \left(y \leq 1.06 \cdot 10^{-165}\right):\\
\;\;\;\;\frac{x + \frac{y}{t - \frac{x}{z}}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{x}{x - z \cdot t}}{x + 1}\\
\end{array}
\end{array}
if y < -3.8000000000000001e-17 or 1.05999999999999999e-165 < y Initial program 87.4%
*-commutative87.4%
Simplified87.4%
Taylor expanded in z around inf 87.3%
mul-1-neg87.3%
unsub-neg87.3%
Simplified87.3%
Taylor expanded in y around inf 92.2%
if -3.8000000000000001e-17 < y < 1.05999999999999999e-165Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 93.2%
Final simplification92.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.35e-196) (not (<= z 1.6e-214))) (/ (+ x (/ y (- t (/ x z)))) (+ x 1.0)) (/ (+ 1.0 (- x (* y (/ z x)))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.35e-196) || !(z <= 1.6e-214)) {
tmp = (x + (y / (t - (x / z)))) / (x + 1.0);
} else {
tmp = (1.0 + (x - (y * (z / 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 <= (-1.35d-196)) .or. (.not. (z <= 1.6d-214))) then
tmp = (x + (y / (t - (x / z)))) / (x + 1.0d0)
else
tmp = (1.0d0 + (x - (y * (z / 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 <= -1.35e-196) || !(z <= 1.6e-214)) {
tmp = (x + (y / (t - (x / z)))) / (x + 1.0);
} else {
tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.35e-196) or not (z <= 1.6e-214): tmp = (x + (y / (t - (x / z)))) / (x + 1.0) else: tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.35e-196) || !(z <= 1.6e-214)) tmp = Float64(Float64(x + Float64(y / Float64(t - Float64(x / z)))) / Float64(x + 1.0)); else tmp = Float64(Float64(1.0 + Float64(x - Float64(y * Float64(z / x)))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.35e-196) || ~((z <= 1.6e-214))) tmp = (x + (y / (t - (x / z)))) / (x + 1.0); else tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.35e-196], N[Not[LessEqual[z, 1.6e-214]], $MachinePrecision]], N[(N[(x + N[(y / N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{-196} \lor \neg \left(z \leq 1.6 \cdot 10^{-214}\right):\\
\;\;\;\;\frac{x + \frac{y}{t - \frac{x}{z}}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - y \cdot \frac{z}{x}\right)}{x + 1}\\
\end{array}
\end{array}
if z < -1.34999999999999991e-196 or 1.60000000000000007e-214 < z Initial program 89.8%
*-commutative89.8%
Simplified89.8%
Taylor expanded in z around inf 89.8%
mul-1-neg89.8%
unsub-neg89.8%
Simplified89.8%
Taylor expanded in y around inf 92.5%
if -1.34999999999999991e-196 < z < 1.60000000000000007e-214Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around 0 83.6%
mul-1-neg83.6%
unsub-neg83.6%
associate-/l*83.7%
+-commutative83.7%
Simplified83.7%
Final simplification91.0%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.05e-72) (not (<= t 9.2e-71))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (+ 1.0 (- x (* y (/ z x)))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.05e-72) || !(t <= 9.2e-71)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (1.0 + (x - (y * (z / 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 ((t <= (-2.05d-72)) .or. (.not. (t <= 9.2d-71))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = (1.0d0 + (x - (y * (z / 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 ((t <= -2.05e-72) || !(t <= 9.2e-71)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.05e-72) or not (t <= 9.2e-71): tmp = (x + (y / t)) / (x + 1.0) else: tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.05e-72) || !(t <= 9.2e-71)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(1.0 + Float64(x - Float64(y * Float64(z / x)))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.05e-72) || ~((t <= 9.2e-71))) tmp = (x + (y / t)) / (x + 1.0); else tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.05e-72], N[Not[LessEqual[t, 9.2e-71]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.05 \cdot 10^{-72} \lor \neg \left(t \leq 9.2 \cdot 10^{-71}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - y \cdot \frac{z}{x}\right)}{x + 1}\\
\end{array}
\end{array}
if t < -2.05000000000000002e-72 or 9.1999999999999994e-71 < t Initial program 88.6%
*-commutative88.6%
Simplified88.6%
Taylor expanded in z around inf 83.0%
+-commutative83.0%
+-commutative83.0%
Simplified83.0%
if -2.05000000000000002e-72 < t < 9.1999999999999994e-71Initial program 96.7%
*-commutative96.7%
Simplified96.7%
Taylor expanded in t around 0 79.6%
mul-1-neg79.6%
unsub-neg79.6%
associate-/l*80.7%
+-commutative80.7%
Simplified80.7%
Final simplification82.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.9e-76) (not (<= t 1.56e-71))) (/ (+ x (/ y t)) (+ x 1.0)) (+ 1.0 (* (/ y x) (/ z (- -1.0 x))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.9e-76) || !(t <= 1.56e-71)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + ((y / x) * (z / (-1.0 - 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 ((t <= (-3.9d-76)) .or. (.not. (t <= 1.56d-71))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 + ((y / x) * (z / ((-1.0d0) - x)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.9e-76) || !(t <= 1.56e-71)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + ((y / x) * (z / (-1.0 - x)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3.9e-76) or not (t <= 1.56e-71): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 + ((y / x) * (z / (-1.0 - x))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3.9e-76) || !(t <= 1.56e-71)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 + Float64(Float64(y / x) * Float64(z / Float64(-1.0 - x)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -3.9e-76) || ~((t <= 1.56e-71))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 + ((y / x) * (z / (-1.0 - x))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3.9e-76], N[Not[LessEqual[t, 1.56e-71]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(y / x), $MachinePrecision] * N[(z / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.9 \cdot 10^{-76} \lor \neg \left(t \leq 1.56 \cdot 10^{-71}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{y}{x} \cdot \frac{z}{-1 - x}\\
\end{array}
\end{array}
if t < -3.90000000000000025e-76 or 1.56e-71 < t Initial program 88.6%
*-commutative88.6%
Simplified88.6%
Taylor expanded in z around inf 83.0%
+-commutative83.0%
+-commutative83.0%
Simplified83.0%
if -3.90000000000000025e-76 < t < 1.56e-71Initial program 96.7%
*-commutative96.7%
Simplified96.7%
clear-num96.5%
associate-/r/96.6%
Applied egg-rr96.6%
Taylor expanded in t around 0 79.6%
associate-+r+79.6%
mul-1-neg79.6%
sub-neg79.6%
div-sub79.6%
+-commutative79.6%
+-commutative79.6%
*-inverses79.6%
associate-/r*79.6%
times-frac76.5%
+-commutative76.5%
Simplified76.5%
Final simplification80.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5e-104) (not (<= z 8e-132))) (/ (+ x (/ y t)) (+ x 1.0)) 1.0))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5e-104) || !(z <= 8e-132)) {
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 <= (-5d-104)) .or. (.not. (z <= 8d-132))) 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 <= -5e-104) || !(z <= 8e-132)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5e-104) or not (z <= 8e-132): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5e-104) || !(z <= 8e-132)) 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 <= -5e-104) || ~((z <= 8e-132))) 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, -5e-104], N[Not[LessEqual[z, 8e-132]], $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 -5 \cdot 10^{-104} \lor \neg \left(z \leq 8 \cdot 10^{-132}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if z < -4.99999999999999979e-104 or 7.9999999999999999e-132 < z Initial program 87.3%
*-commutative87.3%
Simplified87.3%
Taylor expanded in z around inf 82.6%
+-commutative82.6%
+-commutative82.6%
Simplified82.6%
if -4.99999999999999979e-104 < z < 7.9999999999999999e-132Initial program 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in x around inf 63.7%
Final simplification76.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1e-102) (not (<= x 9e-129))) (/ x (+ x 1.0)) (/ y t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1e-102) || !(x <= 9e-129)) {
tmp = x / (x + 1.0);
} else {
tmp = y / t;
}
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 <= (-1d-102)) .or. (.not. (x <= 9d-129))) then
tmp = x / (x + 1.0d0)
else
tmp = y / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1e-102) || !(x <= 9e-129)) {
tmp = x / (x + 1.0);
} else {
tmp = y / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1e-102) or not (x <= 9e-129): tmp = x / (x + 1.0) else: tmp = y / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1e-102) || !(x <= 9e-129)) tmp = Float64(x / Float64(x + 1.0)); else tmp = Float64(y / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1e-102) || ~((x <= 9e-129))) tmp = x / (x + 1.0); else tmp = y / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1e-102], N[Not[LessEqual[x, 9e-129]], $MachinePrecision]], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-102} \lor \neg \left(x \leq 9 \cdot 10^{-129}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t}\\
\end{array}
\end{array}
if x < -9.99999999999999933e-103 or 9.00000000000000061e-129 < x Initial program 91.2%
*-commutative91.2%
Simplified91.2%
Taylor expanded in t around inf 74.8%
+-commutative74.8%
Simplified74.8%
if -9.99999999999999933e-103 < x < 9.00000000000000061e-129Initial program 91.9%
*-commutative91.9%
Simplified91.9%
Taylor expanded in x around 0 52.5%
Final simplification67.1%
(FPCore (x y z t) :precision binary64 (if (<= x -4.4e-36) 1.0 (if (<= x 1.08e-5) (+ x (/ y t)) (/ x (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4.4e-36) {
tmp = 1.0;
} else if (x <= 1.08e-5) {
tmp = x + (y / t);
} else {
tmp = 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 (x <= (-4.4d-36)) then
tmp = 1.0d0
else if (x <= 1.08d-5) then
tmp = x + (y / t)
else
tmp = 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 (x <= -4.4e-36) {
tmp = 1.0;
} else if (x <= 1.08e-5) {
tmp = x + (y / t);
} else {
tmp = x / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -4.4e-36: tmp = 1.0 elif x <= 1.08e-5: tmp = x + (y / t) else: tmp = x / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -4.4e-36) tmp = 1.0; elseif (x <= 1.08e-5) tmp = Float64(x + Float64(y / t)); else tmp = Float64(x / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -4.4e-36) tmp = 1.0; elseif (x <= 1.08e-5) tmp = x + (y / t); else tmp = x / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -4.4e-36], 1.0, If[LessEqual[x, 1.08e-5], N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.4 \cdot 10^{-36}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.08 \cdot 10^{-5}:\\
\;\;\;\;x + \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1}\\
\end{array}
\end{array}
if x < -4.3999999999999999e-36Initial program 90.6%
*-commutative90.6%
Simplified90.6%
Taylor expanded in x around inf 86.7%
if -4.3999999999999999e-36 < x < 1.07999999999999999e-5Initial program 91.6%
*-commutative91.6%
Simplified91.6%
Taylor expanded in z around inf 63.7%
+-commutative63.7%
+-commutative63.7%
Simplified63.7%
Taylor expanded in x around 0 63.4%
if 1.07999999999999999e-5 < x Initial program 92.0%
*-commutative92.0%
Simplified92.0%
Taylor expanded in t around inf 86.5%
+-commutative86.5%
Simplified86.5%
Final simplification74.7%
(FPCore (x y z t) :precision binary64 (if (<= x -2.4e-69) 1.0 (if (<= x 5e-126) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.4e-69) {
tmp = 1.0;
} else if (x <= 5e-126) {
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.4d-69)) then
tmp = 1.0d0
else if (x <= 5d-126) 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.4e-69) {
tmp = 1.0;
} else if (x <= 5e-126) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.4e-69: tmp = 1.0 elif x <= 5e-126: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.4e-69) tmp = 1.0; elseif (x <= 5e-126) 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.4e-69) tmp = 1.0; elseif (x <= 5e-126) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.4e-69], 1.0, If[LessEqual[x, 5e-126], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{-69}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-126}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -2.4000000000000001e-69 or 5.00000000000000006e-126 < x Initial program 90.6%
*-commutative90.6%
Simplified90.6%
Taylor expanded in x around inf 72.6%
if -2.4000000000000001e-69 < x < 5.00000000000000006e-126Initial program 92.7%
*-commutative92.7%
Simplified92.7%
Taylor expanded in x around 0 49.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 91.4%
*-commutative91.4%
Simplified91.4%
Taylor expanded in x around inf 49.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 2024186
(FPCore (x y z t)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:alt
(! :herbie-platform default (/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1)))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))