
(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 9 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 (- INFINITY))
(* (/ y (+ x 1.0)) (/ z t_1))
(if (<= t_2 1e+248) 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 <= -((double) INFINITY)) {
tmp = (y / (x + 1.0)) * (z / t_1);
} else if (t_2 <= 1e+248) {
tmp = t_2;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
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 <= -Double.POSITIVE_INFINITY) {
tmp = (y / (x + 1.0)) * (z / t_1);
} else if (t_2 <= 1e+248) {
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 <= -math.inf: tmp = (y / (x + 1.0)) * (z / t_1) elif t_2 <= 1e+248: 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 <= Float64(-Inf)) tmp = Float64(Float64(y / Float64(x + 1.0)) * Float64(z / t_1)); elseif (t_2 <= 1e+248) 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 <= -Inf) tmp = (y / (x + 1.0)) * (z / t_1); elseif (t_2 <= 1e+248) 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, (-Infinity)], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(z / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+248], 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 -\infty:\\
\;\;\;\;\frac{y}{x + 1} \cdot \frac{z}{t\_1}\\
\mathbf{elif}\;t\_2 \leq 10^{+248}:\\
\;\;\;\;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))) < -inf.0Initial program 48.2%
*-commutative48.2%
Simplified48.2%
Taylor expanded in y around inf 47.7%
times-frac87.6%
+-commutative87.6%
Simplified87.6%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 1.00000000000000005e248Initial program 98.6%
if 1.00000000000000005e248 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 24.2%
*-commutative24.2%
Simplified24.2%
Taylor expanded in z around inf 86.3%
+-commutative86.3%
+-commutative86.3%
Simplified86.3%
Final simplification96.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.8e-104) (not (<= t 9.4e-163))) (/ (+ x (/ y t)) (+ x 1.0)) (- 1.0 (* y (/ (/ z x) (+ x 1.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.8e-104) || !(t <= 9.4e-163)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 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 <= (-1.8d-104)) .or. (.not. (t <= 9.4d-163))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 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 <= -1.8e-104) || !(t <= 9.4e-163)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - (y * ((z / x) / (x + 1.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.8e-104) or not (t <= 9.4e-163): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 - (y * ((z / x) / (x + 1.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.8e-104) || !(t <= 9.4e-163)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 - Float64(y * Float64(Float64(z / x) / Float64(x + 1.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.8e-104) || ~((t <= 9.4e-163))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 - (y * ((z / x) / (x + 1.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.8e-104], N[Not[LessEqual[t, 9.4e-163]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(y * N[(N[(z / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.8 \cdot 10^{-104} \lor \neg \left(t \leq 9.4 \cdot 10^{-163}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 - y \cdot \frac{\frac{z}{x}}{x + 1}\\
\end{array}
\end{array}
if t < -1.7999999999999999e-104 or 9.4e-163 < t Initial program 86.6%
*-commutative86.6%
Simplified86.6%
Taylor expanded in z around inf 85.3%
+-commutative85.3%
+-commutative85.3%
Simplified85.3%
if -1.7999999999999999e-104 < t < 9.4e-163Initial program 97.3%
*-commutative97.3%
Simplified97.3%
Taylor expanded in t around 0 83.9%
mul-1-neg83.9%
unsub-neg83.9%
associate-/l*85.2%
+-commutative85.2%
Simplified85.2%
Taylor expanded in y around 0 83.9%
*-inverses83.9%
mul-1-neg83.9%
associate-/r*83.9%
associate-*r/85.2%
+-commutative85.2%
sub-neg85.2%
*-inverses85.2%
associate-/l*86.5%
+-commutative86.5%
Simplified86.5%
Final simplification85.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.1e-60) (not (<= z 1.9e-133))) (/ (+ x (/ y t)) (+ x 1.0)) (- 1.0 (/ (* y z) x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.1e-60) || !(z <= 1.9e-133)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - ((y * 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 <= (-2.1d-60)) .or. (.not. (z <= 1.9d-133))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 - ((y * z) / x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.1e-60) || !(z <= 1.9e-133)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - ((y * z) / x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.1e-60) or not (z <= 1.9e-133): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 - ((y * z) / x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.1e-60) || !(z <= 1.9e-133)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 - Float64(Float64(y * z) / x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.1e-60) || ~((z <= 1.9e-133))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 - ((y * z) / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.1e-60], N[Not[LessEqual[z, 1.9e-133]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(y * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{-60} \lor \neg \left(z \leq 1.9 \cdot 10^{-133}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{y \cdot z}{x}\\
\end{array}
\end{array}
if z < -2.09999999999999991e-60 or 1.9000000000000002e-133 < z Initial program 84.7%
*-commutative84.7%
Simplified84.7%
Taylor expanded in z around inf 85.4%
+-commutative85.4%
+-commutative85.4%
Simplified85.4%
if -2.09999999999999991e-60 < z < 1.9000000000000002e-133Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around 0 80.4%
mul-1-neg80.4%
unsub-neg80.4%
associate-/l*80.4%
+-commutative80.4%
Simplified80.4%
Taylor expanded in y around 0 80.4%
*-inverses80.4%
mul-1-neg80.4%
associate-/r*80.4%
associate-*r/80.4%
+-commutative80.4%
sub-neg80.4%
*-inverses80.4%
associate-/l*80.4%
+-commutative80.4%
Simplified80.4%
Taylor expanded in x around 0 79.8%
Final simplification83.6%
(FPCore (x y z t) :precision binary64 (if (<= x -4.6e-57) 1.0 (if (<= x -5e-143) x (if (<= x 2.6e-14) (/ y t) 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4.6e-57) {
tmp = 1.0;
} else if (x <= -5e-143) {
tmp = x;
} else if (x <= 2.6e-14) {
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 <= (-4.6d-57)) then
tmp = 1.0d0
else if (x <= (-5d-143)) then
tmp = x
else if (x <= 2.6d-14) 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 <= -4.6e-57) {
tmp = 1.0;
} else if (x <= -5e-143) {
tmp = x;
} else if (x <= 2.6e-14) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -4.6e-57: tmp = 1.0 elif x <= -5e-143: tmp = x elif x <= 2.6e-14: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -4.6e-57) tmp = 1.0; elseif (x <= -5e-143) tmp = x; elseif (x <= 2.6e-14) 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 <= -4.6e-57) tmp = 1.0; elseif (x <= -5e-143) tmp = x; elseif (x <= 2.6e-14) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -4.6e-57], 1.0, If[LessEqual[x, -5e-143], x, If[LessEqual[x, 2.6e-14], N[(y / t), $MachinePrecision], 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.6 \cdot 10^{-57}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -5 \cdot 10^{-143}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-14}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -4.6e-57 or 2.59999999999999997e-14 < x Initial program 88.2%
*-commutative88.2%
Simplified88.2%
Taylor expanded in x around inf 82.7%
if -4.6e-57 < x < -5.0000000000000002e-143Initial program 94.8%
*-commutative94.8%
Simplified94.8%
Taylor expanded in t around inf 46.5%
+-commutative46.5%
Simplified46.5%
Taylor expanded in x around 0 46.5%
Taylor expanded in x around 0 46.5%
if -5.0000000000000002e-143 < x < 2.59999999999999997e-14Initial program 90.6%
*-commutative90.6%
Simplified90.6%
Taylor expanded in x around 0 58.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.1e-142) (not (<= x 2.6e-14))) (/ x (+ x 1.0)) (/ y (* t (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.1e-142) || !(x <= 2.6e-14)) {
tmp = x / (x + 1.0);
} else {
tmp = 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) :: tmp
if ((x <= (-1.1d-142)) .or. (.not. (x <= 2.6d-14))) then
tmp = x / (x + 1.0d0)
else
tmp = y / (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 ((x <= -1.1e-142) || !(x <= 2.6e-14)) {
tmp = x / (x + 1.0);
} else {
tmp = y / (t * (x + 1.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.1e-142) or not (x <= 2.6e-14): tmp = x / (x + 1.0) else: tmp = y / (t * (x + 1.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.1e-142) || !(x <= 2.6e-14)) tmp = Float64(x / Float64(x + 1.0)); else tmp = Float64(y / Float64(t * Float64(x + 1.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.1e-142) || ~((x <= 2.6e-14))) tmp = x / (x + 1.0); else tmp = y / (t * (x + 1.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.1e-142], N[Not[LessEqual[x, 2.6e-14]], $MachinePrecision]], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / N[(t * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{-142} \lor \neg \left(x \leq 2.6 \cdot 10^{-14}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t \cdot \left(x + 1\right)}\\
\end{array}
\end{array}
if x < -1.10000000000000008e-142 or 2.59999999999999997e-14 < x Initial program 89.0%
*-commutative89.0%
Simplified89.0%
Taylor expanded in t around inf 78.7%
+-commutative78.7%
Simplified78.7%
if -1.10000000000000008e-142 < x < 2.59999999999999997e-14Initial program 90.6%
*-commutative90.6%
Simplified90.6%
Taylor expanded in y around inf 61.6%
times-frac64.6%
+-commutative64.6%
Simplified64.6%
Taylor expanded in z around inf 58.7%
Final simplification71.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -9e-143) (not (<= x 9.6e-44))) (/ x (+ x 1.0)) (/ y t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -9e-143) || !(x <= 9.6e-44)) {
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 <= (-9d-143)) .or. (.not. (x <= 9.6d-44))) 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 <= -9e-143) || !(x <= 9.6e-44)) {
tmp = x / (x + 1.0);
} else {
tmp = y / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -9e-143) or not (x <= 9.6e-44): tmp = x / (x + 1.0) else: tmp = y / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -9e-143) || !(x <= 9.6e-44)) 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 <= -9e-143) || ~((x <= 9.6e-44))) tmp = x / (x + 1.0); else tmp = y / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -9e-143], N[Not[LessEqual[x, 9.6e-44]], $MachinePrecision]], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{-143} \lor \neg \left(x \leq 9.6 \cdot 10^{-44}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t}\\
\end{array}
\end{array}
if x < -9.00000000000000001e-143 or 9.60000000000000035e-44 < x Initial program 88.6%
*-commutative88.6%
Simplified88.6%
Taylor expanded in t around inf 77.9%
+-commutative77.9%
Simplified77.9%
if -9.00000000000000001e-143 < x < 9.60000000000000035e-44Initial program 91.4%
*-commutative91.4%
Simplified91.4%
Taylor expanded in x around 0 59.5%
Final simplification71.3%
(FPCore (x y z t) :precision binary64 (if (<= x -0.25) 1.0 (if (<= x 1.75e-6) (+ x (/ y t)) (/ x (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -0.25) {
tmp = 1.0;
} else if (x <= 1.75e-6) {
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 <= (-0.25d0)) then
tmp = 1.0d0
else if (x <= 1.75d-6) 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 <= -0.25) {
tmp = 1.0;
} else if (x <= 1.75e-6) {
tmp = x + (y / t);
} else {
tmp = x / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -0.25: tmp = 1.0 elif x <= 1.75e-6: tmp = x + (y / t) else: tmp = x / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -0.25) tmp = 1.0; elseif (x <= 1.75e-6) 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 <= -0.25) tmp = 1.0; elseif (x <= 1.75e-6) tmp = x + (y / t); else tmp = x / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -0.25], 1.0, If[LessEqual[x, 1.75e-6], 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 -0.25:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{-6}:\\
\;\;\;\;x + \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1}\\
\end{array}
\end{array}
if x < -0.25Initial program 88.2%
*-commutative88.2%
Simplified88.2%
Taylor expanded in x around inf 87.5%
if -0.25 < x < 1.74999999999999997e-6Initial program 91.4%
*-commutative91.4%
Simplified91.4%
Taylor expanded in z around inf 72.1%
+-commutative72.1%
+-commutative72.1%
Simplified72.1%
Taylor expanded in x around 0 71.1%
if 1.74999999999999997e-6 < x Initial program 87.6%
*-commutative87.6%
Simplified87.6%
Taylor expanded in t around inf 91.1%
+-commutative91.1%
Simplified91.1%
Final simplification80.3%
(FPCore (x y z t) :precision binary64 (if (<= x -1.35e-55) 1.0 (if (<= x 1.7e-75) x 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.35e-55) {
tmp = 1.0;
} else if (x <= 1.7e-75) {
tmp = 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 <= (-1.35d-55)) then
tmp = 1.0d0
else if (x <= 1.7d-75) then
tmp = 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 <= -1.35e-55) {
tmp = 1.0;
} else if (x <= 1.7e-75) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.35e-55: tmp = 1.0 elif x <= 1.7e-75: tmp = x else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.35e-55) tmp = 1.0; elseif (x <= 1.7e-75) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.35e-55) tmp = 1.0; elseif (x <= 1.7e-75) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.35e-55], 1.0, If[LessEqual[x, 1.7e-75], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{-55}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{-75}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.35000000000000002e-55 or 1.70000000000000008e-75 < x Initial program 87.7%
*-commutative87.7%
Simplified87.7%
Taylor expanded in x around inf 78.3%
if -1.35000000000000002e-55 < x < 1.70000000000000008e-75Initial program 92.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in t around inf 25.7%
+-commutative25.7%
Simplified25.7%
Taylor expanded in x around 0 25.7%
Taylor expanded in x around 0 25.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 89.6%
*-commutative89.6%
Simplified89.6%
Taylor expanded in x around inf 50.9%
(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 2024159
(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)))