
(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) (- x (* z t))) x) (- -1.0 x)))
(t_2 (- (* z t) x))
(t_3 (/ (* y (- (+ (/ z t_2) (/ x y)) (/ (/ x y) t_2))) (+ x 1.0))))
(if (<= t_1 -1e-106)
t_3
(if (<= t_1 2e+213)
t_1
(if (<= t_1 INFINITY) t_3 (/ (+ x (/ y t)) (+ x 1.0)))))))
double code(double x, double y, double z, double t) {
double t_1 = ((((y * z) - x) / (x - (z * t))) - x) / (-1.0 - x);
double t_2 = (z * t) - x;
double t_3 = (y * (((z / t_2) + (x / y)) - ((x / y) / t_2))) / (x + 1.0);
double tmp;
if (t_1 <= -1e-106) {
tmp = t_3;
} else if (t_1 <= 2e+213) {
tmp = t_1;
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_3;
} 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 = ((((y * z) - x) / (x - (z * t))) - x) / (-1.0 - x);
double t_2 = (z * t) - x;
double t_3 = (y * (((z / t_2) + (x / y)) - ((x / y) / t_2))) / (x + 1.0);
double tmp;
if (t_1 <= -1e-106) {
tmp = t_3;
} else if (t_1 <= 2e+213) {
tmp = t_1;
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_3;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = ((((y * z) - x) / (x - (z * t))) - x) / (-1.0 - x) t_2 = (z * t) - x t_3 = (y * (((z / t_2) + (x / y)) - ((x / y) / t_2))) / (x + 1.0) tmp = 0 if t_1 <= -1e-106: tmp = t_3 elif t_1 <= 2e+213: tmp = t_1 elif t_1 <= math.inf: tmp = t_3 else: tmp = (x + (y / t)) / (x + 1.0) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(Float64(Float64(y * z) - x) / Float64(x - Float64(z * t))) - x) / Float64(-1.0 - x)) t_2 = Float64(Float64(z * t) - x) t_3 = Float64(Float64(y * Float64(Float64(Float64(z / t_2) + Float64(x / y)) - Float64(Float64(x / y) / t_2))) / Float64(x + 1.0)) tmp = 0.0 if (t_1 <= -1e-106) tmp = t_3; elseif (t_1 <= 2e+213) tmp = t_1; elseif (t_1 <= Inf) tmp = t_3; 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 = ((((y * z) - x) / (x - (z * t))) - x) / (-1.0 - x); t_2 = (z * t) - x; t_3 = (y * (((z / t_2) + (x / y)) - ((x / y) / t_2))) / (x + 1.0); tmp = 0.0; if (t_1 <= -1e-106) tmp = t_3; elseif (t_1 <= 2e+213) tmp = t_1; elseif (t_1 <= Inf) tmp = t_3; else tmp = (x + (y / t)) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]}, Block[{t$95$3 = N[(N[(y * N[(N[(N[(z / t$95$2), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-106], t$95$3, If[LessEqual[t$95$1, 2e+213], t$95$1, If[LessEqual[t$95$1, Infinity], t$95$3, N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{y \cdot z - x}{x - z \cdot t} - x}{-1 - x}\\
t_2 := z \cdot t - x\\
t_3 := \frac{y \cdot \left(\left(\frac{z}{t\_2} + \frac{x}{y}\right) - \frac{\frac{x}{y}}{t\_2}\right)}{x + 1}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-106}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+213}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_3\\
\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))) < -9.99999999999999941e-107 or 1.99999999999999997e213 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < +inf.0Initial program 71.9%
*-commutative71.9%
Simplified71.9%
Taylor expanded in y around inf 99.7%
+-commutative99.7%
associate-/r*99.7%
Simplified99.7%
if -9.99999999999999941e-107 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 1.99999999999999997e213Initial program 98.6%
if +inf.0 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in z around inf 100.0%
Final simplification98.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.15e+108) (not (<= z 1.85e+144))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (- (/ (- (* y z) x) (- x (* z t))) x) (- -1.0 x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.15e+108) || !(z <= 1.85e+144)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = ((((y * z) - x) / (x - (z * t))) - 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 ((z <= (-1.15d+108)) .or. (.not. (z <= 1.85d+144))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = ((((y * z) - x) / (x - (z * t))) - 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 ((z <= -1.15e+108) || !(z <= 1.85e+144)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = ((((y * z) - x) / (x - (z * t))) - x) / (-1.0 - x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.15e+108) or not (z <= 1.85e+144): tmp = (x + (y / t)) / (x + 1.0) else: tmp = ((((y * z) - x) / (x - (z * t))) - x) / (-1.0 - x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.15e+108) || !(z <= 1.85e+144)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(Float64(Float64(Float64(y * z) - x) / Float64(x - Float64(z * t))) - x) / Float64(-1.0 - x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.15e+108) || ~((z <= 1.85e+144))) tmp = (x + (y / t)) / (x + 1.0); else tmp = ((((y * z) - x) / (x - (z * t))) - x) / (-1.0 - x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.15e+108], N[Not[LessEqual[z, 1.85e+144]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{+108} \lor \neg \left(z \leq 1.85 \cdot 10^{+144}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y \cdot z - x}{x - z \cdot t} - x}{-1 - x}\\
\end{array}
\end{array}
if z < -1.1499999999999999e108 or 1.8499999999999998e144 < z Initial program 68.7%
*-commutative68.7%
Simplified68.7%
Taylor expanded in z around inf 94.2%
if -1.1499999999999999e108 < z < 1.8499999999999998e144Initial program 98.2%
Final simplification96.8%
(FPCore (x y z t) :precision binary64 (if (or (<= t -9.5e-97) (not (<= t 1.85e-100))) (/ (+ 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 <= -9.5e-97) || !(t <= 1.85e-100)) {
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 <= (-9.5d-97)) .or. (.not. (t <= 1.85d-100))) 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 <= -9.5e-97) || !(t <= 1.85e-100)) {
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 <= -9.5e-97) or not (t <= 1.85e-100): 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 <= -9.5e-97) || !(t <= 1.85e-100)) 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 <= -9.5e-97) || ~((t <= 1.85e-100))) 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, -9.5e-97], N[Not[LessEqual[t, 1.85e-100]], $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 -9.5 \cdot 10^{-97} \lor \neg \left(t \leq 1.85 \cdot 10^{-100}\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 < -9.5000000000000001e-97 or 1.85000000000000009e-100 < t Initial program 87.1%
*-commutative87.1%
Simplified87.1%
Taylor expanded in z around inf 86.9%
if -9.5000000000000001e-97 < t < 1.85000000000000009e-100Initial program 91.4%
*-commutative91.4%
Simplified91.4%
Taylor expanded in t around 0 75.8%
associate-+r+75.8%
mul-1-neg75.8%
unsub-neg75.8%
+-commutative75.8%
associate-/l*81.5%
+-commutative81.5%
Simplified81.5%
Final simplification85.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2e-63) (not (<= z 5e-70))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (+ x (/ x (- x (* z t)))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2e-63) || !(z <= 5e-70)) {
tmp = (x + (y / t)) / (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 ((z <= (-2d-63)) .or. (.not. (z <= 5d-70))) then
tmp = (x + (y / t)) / (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 ((z <= -2e-63) || !(z <= 5e-70)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + (x / (x - (z * t)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2e-63) or not (z <= 5e-70): tmp = (x + (y / t)) / (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 ((z <= -2e-63) || !(z <= 5e-70)) tmp = Float64(Float64(x + Float64(y / t)) / 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 ((z <= -2e-63) || ~((z <= 5e-70))) tmp = (x + (y / t)) / (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[z, -2e-63], N[Not[LessEqual[z, 5e-70]], $MachinePrecision]], N[(N[(x + N[(y / t), $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}\;z \leq -2 \cdot 10^{-63} \lor \neg \left(z \leq 5 \cdot 10^{-70}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{x}{x - z \cdot t}}{x + 1}\\
\end{array}
\end{array}
if z < -2.00000000000000013e-63 or 4.9999999999999998e-70 < z Initial program 82.4%
*-commutative82.4%
Simplified82.4%
Taylor expanded in z around inf 89.5%
if -2.00000000000000013e-63 < z < 4.9999999999999998e-70Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 75.6%
+-commutative75.6%
Simplified75.6%
Final simplification84.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (/ y t))))
(if (<= t -6.5e-96)
(/ (- t_1 (/ x (* z t))) (+ x 1.0))
(if (<= t 1.85e-100)
(/ (- (+ x 1.0) (* y (/ z x))) (+ x 1.0))
(/ t_1 (+ x 1.0))))))
double code(double x, double y, double z, double t) {
double t_1 = x + (y / t);
double tmp;
if (t <= -6.5e-96) {
tmp = (t_1 - (x / (z * t))) / (x + 1.0);
} else if (t <= 1.85e-100) {
tmp = ((x + 1.0) - (y * (z / x))) / (x + 1.0);
} else {
tmp = 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) :: tmp
t_1 = x + (y / t)
if (t <= (-6.5d-96)) then
tmp = (t_1 - (x / (z * t))) / (x + 1.0d0)
else if (t <= 1.85d-100) then
tmp = ((x + 1.0d0) - (y * (z / x))) / (x + 1.0d0)
else
tmp = 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 = x + (y / t);
double tmp;
if (t <= -6.5e-96) {
tmp = (t_1 - (x / (z * t))) / (x + 1.0);
} else if (t <= 1.85e-100) {
tmp = ((x + 1.0) - (y * (z / x))) / (x + 1.0);
} else {
tmp = t_1 / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (y / t) tmp = 0 if t <= -6.5e-96: tmp = (t_1 - (x / (z * t))) / (x + 1.0) elif t <= 1.85e-100: tmp = ((x + 1.0) - (y * (z / x))) / (x + 1.0) else: tmp = t_1 / (x + 1.0) return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(y / t)) tmp = 0.0 if (t <= -6.5e-96) tmp = Float64(Float64(t_1 - Float64(x / Float64(z * t))) / Float64(x + 1.0)); elseif (t <= 1.85e-100) tmp = Float64(Float64(Float64(x + 1.0) - Float64(y * Float64(z / x))) / Float64(x + 1.0)); else tmp = Float64(t_1 / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (y / t); tmp = 0.0; if (t <= -6.5e-96) tmp = (t_1 - (x / (z * t))) / (x + 1.0); elseif (t <= 1.85e-100) tmp = ((x + 1.0) - (y * (z / x))) / (x + 1.0); else tmp = t_1 / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -6.5e-96], N[(N[(t$95$1 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.85e-100], N[(N[(N[(x + 1.0), $MachinePrecision] - N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y}{t}\\
\mathbf{if}\;t \leq -6.5 \cdot 10^{-96}:\\
\;\;\;\;\frac{t\_1 - \frac{x}{z \cdot t}}{x + 1}\\
\mathbf{elif}\;t \leq 1.85 \cdot 10^{-100}:\\
\;\;\;\;\frac{\left(x + 1\right) - y \cdot \frac{z}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{x + 1}\\
\end{array}
\end{array}
if t < -6.50000000000000001e-96Initial program 88.4%
*-commutative88.4%
Simplified88.4%
Taylor expanded in t around inf 89.3%
if -6.50000000000000001e-96 < t < 1.85000000000000009e-100Initial program 91.4%
*-commutative91.4%
Simplified91.4%
Taylor expanded in t around 0 75.8%
associate-+r+75.8%
mul-1-neg75.8%
unsub-neg75.8%
+-commutative75.8%
associate-/l*81.5%
+-commutative81.5%
Simplified81.5%
if 1.85000000000000009e-100 < t Initial program 85.9%
*-commutative85.9%
Simplified85.9%
Taylor expanded in z around inf 85.8%
Final simplification85.9%
(FPCore (x y z t) :precision binary64 (if (<= x -1.25e+56) 1.0 (if (<= x 1.66e+65) (/ (+ 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.25e+56) {
tmp = 1.0;
} else if (x <= 1.66e+65) {
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.25d+56)) then
tmp = 1.0d0
else if (x <= 1.66d+65) 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.25e+56) {
tmp = 1.0;
} else if (x <= 1.66e+65) {
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.25e+56: tmp = 1.0 elif x <= 1.66e+65: 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.25e+56) tmp = 1.0; elseif (x <= 1.66e+65) 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.25e+56) tmp = 1.0; elseif (x <= 1.66e+65) 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.25e+56], 1.0, If[LessEqual[x, 1.66e+65], 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.25 \cdot 10^{+56}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.66 \cdot 10^{+65}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1}\\
\end{array}
\end{array}
if x < -1.25000000000000006e56Initial program 81.2%
*-commutative81.2%
Simplified81.2%
Taylor expanded in z around inf 76.9%
Taylor expanded in x around inf 95.2%
if -1.25000000000000006e56 < x < 1.6600000000000001e65Initial program 88.8%
*-commutative88.8%
Simplified88.8%
Taylor expanded in z around inf 72.8%
if 1.6600000000000001e65 < x Initial program 92.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in t around inf 96.7%
+-commutative96.7%
Simplified96.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.2e-144) (not (<= x 1.9e-166))) (/ x (+ x 1.0)) (/ y (* t (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.2e-144) || !(x <= 1.9e-166)) {
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 <= (-3.2d-144)) .or. (.not. (x <= 1.9d-166))) 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 <= -3.2e-144) || !(x <= 1.9e-166)) {
tmp = x / (x + 1.0);
} else {
tmp = y / (t * (x + 1.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.2e-144) or not (x <= 1.9e-166): 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 <= -3.2e-144) || !(x <= 1.9e-166)) 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 <= -3.2e-144) || ~((x <= 1.9e-166))) 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, -3.2e-144], N[Not[LessEqual[x, 1.9e-166]], $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 -3.2 \cdot 10^{-144} \lor \neg \left(x \leq 1.9 \cdot 10^{-166}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t \cdot \left(x + 1\right)}\\
\end{array}
\end{array}
if x < -3.19999999999999973e-144 or 1.89999999999999991e-166 < x Initial program 90.5%
*-commutative90.5%
Simplified90.5%
Taylor expanded in t around inf 72.3%
+-commutative72.3%
Simplified72.3%
if -3.19999999999999973e-144 < x < 1.89999999999999991e-166Initial program 82.3%
*-commutative82.3%
Simplified82.3%
Taylor expanded in y around inf 56.2%
associate-/l*63.1%
+-commutative63.1%
Simplified63.1%
Taylor expanded in z around inf 63.4%
+-commutative63.4%
Simplified63.4%
Final simplification69.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5.6e-146) (not (<= x 1.9e-166))) (/ x (+ x 1.0)) (/ y t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5.6e-146) || !(x <= 1.9e-166)) {
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 <= (-5.6d-146)) .or. (.not. (x <= 1.9d-166))) 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 <= -5.6e-146) || !(x <= 1.9e-166)) {
tmp = x / (x + 1.0);
} else {
tmp = y / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -5.6e-146) or not (x <= 1.9e-166): tmp = x / (x + 1.0) else: tmp = y / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -5.6e-146) || !(x <= 1.9e-166)) 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 <= -5.6e-146) || ~((x <= 1.9e-166))) tmp = x / (x + 1.0); else tmp = y / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -5.6e-146], N[Not[LessEqual[x, 1.9e-166]], $MachinePrecision]], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.6 \cdot 10^{-146} \lor \neg \left(x \leq 1.9 \cdot 10^{-166}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t}\\
\end{array}
\end{array}
if x < -5.60000000000000006e-146 or 1.89999999999999991e-166 < x Initial program 90.5%
*-commutative90.5%
Simplified90.5%
Taylor expanded in t around inf 72.3%
+-commutative72.3%
Simplified72.3%
if -5.60000000000000006e-146 < x < 1.89999999999999991e-166Initial program 82.3%
*-commutative82.3%
Simplified82.3%
Taylor expanded in z around inf 78.3%
Taylor expanded in x around 0 63.4%
Final simplification69.9%
(FPCore (x y z t) :precision binary64 (if (<= x -5.2e-23) 1.0 (if (<= x 1.3e-88) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5.2e-23) {
tmp = 1.0;
} else if (x <= 1.3e-88) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-5.2d-23)) then
tmp = 1.0d0
else if (x <= 1.3d-88) then
tmp = y / t
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5.2e-23) {
tmp = 1.0;
} else if (x <= 1.3e-88) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -5.2e-23: tmp = 1.0 elif x <= 1.3e-88: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -5.2e-23) tmp = 1.0; elseif (x <= 1.3e-88) tmp = Float64(y / t); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -5.2e-23) tmp = 1.0; elseif (x <= 1.3e-88) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -5.2e-23], 1.0, If[LessEqual[x, 1.3e-88], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.2 \cdot 10^{-23}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-88}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -5.2e-23 or 1.30000000000000007e-88 < x Initial program 88.2%
*-commutative88.2%
Simplified88.2%
Taylor expanded in z around inf 75.6%
Taylor expanded in x around inf 78.9%
if -5.2e-23 < x < 1.30000000000000007e-88Initial program 88.3%
*-commutative88.3%
Simplified88.3%
Taylor expanded in z around inf 75.2%
Taylor expanded in x around 0 48.8%
(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.3%
*-commutative88.3%
Simplified88.3%
Taylor expanded in z around inf 75.4%
Taylor expanded in x around inf 48.5%
(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 2024108
(FPCore (x y z t)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:alt
(/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))