
(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 (/ (- x (/ (- x (* y z)) (- (* z t) x))) (+ x 1.0))))
(if (<= t_1 -5e-11)
t_1
(if (<= t_1 1e-132)
(/ (- x (/ (- (/ x z) y) t)) (+ x 1.0))
(if (<= t_1 5e+295)
t_1
(+
(/ (- (/ y (+ x 1.0)) (/ x (* z (+ x 1.0)))) t)
(/ x (+ x 1.0))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x - ((x - (y * z)) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_1 <= -5e-11) {
tmp = t_1;
} else if (t_1 <= 1e-132) {
tmp = (x - (((x / z) - y) / t)) / (x + 1.0);
} else if (t_1 <= 5e+295) {
tmp = t_1;
} else {
tmp = (((y / (x + 1.0)) - (x / (z * (x + 1.0)))) / t) + (x / (x + 1.0));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (x - ((x - (y * z)) / ((z * t) - x))) / (x + 1.0d0)
if (t_1 <= (-5d-11)) then
tmp = t_1
else if (t_1 <= 1d-132) then
tmp = (x - (((x / z) - y) / t)) / (x + 1.0d0)
else if (t_1 <= 5d+295) then
tmp = t_1
else
tmp = (((y / (x + 1.0d0)) - (x / (z * (x + 1.0d0)))) / t) + (x / (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 - ((x - (y * z)) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_1 <= -5e-11) {
tmp = t_1;
} else if (t_1 <= 1e-132) {
tmp = (x - (((x / z) - y) / t)) / (x + 1.0);
} else if (t_1 <= 5e+295) {
tmp = t_1;
} else {
tmp = (((y / (x + 1.0)) - (x / (z * (x + 1.0)))) / t) + (x / (x + 1.0));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x - ((x - (y * z)) / ((z * t) - x))) / (x + 1.0) tmp = 0 if t_1 <= -5e-11: tmp = t_1 elif t_1 <= 1e-132: tmp = (x - (((x / z) - y) / t)) / (x + 1.0) elif t_1 <= 5e+295: tmp = t_1 else: tmp = (((y / (x + 1.0)) - (x / (z * (x + 1.0)))) / t) + (x / (x + 1.0)) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x - Float64(Float64(x - Float64(y * z)) / Float64(Float64(z * t) - x))) / Float64(x + 1.0)) tmp = 0.0 if (t_1 <= -5e-11) tmp = t_1; elseif (t_1 <= 1e-132) tmp = Float64(Float64(x - Float64(Float64(Float64(x / z) - y) / t)) / Float64(x + 1.0)); elseif (t_1 <= 5e+295) tmp = t_1; else tmp = Float64(Float64(Float64(Float64(y / Float64(x + 1.0)) - Float64(x / Float64(z * Float64(x + 1.0)))) / t) + Float64(x / Float64(x + 1.0))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x - ((x - (y * z)) / ((z * t) - x))) / (x + 1.0); tmp = 0.0; if (t_1 <= -5e-11) tmp = t_1; elseif (t_1 <= 1e-132) tmp = (x - (((x / z) - y) / t)) / (x + 1.0); elseif (t_1 <= 5e+295) tmp = t_1; else tmp = (((y / (x + 1.0)) - (x / (z * (x + 1.0)))) / t) + (x / (x + 1.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-11], t$95$1, If[LessEqual[t$95$1, 1e-132], N[(N[(x - N[(N[(N[(x / z), $MachinePrecision] - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+295], t$95$1, N[(N[(N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(x / N[(z * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] + N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - \frac{x - y \cdot z}{z \cdot t - x}}{x + 1}\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{-11}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_1 \leq 10^{-132}:\\
\;\;\;\;\frac{x - \frac{\frac{x}{z} - y}{t}}{x + 1}\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+295}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{x + 1} - \frac{x}{z \cdot \left(x + 1\right)}}{t} + \frac{x}{x + 1}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < -5.00000000000000018e-11 or 9.9999999999999999e-133 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 4.99999999999999991e295Initial program 98.4%
if -5.00000000000000018e-11 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 9.9999999999999999e-133Initial program 85.0%
*-commutative85.0%
Simplified85.0%
Taylor expanded in t around -inf 100.0%
mul-1-neg100.0%
distribute-lft-out--100.0%
Simplified100.0%
if 4.99999999999999991e295 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 24.7%
*-commutative24.7%
Simplified24.7%
Taylor expanded in t around -inf 91.5%
Final simplification98.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- x (/ (- x (* y z)) (- (* z t) x))) (+ x 1.0))))
(if (<= t_1 -5e-11)
t_1
(if (<= t_1 1e-132)
(/ (- x (/ (- (/ x z) y) t)) (+ x 1.0))
(if (<= t_1 5e+295) t_1 (/ (+ x (/ y t)) (+ x 1.0)))))))
double code(double x, double y, double z, double t) {
double t_1 = (x - ((x - (y * z)) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_1 <= -5e-11) {
tmp = t_1;
} else if (t_1 <= 1e-132) {
tmp = (x - (((x / z) - y) / t)) / (x + 1.0);
} else if (t_1 <= 5e+295) {
tmp = t_1;
} 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) :: tmp
t_1 = (x - ((x - (y * z)) / ((z * t) - x))) / (x + 1.0d0)
if (t_1 <= (-5d-11)) then
tmp = t_1
else if (t_1 <= 1d-132) then
tmp = (x - (((x / z) - y) / t)) / (x + 1.0d0)
else if (t_1 <= 5d+295) then
tmp = t_1
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 = (x - ((x - (y * z)) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_1 <= -5e-11) {
tmp = t_1;
} else if (t_1 <= 1e-132) {
tmp = (x - (((x / z) - y) / t)) / (x + 1.0);
} else if (t_1 <= 5e+295) {
tmp = t_1;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x - ((x - (y * z)) / ((z * t) - x))) / (x + 1.0) tmp = 0 if t_1 <= -5e-11: tmp = t_1 elif t_1 <= 1e-132: tmp = (x - (((x / z) - y) / t)) / (x + 1.0) elif t_1 <= 5e+295: tmp = t_1 else: tmp = (x + (y / t)) / (x + 1.0) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x - Float64(Float64(x - Float64(y * z)) / Float64(Float64(z * t) - x))) / Float64(x + 1.0)) tmp = 0.0 if (t_1 <= -5e-11) tmp = t_1; elseif (t_1 <= 1e-132) tmp = Float64(Float64(x - Float64(Float64(Float64(x / z) - y) / t)) / Float64(x + 1.0)); elseif (t_1 <= 5e+295) tmp = t_1; 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 = (x - ((x - (y * z)) / ((z * t) - x))) / (x + 1.0); tmp = 0.0; if (t_1 <= -5e-11) tmp = t_1; elseif (t_1 <= 1e-132) tmp = (x - (((x / z) - y) / t)) / (x + 1.0); elseif (t_1 <= 5e+295) tmp = t_1; else tmp = (x + (y / t)) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-11], t$95$1, If[LessEqual[t$95$1, 1e-132], N[(N[(x - N[(N[(N[(x / z), $MachinePrecision] - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+295], t$95$1, N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - \frac{x - y \cdot z}{z \cdot t - x}}{x + 1}\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{-11}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_1 \leq 10^{-132}:\\
\;\;\;\;\frac{x - \frac{\frac{x}{z} - y}{t}}{x + 1}\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+295}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < -5.00000000000000018e-11 or 9.9999999999999999e-133 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 4.99999999999999991e295Initial program 98.4%
if -5.00000000000000018e-11 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 9.9999999999999999e-133Initial program 85.0%
*-commutative85.0%
Simplified85.0%
Taylor expanded in t around -inf 100.0%
mul-1-neg100.0%
distribute-lft-out--100.0%
Simplified100.0%
if 4.99999999999999991e295 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 24.7%
*-commutative24.7%
Simplified24.7%
Taylor expanded in z around inf 91.4%
Final simplification98.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ x (/ y t)) (+ x 1.0))))
(if (<= t -1250000.0)
t_1
(if (<= t -2.6e-84)
(+ (/ (* z t) (* x (+ x 1.0))) 1.0)
(if (<= t 5.8e-59) (/ (- x (/ y (/ x z))) (+ x 1.0)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (x + (y / t)) / (x + 1.0);
double tmp;
if (t <= -1250000.0) {
tmp = t_1;
} else if (t <= -2.6e-84) {
tmp = ((z * t) / (x * (x + 1.0))) + 1.0;
} else if (t <= 5.8e-59) {
tmp = (x - (y / (x / z))) / (x + 1.0);
} else {
tmp = t_1;
}
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)) / (x + 1.0d0)
if (t <= (-1250000.0d0)) then
tmp = t_1
else if (t <= (-2.6d-84)) then
tmp = ((z * t) / (x * (x + 1.0d0))) + 1.0d0
else if (t <= 5.8d-59) then
tmp = (x - (y / (x / z))) / (x + 1.0d0)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x + (y / t)) / (x + 1.0);
double tmp;
if (t <= -1250000.0) {
tmp = t_1;
} else if (t <= -2.6e-84) {
tmp = ((z * t) / (x * (x + 1.0))) + 1.0;
} else if (t <= 5.8e-59) {
tmp = (x - (y / (x / z))) / (x + 1.0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x + (y / t)) / (x + 1.0) tmp = 0 if t <= -1250000.0: tmp = t_1 elif t <= -2.6e-84: tmp = ((z * t) / (x * (x + 1.0))) + 1.0 elif t <= 5.8e-59: tmp = (x - (y / (x / z))) / (x + 1.0) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)) tmp = 0.0 if (t <= -1250000.0) tmp = t_1; elseif (t <= -2.6e-84) tmp = Float64(Float64(Float64(z * t) / Float64(x * Float64(x + 1.0))) + 1.0); elseif (t <= 5.8e-59) tmp = Float64(Float64(x - Float64(y / Float64(x / z))) / Float64(x + 1.0)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x + (y / t)) / (x + 1.0); tmp = 0.0; if (t <= -1250000.0) tmp = t_1; elseif (t <= -2.6e-84) tmp = ((z * t) / (x * (x + 1.0))) + 1.0; elseif (t <= 5.8e-59) tmp = (x - (y / (x / z))) / (x + 1.0); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1250000.0], t$95$1, If[LessEqual[t, -2.6e-84], N[(N[(N[(z * t), $MachinePrecision] / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[t, 5.8e-59], N[(N[(x - N[(y / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{if}\;t \leq -1250000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -2.6 \cdot 10^{-84}:\\
\;\;\;\;\frac{z \cdot t}{x \cdot \left(x + 1\right)} + 1\\
\mathbf{elif}\;t \leq 5.8 \cdot 10^{-59}:\\
\;\;\;\;\frac{x - \frac{y}{\frac{x}{z}}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -1.25e6 or 5.80000000000000033e-59 < t Initial program 85.0%
*-commutative85.0%
Simplified85.0%
Taylor expanded in z around inf 86.1%
if -1.25e6 < t < -2.6e-84Initial program 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 90.8%
Taylor expanded in t around 0 85.1%
if -2.6e-84 < t < 5.80000000000000033e-59Initial program 95.2%
*-commutative95.2%
Simplified95.2%
Taylor expanded in y around inf 81.8%
Taylor expanded in t around 0 71.2%
mul-1-neg71.2%
unsub-neg71.2%
associate-/l*74.9%
+-commutative74.9%
Simplified74.9%
Final simplification81.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3800.0) (not (<= z 2.75e-49))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (- x (/ x (- (* z t) x))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3800.0) || !(z <= 2.75e-49)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x - (x / ((z * t) - x))) / (x + 1.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-3800.0d0)) .or. (.not. (z <= 2.75d-49))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = (x - (x / ((z * t) - x))) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3800.0) || !(z <= 2.75e-49)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x - (x / ((z * t) - x))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3800.0) or not (z <= 2.75e-49): tmp = (x + (y / t)) / (x + 1.0) else: tmp = (x - (x / ((z * t) - x))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3800.0) || !(z <= 2.75e-49)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(x - Float64(x / Float64(Float64(z * t) - x))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3800.0) || ~((z <= 2.75e-49))) tmp = (x + (y / t)) / (x + 1.0); else tmp = (x - (x / ((z * t) - x))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3800.0], N[Not[LessEqual[z, 2.75e-49]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(x / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3800 \lor \neg \left(z \leq 2.75 \cdot 10^{-49}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - \frac{x}{z \cdot t - x}}{x + 1}\\
\end{array}
\end{array}
if z < -3800 or 2.75000000000000016e-49 < z Initial program 80.6%
*-commutative80.6%
Simplified80.6%
Taylor expanded in z around inf 81.7%
if -3800 < z < 2.75000000000000016e-49Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 81.3%
Final simplification81.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -4600000.0) (not (<= t 1.85e+34))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (- (+ x 1.0) (/ y (/ x z))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4600000.0) || !(t <= 1.85e+34)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = ((x + 1.0) - (y / (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) :: tmp
if ((t <= (-4600000.0d0)) .or. (.not. (t <= 1.85d+34))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = ((x + 1.0d0) - (y / (x / z))) / (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 <= -4600000.0) || !(t <= 1.85e+34)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = ((x + 1.0) - (y / (x / z))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -4600000.0) or not (t <= 1.85e+34): tmp = (x + (y / t)) / (x + 1.0) else: tmp = ((x + 1.0) - (y / (x / z))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -4600000.0) || !(t <= 1.85e+34)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(Float64(x + 1.0) - Float64(y / Float64(x / z))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -4600000.0) || ~((t <= 1.85e+34))) tmp = (x + (y / t)) / (x + 1.0); else tmp = ((x + 1.0) - (y / (x / z))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -4600000.0], N[Not[LessEqual[t, 1.85e+34]], $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[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4600000 \lor \neg \left(t \leq 1.85 \cdot 10^{+34}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x + 1\right) - \frac{y}{\frac{x}{z}}}{x + 1}\\
\end{array}
\end{array}
if t < -4.6e6 or 1.85000000000000004e34 < t Initial program 85.7%
*-commutative85.7%
Simplified85.7%
Taylor expanded in z around inf 89.4%
if -4.6e6 < t < 1.85000000000000004e34Initial program 94.4%
*-commutative94.4%
Simplified94.4%
Taylor expanded in t around 0 81.9%
associate-+r+81.9%
mul-1-neg81.9%
unsub-neg81.9%
+-commutative81.9%
associate-/l*85.3%
+-commutative85.3%
Simplified85.3%
Final simplification87.2%
(FPCore (x y z t) :precision binary64 (if (<= x -1.15e-73) 1.0 (if (<= x 105000000000.0) (/ (+ x (/ y t)) (+ x 1.0)) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.15e-73) {
tmp = 1.0;
} else if (x <= 105000000000.0) {
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 (x <= (-1.15d-73)) then
tmp = 1.0d0
else if (x <= 105000000000.0d0) 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 (x <= -1.15e-73) {
tmp = 1.0;
} else if (x <= 105000000000.0) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.15e-73: tmp = 1.0 elif x <= 105000000000.0: tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.15e-73) tmp = 1.0; elseif (x <= 105000000000.0) 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 (x <= -1.15e-73) tmp = 1.0; elseif (x <= 105000000000.0) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.15e-73], 1.0, If[LessEqual[x, 105000000000.0], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.15 \cdot 10^{-73}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 105000000000:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.14999999999999994e-73 or 1.05e11 < x Initial program 89.5%
*-commutative89.5%
Simplified89.5%
Taylor expanded in y around inf 81.1%
Taylor expanded in x around inf 84.3%
if -1.14999999999999994e-73 < x < 1.05e11Initial program 91.7%
*-commutative91.7%
Simplified91.7%
Taylor expanded in z around inf 65.1%
Final simplification76.3%
(FPCore (x y z t) :precision binary64 (if (<= x -1e-74) 1.0 (if (<= x 1.6e-94) (/ y (* t (+ x 1.0))) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1e-74) {
tmp = 1.0;
} else if (x <= 1.6e-94) {
tmp = 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 (x <= (-1d-74)) then
tmp = 1.0d0
else if (x <= 1.6d-94) then
tmp = 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 (x <= -1e-74) {
tmp = 1.0;
} else if (x <= 1.6e-94) {
tmp = y / (t * (x + 1.0));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1e-74: tmp = 1.0 elif x <= 1.6e-94: tmp = y / (t * (x + 1.0)) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1e-74) tmp = 1.0; elseif (x <= 1.6e-94) tmp = Float64(y / Float64(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 (x <= -1e-74) tmp = 1.0; elseif (x <= 1.6e-94) tmp = y / (t * (x + 1.0)); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1e-74], 1.0, If[LessEqual[x, 1.6e-94], N[(y / N[(t * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-74}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{-94}:\\
\;\;\;\;\frac{y}{t \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -9.99999999999999958e-75 or 1.59999999999999998e-94 < x Initial program 89.9%
*-commutative89.9%
Simplified89.9%
Taylor expanded in y around inf 78.6%
Taylor expanded in x around inf 76.3%
if -9.99999999999999958e-75 < x < 1.59999999999999998e-94Initial program 91.5%
*-commutative91.5%
Simplified91.5%
Taylor expanded in z around inf 69.4%
Taylor expanded in y around inf 55.3%
+-commutative55.3%
Simplified55.3%
Final simplification69.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3900000000000.0) (not (<= t 3.3e+61))) (/ x (+ x 1.0)) 1.0))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3900000000000.0) || !(t <= 3.3e+61)) {
tmp = x / (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 ((t <= (-3900000000000.0d0)) .or. (.not. (t <= 3.3d+61))) then
tmp = x / (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 ((t <= -3900000000000.0) || !(t <= 3.3e+61)) {
tmp = x / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3900000000000.0) or not (t <= 3.3e+61): tmp = x / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3900000000000.0) || !(t <= 3.3e+61)) tmp = Float64(x / Float64(x + 1.0)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -3900000000000.0) || ~((t <= 3.3e+61))) tmp = x / (x + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3900000000000.0], N[Not[LessEqual[t, 3.3e+61]], $MachinePrecision]], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3900000000000 \lor \neg \left(t \leq 3.3 \cdot 10^{+61}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if t < -3.9e12 or 3.2999999999999998e61 < t Initial program 85.3%
*-commutative85.3%
Simplified85.3%
Taylor expanded in t around inf 65.2%
+-commutative65.2%
Simplified65.2%
if -3.9e12 < t < 3.2999999999999998e61Initial program 94.5%
*-commutative94.5%
Simplified94.5%
Taylor expanded in y around inf 75.8%
Taylor expanded in x around inf 64.2%
Final simplification64.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 90.4%
*-commutative90.4%
Simplified90.4%
Taylor expanded in y around inf 76.3%
Taylor expanded in x around inf 57.0%
Final simplification57.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 2023318
(FPCore (x y z t)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:herbie-target
(/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))