
(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 -4e+159)
(* y (/ (/ z t_1) (+ x 1.0)))
(if (<= t_2 1e+285) 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 <= -4e+159) {
tmp = y * ((z / t_1) / (x + 1.0));
} else if (t_2 <= 1e+285) {
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 <= (-4d+159)) then
tmp = y * ((z / t_1) / (x + 1.0d0))
else if (t_2 <= 1d+285) 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 <= -4e+159) {
tmp = y * ((z / t_1) / (x + 1.0));
} else if (t_2 <= 1e+285) {
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 <= -4e+159: tmp = y * ((z / t_1) / (x + 1.0)) elif t_2 <= 1e+285: 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 <= -4e+159) tmp = Float64(y * Float64(Float64(z / t_1) / Float64(x + 1.0))); elseif (t_2 <= 1e+285) 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 <= -4e+159) tmp = y * ((z / t_1) / (x + 1.0)); elseif (t_2 <= 1e+285) 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, -4e+159], N[(y * N[(N[(z / t$95$1), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+285], 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 -4 \cdot 10^{+159}:\\
\;\;\;\;y \cdot \frac{\frac{z}{t\_1}}{x + 1}\\
\mathbf{elif}\;t\_2 \leq 10^{+285}:\\
\;\;\;\;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 #s(literal 1 binary64))) < -3.9999999999999997e159Initial program 66.6%
*-commutative66.6%
Simplified66.6%
Taylor expanded in y around inf 66.6%
Taylor expanded in y around 0 66.0%
times-frac99.7%
+-commutative99.7%
*-commutative99.7%
associate-*l/95.0%
associate-*r/99.7%
*-commutative99.7%
+-commutative99.7%
Simplified99.7%
if -3.9999999999999997e159 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 9.9999999999999998e284Initial program 98.9%
if 9.9999999999999998e284 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 23.6%
*-commutative23.6%
Simplified23.6%
Taylor expanded in z around inf 85.1%
+-commutative85.1%
+-commutative85.1%
Simplified85.1%
Final simplification97.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -6.5e-145) (not (<= t 3.1e-76))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (- (+ x 1.0) (* y (/ z x))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -6.5e-145) || !(t <= 3.1e-76)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = ((x + 1.0) - (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 <= (-6.5d-145)) .or. (.not. (t <= 3.1d-76))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = ((x + 1.0d0) - (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 <= -6.5e-145) || !(t <= 3.1e-76)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = ((x + 1.0) - (y * (z / x))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -6.5e-145) or not (t <= 3.1e-76): tmp = (x + (y / t)) / (x + 1.0) else: tmp = ((x + 1.0) - (y * (z / x))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -6.5e-145) || !(t <= 3.1e-76)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(Float64(x + 1.0) - 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 <= -6.5e-145) || ~((t <= 3.1e-76))) tmp = (x + (y / t)) / (x + 1.0); else tmp = ((x + 1.0) - (y * (z / x))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -6.5e-145], N[Not[LessEqual[t, 3.1e-76]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x + 1.0), $MachinePrecision] - N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.5 \cdot 10^{-145} \lor \neg \left(t \leq 3.1 \cdot 10^{-76}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x + 1\right) - y \cdot \frac{z}{x}}{x + 1}\\
\end{array}
\end{array}
if t < -6.5000000000000002e-145 or 3.0999999999999997e-76 < t Initial program 83.9%
*-commutative83.9%
Simplified83.9%
Taylor expanded in z around inf 82.6%
+-commutative82.6%
+-commutative82.6%
Simplified82.6%
if -6.5000000000000002e-145 < t < 3.0999999999999997e-76Initial program 91.6%
*-commutative91.6%
Simplified91.6%
Taylor expanded in t around 0 80.8%
associate-+r+80.8%
+-commutative80.8%
mul-1-neg80.8%
associate-/l*84.9%
+-commutative84.9%
Simplified84.9%
Final simplification83.4%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.9e-145) (not (<= t 3.75e-76))) (/ (+ 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 <= -3.9e-145) || !(t <= 3.75e-76)) {
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 <= (-3.9d-145)) .or. (.not. (t <= 3.75d-76))) 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 <= -3.9e-145) || !(t <= 3.75e-76)) {
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 <= -3.9e-145) or not (t <= 3.75e-76): 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 <= -3.9e-145) || !(t <= 3.75e-76)) 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 <= -3.9e-145) || ~((t <= 3.75e-76))) 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, -3.9e-145], N[Not[LessEqual[t, 3.75e-76]], $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 -3.9 \cdot 10^{-145} \lor \neg \left(t \leq 3.75 \cdot 10^{-76}\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 < -3.90000000000000029e-145 or 3.7499999999999998e-76 < t Initial program 83.9%
*-commutative83.9%
Simplified83.9%
Taylor expanded in z around inf 82.6%
+-commutative82.6%
+-commutative82.6%
Simplified82.6%
if -3.90000000000000029e-145 < t < 3.7499999999999998e-76Initial program 91.6%
*-commutative91.6%
Simplified91.6%
Taylor expanded in t around 0 80.8%
mul-1-neg80.8%
unsub-neg80.8%
associate-/l*84.9%
+-commutative84.9%
Simplified84.9%
Final simplification83.4%
(FPCore (x y z t) :precision binary64 (if (or (<= t -5.5e-145) (not (<= t 2.5e-76))) (/ (+ x (/ y t)) (+ x 1.0)) (+ 1.0 (/ (* y z) (* x (- -1.0 x))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.5e-145) || !(t <= 2.5e-76)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + ((y * z) / (x * (-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 <= (-5.5d-145)) .or. (.not. (t <= 2.5d-76))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 + ((y * z) / (x * ((-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 <= -5.5e-145) || !(t <= 2.5e-76)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + ((y * z) / (x * (-1.0 - x)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -5.5e-145) or not (t <= 2.5e-76): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 + ((y * z) / (x * (-1.0 - x))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -5.5e-145) || !(t <= 2.5e-76)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 + Float64(Float64(y * z) / Float64(x * Float64(-1.0 - x)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -5.5e-145) || ~((t <= 2.5e-76))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 + ((y * z) / (x * (-1.0 - x))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -5.5e-145], N[Not[LessEqual[t, 2.5e-76]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(y * z), $MachinePrecision] / N[(x * N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.5 \cdot 10^{-145} \lor \neg \left(t \leq 2.5 \cdot 10^{-76}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{y \cdot z}{x \cdot \left(-1 - x\right)}\\
\end{array}
\end{array}
if t < -5.50000000000000015e-145 or 2.4999999999999999e-76 < t Initial program 83.9%
*-commutative83.9%
Simplified83.9%
Taylor expanded in z around inf 82.6%
+-commutative82.6%
+-commutative82.6%
Simplified82.6%
if -5.50000000000000015e-145 < t < 2.4999999999999999e-76Initial program 91.6%
*-commutative91.6%
Simplified91.6%
Taylor expanded in t around 0 80.8%
mul-1-neg80.8%
unsub-neg80.8%
associate-/l*84.9%
+-commutative84.9%
Simplified84.9%
Taylor expanded in y around 0 80.7%
Final simplification81.9%
(FPCore (x y z t) :precision binary64 (if (<= x -3.8e-113) 1.0 (if (<= x 2.25e-166) (/ y t) (if (<= x 1.7e-8) (* x (- 1.0 x)) 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.8e-113) {
tmp = 1.0;
} else if (x <= 2.25e-166) {
tmp = y / t;
} else if (x <= 1.7e-8) {
tmp = x * (1.0 - x);
} 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 <= (-3.8d-113)) then
tmp = 1.0d0
else if (x <= 2.25d-166) then
tmp = y / t
else if (x <= 1.7d-8) then
tmp = x * (1.0d0 - x)
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 <= -3.8e-113) {
tmp = 1.0;
} else if (x <= 2.25e-166) {
tmp = y / t;
} else if (x <= 1.7e-8) {
tmp = x * (1.0 - x);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.8e-113: tmp = 1.0 elif x <= 2.25e-166: tmp = y / t elif x <= 1.7e-8: tmp = x * (1.0 - x) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.8e-113) tmp = 1.0; elseif (x <= 2.25e-166) tmp = Float64(y / t); elseif (x <= 1.7e-8) tmp = Float64(x * Float64(1.0 - x)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.8e-113) tmp = 1.0; elseif (x <= 2.25e-166) tmp = y / t; elseif (x <= 1.7e-8) tmp = x * (1.0 - x); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.8e-113], 1.0, If[LessEqual[x, 2.25e-166], N[(y / t), $MachinePrecision], If[LessEqual[x, 1.7e-8], N[(x * N[(1.0 - x), $MachinePrecision]), $MachinePrecision], 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{-113}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2.25 \cdot 10^{-166}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{-8}:\\
\;\;\;\;x \cdot \left(1 - x\right)\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -3.79999999999999983e-113 or 1.7e-8 < x Initial program 84.7%
*-commutative84.7%
Simplified84.7%
Taylor expanded in x around inf 74.0%
if -3.79999999999999983e-113 < x < 2.2499999999999999e-166Initial program 88.5%
*-commutative88.5%
Simplified88.5%
Taylor expanded in x around 0 58.4%
if 2.2499999999999999e-166 < x < 1.7e-8Initial program 90.1%
*-commutative90.1%
Simplified90.1%
Taylor expanded in z around inf 63.7%
+-commutative63.7%
+-commutative63.7%
Simplified63.7%
clear-num63.5%
inv-pow63.5%
+-commutative63.5%
Applied egg-rr63.5%
unpow-163.5%
+-commutative63.5%
Simplified63.5%
Taylor expanded in y around 0 38.3%
+-commutative38.3%
Simplified38.3%
Taylor expanded in x around 0 38.5%
neg-mul-138.5%
sub-neg38.5%
Simplified38.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.6e-156) (not (<= z 2.6e-181))) (/ (+ x (/ y t)) (+ x 1.0)) 1.0))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.6e-156) || !(z <= 2.6e-181)) {
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.6d-156)) .or. (.not. (z <= 2.6d-181))) 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.6e-156) || !(z <= 2.6e-181)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.6e-156) or not (z <= 2.6e-181): 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.6e-156) || !(z <= 2.6e-181)) 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.6e-156) || ~((z <= 2.6e-181))) 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.6e-156], N[Not[LessEqual[z, 2.6e-181]], $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.6 \cdot 10^{-156} \lor \neg \left(z \leq 2.6 \cdot 10^{-181}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if z < -3.59999999999999999e-156 or 2.59999999999999999e-181 < z Initial program 82.8%
*-commutative82.8%
Simplified82.8%
Taylor expanded in z around inf 77.2%
+-commutative77.2%
+-commutative77.2%
Simplified77.2%
if -3.59999999999999999e-156 < z < 2.59999999999999999e-181Initial program 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in x around inf 71.4%
Final simplification75.9%
(FPCore (x y z t) :precision binary64 (if (<= x -1.75e+14) (/ (+ 1.0 (- x (* y (/ z x)))) x) (if (<= x 1.1e+62) (/ (+ x (/ y t)) (+ x 1.0)) (/ x (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.75e+14) {
tmp = (1.0 + (x - (y * (z / x)))) / x;
} else if (x <= 1.1e+62) {
tmp = (x + (y / t)) / (x + 1.0);
} 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 <= (-1.75d+14)) then
tmp = (1.0d0 + (x - (y * (z / x)))) / x
else if (x <= 1.1d+62) then
tmp = (x + (y / t)) / (x + 1.0d0)
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 <= -1.75e+14) {
tmp = (1.0 + (x - (y * (z / x)))) / x;
} else if (x <= 1.1e+62) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = x / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.75e+14: tmp = (1.0 + (x - (y * (z / x)))) / x elif x <= 1.1e+62: tmp = (x + (y / t)) / (x + 1.0) else: tmp = x / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.75e+14) tmp = Float64(Float64(1.0 + Float64(x - Float64(y * Float64(z / x)))) / x); elseif (x <= 1.1e+62) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); 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 <= -1.75e+14) tmp = (1.0 + (x - (y * (z / x)))) / x; elseif (x <= 1.1e+62) tmp = (x + (y / t)) / (x + 1.0); else tmp = x / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.75e+14], N[(N[(1.0 + N[(x - N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 1.1e+62], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{+14}:\\
\;\;\;\;\frac{1 + \left(x - y \cdot \frac{z}{x}\right)}{x}\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+62}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1}\\
\end{array}
\end{array}
if x < -1.75e14Initial program 85.7%
*-commutative85.7%
Simplified85.7%
Taylor expanded in t around 0 84.1%
mul-1-neg84.1%
unsub-neg84.1%
associate-/l*90.4%
+-commutative90.4%
Simplified90.4%
Taylor expanded in x around inf 90.4%
if -1.75e14 < x < 1.10000000000000007e62Initial program 88.4%
*-commutative88.4%
Simplified88.4%
Taylor expanded in z around inf 67.4%
+-commutative67.4%
+-commutative67.4%
Simplified67.4%
if 1.10000000000000007e62 < x Initial program 82.0%
*-commutative82.0%
Simplified82.0%
Taylor expanded in t around inf 91.7%
+-commutative91.7%
Simplified91.7%
Final simplification77.1%
(FPCore (x y z t) :precision binary64 (if (<= x -8.2e-84) 1.0 (if (<= x 4.2e-9) (+ x (/ y t)) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -8.2e-84) {
tmp = 1.0;
} else if (x <= 4.2e-9) {
tmp = x + (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 <= (-8.2d-84)) then
tmp = 1.0d0
else if (x <= 4.2d-9) then
tmp = x + (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 <= -8.2e-84) {
tmp = 1.0;
} else if (x <= 4.2e-9) {
tmp = x + (y / t);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -8.2e-84: tmp = 1.0 elif x <= 4.2e-9: tmp = x + (y / t) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -8.2e-84) tmp = 1.0; elseif (x <= 4.2e-9) tmp = Float64(x + Float64(y / t)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -8.2e-84) tmp = 1.0; elseif (x <= 4.2e-9) tmp = x + (y / t); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -8.2e-84], 1.0, If[LessEqual[x, 4.2e-9], N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.2 \cdot 10^{-84}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{-9}:\\
\;\;\;\;x + \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -8.2000000000000001e-84 or 4.20000000000000039e-9 < x Initial program 84.0%
*-commutative84.0%
Simplified84.0%
Taylor expanded in x around inf 76.4%
if -8.2000000000000001e-84 < x < 4.20000000000000039e-9Initial program 89.8%
*-commutative89.8%
Simplified89.8%
Taylor expanded in z around inf 69.0%
+-commutative69.0%
+-commutative69.0%
Simplified69.0%
Taylor expanded in x around 0 68.7%
Taylor expanded in y around 0 68.7%
+-commutative68.7%
Simplified68.7%
Final simplification72.9%
(FPCore (x y z t) :precision binary64 (if (<= x -2.7e-112) 1.0 (if (<= x 9.5e-12) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.7e-112) {
tmp = 1.0;
} else if (x <= 9.5e-12) {
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-112)) then
tmp = 1.0d0
else if (x <= 9.5d-12) 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-112) {
tmp = 1.0;
} else if (x <= 9.5e-12) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.7e-112: tmp = 1.0 elif x <= 9.5e-12: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.7e-112) tmp = 1.0; elseif (x <= 9.5e-12) 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-112) tmp = 1.0; elseif (x <= 9.5e-12) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.7e-112], 1.0, If[LessEqual[x, 9.5e-12], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{-112}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-12}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -2.7000000000000001e-112 or 9.4999999999999995e-12 < x Initial program 84.8%
*-commutative84.8%
Simplified84.8%
Taylor expanded in x around inf 73.6%
if -2.7000000000000001e-112 < x < 9.4999999999999995e-12Initial program 89.2%
*-commutative89.2%
Simplified89.2%
Taylor expanded in x around 0 44.7%
(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 86.7%
*-commutative86.7%
Simplified86.7%
Taylor expanded in x around inf 48.6%
(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 2024160
(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)))