
(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 11 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 2000000000000.0)
t_2
(if (<= t_2 INFINITY)
(/ (/ y (+ x 1.0)) (/ t_1 z))
(/ (+ 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 <= 2000000000000.0) {
tmp = t_2;
} else if (t_2 <= ((double) INFINITY)) {
tmp = (y / (x + 1.0)) / (t_1 / z);
} 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 <= 2000000000000.0) {
tmp = t_2;
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = (y / (x + 1.0)) / (t_1 / z);
} 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 <= 2000000000000.0: tmp = t_2 elif t_2 <= math.inf: tmp = (y / (x + 1.0)) / (t_1 / z) 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 <= 2000000000000.0) tmp = t_2; elseif (t_2 <= Inf) tmp = Float64(Float64(y / Float64(x + 1.0)) / Float64(t_1 / z)); 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 <= 2000000000000.0) tmp = t_2; elseif (t_2 <= Inf) tmp = (y / (x + 1.0)) / (t_1 / z); 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, 2000000000000.0], t$95$2, If[LessEqual[t$95$2, Infinity], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision], 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 2000000000000:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_2 \leq \infty:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{\frac{t_1}{z}}\\
\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)) < 2e12Initial program 96.2%
if 2e12 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < +inf.0Initial program 73.3%
*-commutative73.3%
Simplified73.3%
Taylor expanded in y around inf 72.9%
*-commutative72.9%
*-commutative72.9%
times-frac97.3%
+-commutative97.3%
*-commutative97.3%
Simplified97.3%
Taylor expanded in y around 0 72.9%
associate-/l*89.9%
+-commutative89.9%
associate-*l/97.5%
associate-/l/97.5%
Simplified97.5%
if +inf.0 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in z around inf 100.0%
Final simplification96.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ z (- (* z t) x)))))
(if (<= x -7.5e-20)
1.0
(if (<= x -4.9e-86)
t_1
(if (<= x -2.45e-121)
x
(if (<= x 1.95e-54)
t_1
(if (or (<= x 2.15e+23) (not (<= x 9.8e+54)))
(- 1.0 (* (/ y x) (/ z x)))
(+ 1.0 (/ (+ (/ y t) -1.0) x)))))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z / ((z * t) - x));
double tmp;
if (x <= -7.5e-20) {
tmp = 1.0;
} else if (x <= -4.9e-86) {
tmp = t_1;
} else if (x <= -2.45e-121) {
tmp = x;
} else if (x <= 1.95e-54) {
tmp = t_1;
} else if ((x <= 2.15e+23) || !(x <= 9.8e+54)) {
tmp = 1.0 - ((y / x) * (z / x));
} else {
tmp = 1.0 + (((y / t) + -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) :: t_1
real(8) :: tmp
t_1 = y * (z / ((z * t) - x))
if (x <= (-7.5d-20)) then
tmp = 1.0d0
else if (x <= (-4.9d-86)) then
tmp = t_1
else if (x <= (-2.45d-121)) then
tmp = x
else if (x <= 1.95d-54) then
tmp = t_1
else if ((x <= 2.15d+23) .or. (.not. (x <= 9.8d+54))) then
tmp = 1.0d0 - ((y / x) * (z / x))
else
tmp = 1.0d0 + (((y / t) + (-1.0d0)) / x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (z / ((z * t) - x));
double tmp;
if (x <= -7.5e-20) {
tmp = 1.0;
} else if (x <= -4.9e-86) {
tmp = t_1;
} else if (x <= -2.45e-121) {
tmp = x;
} else if (x <= 1.95e-54) {
tmp = t_1;
} else if ((x <= 2.15e+23) || !(x <= 9.8e+54)) {
tmp = 1.0 - ((y / x) * (z / x));
} else {
tmp = 1.0 + (((y / t) + -1.0) / x);
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z / ((z * t) - x)) tmp = 0 if x <= -7.5e-20: tmp = 1.0 elif x <= -4.9e-86: tmp = t_1 elif x <= -2.45e-121: tmp = x elif x <= 1.95e-54: tmp = t_1 elif (x <= 2.15e+23) or not (x <= 9.8e+54): tmp = 1.0 - ((y / x) * (z / x)) else: tmp = 1.0 + (((y / t) + -1.0) / x) return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z / Float64(Float64(z * t) - x))) tmp = 0.0 if (x <= -7.5e-20) tmp = 1.0; elseif (x <= -4.9e-86) tmp = t_1; elseif (x <= -2.45e-121) tmp = x; elseif (x <= 1.95e-54) tmp = t_1; elseif ((x <= 2.15e+23) || !(x <= 9.8e+54)) tmp = Float64(1.0 - Float64(Float64(y / x) * Float64(z / x))); else tmp = Float64(1.0 + Float64(Float64(Float64(y / t) + -1.0) / x)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z / ((z * t) - x)); tmp = 0.0; if (x <= -7.5e-20) tmp = 1.0; elseif (x <= -4.9e-86) tmp = t_1; elseif (x <= -2.45e-121) tmp = x; elseif (x <= 1.95e-54) tmp = t_1; elseif ((x <= 2.15e+23) || ~((x <= 9.8e+54))) tmp = 1.0 - ((y / x) * (z / x)); else tmp = 1.0 + (((y / t) + -1.0) / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7.5e-20], 1.0, If[LessEqual[x, -4.9e-86], t$95$1, If[LessEqual[x, -2.45e-121], x, If[LessEqual[x, 1.95e-54], t$95$1, If[Or[LessEqual[x, 2.15e+23], N[Not[LessEqual[x, 9.8e+54]], $MachinePrecision]], N[(1.0 - N[(N[(y / x), $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(N[(y / t), $MachinePrecision] + -1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{z \cdot t - x}\\
\mathbf{if}\;x \leq -7.5 \cdot 10^{-20}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -4.9 \cdot 10^{-86}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -2.45 \cdot 10^{-121}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{-54}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2.15 \cdot 10^{+23} \lor \neg \left(x \leq 9.8 \cdot 10^{+54}\right):\\
\;\;\;\;1 - \frac{y}{x} \cdot \frac{z}{x}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{y}{t} + -1}{x}\\
\end{array}
\end{array}
if x < -7.49999999999999981e-20Initial program 94.5%
*-commutative94.5%
Simplified94.5%
Taylor expanded in z around inf 73.4%
clear-num73.4%
inv-pow73.4%
+-commutative73.4%
+-commutative73.4%
Applied egg-rr73.4%
unpow-173.4%
Simplified73.4%
Taylor expanded in x around inf 94.3%
if -7.49999999999999981e-20 < x < -4.89999999999999972e-86 or -2.45e-121 < x < 1.95e-54Initial program 87.2%
*-commutative87.2%
Simplified87.2%
Taylor expanded in y around inf 53.5%
*-commutative53.5%
*-commutative53.5%
times-frac59.0%
+-commutative59.0%
*-commutative59.0%
Simplified59.0%
Taylor expanded in x around 0 59.0%
if -4.89999999999999972e-86 < x < -2.45e-121Initial program 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in t around inf 73.6%
+-commutative73.6%
Simplified73.6%
Taylor expanded in x around 0 73.6%
if 1.95e-54 < x < 2.1499999999999999e23 or 9.80000000000000002e54 < x Initial program 87.9%
*-commutative87.9%
Simplified87.9%
Taylor expanded in t around 0 84.2%
+-commutative84.2%
+-commutative84.2%
associate-+l+84.2%
+-commutative84.2%
mul-1-neg84.2%
unsub-neg84.2%
associate-/l*91.7%
+-commutative91.7%
Simplified91.7%
Taylor expanded in x around inf 83.4%
mul-1-neg83.4%
unpow283.4%
associate-/l*87.4%
associate-*r/91.0%
unsub-neg91.0%
associate-*r/87.4%
associate-/l*83.4%
times-frac91.0%
Simplified91.0%
if 2.1499999999999999e23 < x < 9.80000000000000002e54Initial program 79.9%
*-commutative79.9%
Simplified79.9%
Taylor expanded in z around inf 88.9%
Taylor expanded in x around -inf 88.9%
+-commutative88.9%
mul-1-neg88.9%
unsub-neg88.9%
mul-1-neg88.9%
sub-neg88.9%
Simplified88.9%
Final simplification76.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ z (- (* z t) x)))))
(if (<= x -1.7e-18)
1.0
(if (<= x -2e-86)
t_1
(if (<= x -1.52e-121) x (if (<= x 4.3e-109) t_1 1.0))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z / ((z * t) - x));
double tmp;
if (x <= -1.7e-18) {
tmp = 1.0;
} else if (x <= -2e-86) {
tmp = t_1;
} else if (x <= -1.52e-121) {
tmp = x;
} else if (x <= 4.3e-109) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = y * (z / ((z * t) - x))
if (x <= (-1.7d-18)) then
tmp = 1.0d0
else if (x <= (-2d-86)) then
tmp = t_1
else if (x <= (-1.52d-121)) then
tmp = x
else if (x <= 4.3d-109) then
tmp = t_1
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (z / ((z * t) - x));
double tmp;
if (x <= -1.7e-18) {
tmp = 1.0;
} else if (x <= -2e-86) {
tmp = t_1;
} else if (x <= -1.52e-121) {
tmp = x;
} else if (x <= 4.3e-109) {
tmp = t_1;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z / ((z * t) - x)) tmp = 0 if x <= -1.7e-18: tmp = 1.0 elif x <= -2e-86: tmp = t_1 elif x <= -1.52e-121: tmp = x elif x <= 4.3e-109: tmp = t_1 else: tmp = 1.0 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z / Float64(Float64(z * t) - x))) tmp = 0.0 if (x <= -1.7e-18) tmp = 1.0; elseif (x <= -2e-86) tmp = t_1; elseif (x <= -1.52e-121) tmp = x; elseif (x <= 4.3e-109) tmp = t_1; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z / ((z * t) - x)); tmp = 0.0; if (x <= -1.7e-18) tmp = 1.0; elseif (x <= -2e-86) tmp = t_1; elseif (x <= -1.52e-121) tmp = x; elseif (x <= 4.3e-109) tmp = t_1; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.7e-18], 1.0, If[LessEqual[x, -2e-86], t$95$1, If[LessEqual[x, -1.52e-121], x, If[LessEqual[x, 4.3e-109], t$95$1, 1.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{z \cdot t - x}\\
\mathbf{if}\;x \leq -1.7 \cdot 10^{-18}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -2 \cdot 10^{-86}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.52 \cdot 10^{-121}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 4.3 \cdot 10^{-109}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.70000000000000001e-18 or 4.2999999999999997e-109 < x Initial program 89.7%
*-commutative89.7%
Simplified89.7%
Taylor expanded in z around inf 70.5%
clear-num70.5%
inv-pow70.5%
+-commutative70.5%
+-commutative70.5%
Applied egg-rr70.5%
unpow-170.5%
Simplified70.5%
Taylor expanded in x around inf 82.6%
if -1.70000000000000001e-18 < x < -2.00000000000000017e-86 or -1.52e-121 < x < 4.2999999999999997e-109Initial program 87.4%
*-commutative87.4%
Simplified87.4%
Taylor expanded in y around inf 56.5%
*-commutative56.5%
*-commutative56.5%
times-frac61.8%
+-commutative61.8%
*-commutative61.8%
Simplified61.8%
Taylor expanded in x around 0 61.8%
if -2.00000000000000017e-86 < x < -1.52e-121Initial program 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in t around inf 73.6%
+-commutative73.6%
Simplified73.6%
Taylor expanded in x around 0 73.6%
Final simplification73.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ z (- (* z t) x)))))
(if (<= x -1.3e-19)
1.0
(if (<= x -1.7e-86)
t_1
(if (<= x -2.45e-121)
x
(if (<= x 2.9e-54) t_1 (- 1.0 (* (/ y x) (/ z x)))))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z / ((z * t) - x));
double tmp;
if (x <= -1.3e-19) {
tmp = 1.0;
} else if (x <= -1.7e-86) {
tmp = t_1;
} else if (x <= -2.45e-121) {
tmp = x;
} else if (x <= 2.9e-54) {
tmp = t_1;
} else {
tmp = 1.0 - ((y / x) * (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) :: t_1
real(8) :: tmp
t_1 = y * (z / ((z * t) - x))
if (x <= (-1.3d-19)) then
tmp = 1.0d0
else if (x <= (-1.7d-86)) then
tmp = t_1
else if (x <= (-2.45d-121)) then
tmp = x
else if (x <= 2.9d-54) then
tmp = t_1
else
tmp = 1.0d0 - ((y / x) * (z / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (z / ((z * t) - x));
double tmp;
if (x <= -1.3e-19) {
tmp = 1.0;
} else if (x <= -1.7e-86) {
tmp = t_1;
} else if (x <= -2.45e-121) {
tmp = x;
} else if (x <= 2.9e-54) {
tmp = t_1;
} else {
tmp = 1.0 - ((y / x) * (z / x));
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z / ((z * t) - x)) tmp = 0 if x <= -1.3e-19: tmp = 1.0 elif x <= -1.7e-86: tmp = t_1 elif x <= -2.45e-121: tmp = x elif x <= 2.9e-54: tmp = t_1 else: tmp = 1.0 - ((y / x) * (z / x)) return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z / Float64(Float64(z * t) - x))) tmp = 0.0 if (x <= -1.3e-19) tmp = 1.0; elseif (x <= -1.7e-86) tmp = t_1; elseif (x <= -2.45e-121) tmp = x; elseif (x <= 2.9e-54) tmp = t_1; else tmp = Float64(1.0 - Float64(Float64(y / x) * Float64(z / x))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z / ((z * t) - x)); tmp = 0.0; if (x <= -1.3e-19) tmp = 1.0; elseif (x <= -1.7e-86) tmp = t_1; elseif (x <= -2.45e-121) tmp = x; elseif (x <= 2.9e-54) tmp = t_1; else tmp = 1.0 - ((y / x) * (z / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.3e-19], 1.0, If[LessEqual[x, -1.7e-86], t$95$1, If[LessEqual[x, -2.45e-121], x, If[LessEqual[x, 2.9e-54], t$95$1, N[(1.0 - N[(N[(y / x), $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{z \cdot t - x}\\
\mathbf{if}\;x \leq -1.3 \cdot 10^{-19}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -1.7 \cdot 10^{-86}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -2.45 \cdot 10^{-121}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{-54}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{y}{x} \cdot \frac{z}{x}\\
\end{array}
\end{array}
if x < -1.30000000000000006e-19Initial program 94.5%
*-commutative94.5%
Simplified94.5%
Taylor expanded in z around inf 73.4%
clear-num73.4%
inv-pow73.4%
+-commutative73.4%
+-commutative73.4%
Applied egg-rr73.4%
unpow-173.4%
Simplified73.4%
Taylor expanded in x around inf 94.3%
if -1.30000000000000006e-19 < x < -1.7e-86 or -2.45e-121 < x < 2.90000000000000015e-54Initial program 87.2%
*-commutative87.2%
Simplified87.2%
Taylor expanded in y around inf 53.5%
*-commutative53.5%
*-commutative53.5%
times-frac59.0%
+-commutative59.0%
*-commutative59.0%
Simplified59.0%
Taylor expanded in x around 0 59.0%
if -1.7e-86 < x < -2.45e-121Initial program 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in t around inf 73.6%
+-commutative73.6%
Simplified73.6%
Taylor expanded in x around 0 73.6%
if 2.90000000000000015e-54 < x Initial program 86.9%
*-commutative86.9%
Simplified86.9%
Taylor expanded in t around 0 76.0%
+-commutative76.0%
+-commutative76.0%
associate-+l+76.0%
+-commutative76.0%
mul-1-neg76.0%
unsub-neg76.0%
associate-/l*82.5%
+-commutative82.5%
Simplified82.5%
Taylor expanded in x around inf 75.2%
mul-1-neg75.2%
unpow275.2%
associate-/l*79.8%
associate-*r/83.1%
unsub-neg83.1%
associate-*r/79.8%
associate-/l*75.2%
times-frac83.0%
Simplified83.0%
Final simplification73.8%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.7e-66) (not (<= t 3.8e+19))) (/ (+ 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 <= -2.7e-66) || !(t <= 3.8e+19)) {
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 <= (-2.7d-66)) .or. (.not. (t <= 3.8d+19))) 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 <= -2.7e-66) || !(t <= 3.8e+19)) {
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 <= -2.7e-66) or not (t <= 3.8e+19): 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 <= -2.7e-66) || !(t <= 3.8e+19)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(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 <= -2.7e-66) || ~((t <= 3.8e+19))) 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, -2.7e-66], N[Not[LessEqual[t, 3.8e+19]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(1.0 - N[(y / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.7 \cdot 10^{-66} \lor \neg \left(t \leq 3.8 \cdot 10^{+19}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \left(1 - \frac{y}{\frac{x}{z}}\right)}{x + 1}\\
\end{array}
\end{array}
if t < -2.69999999999999996e-66 or 3.8e19 < t Initial program 86.1%
*-commutative86.1%
Simplified86.1%
Taylor expanded in z around inf 87.7%
if -2.69999999999999996e-66 < t < 3.8e19Initial program 92.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in t around 0 75.1%
+-commutative75.1%
+-commutative75.1%
associate-+l+75.1%
+-commutative75.1%
mul-1-neg75.1%
unsub-neg75.1%
associate-/l*79.3%
+-commutative79.3%
Simplified79.3%
Final simplification83.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -9.8e-67) (not (<= t 1.5e+19))) (/ (+ x (/ y t)) (+ x 1.0)) (- 1.0 (* (/ y x) (/ z (+ x 1.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -9.8e-67) || !(t <= 1.5e+19)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 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 <= (-9.8d-67)) .or. (.not. (t <= 1.5d+19))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 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 <= -9.8e-67) || !(t <= 1.5e+19)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - ((y / x) * (z / (x + 1.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -9.8e-67) or not (t <= 1.5e+19): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 - ((y / x) * (z / (x + 1.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -9.8e-67) || !(t <= 1.5e+19)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 - Float64(Float64(y / x) * Float64(z / Float64(x + 1.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -9.8e-67) || ~((t <= 1.5e+19))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 - ((y / x) * (z / (x + 1.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -9.8e-67], N[Not[LessEqual[t, 1.5e+19]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(y / x), $MachinePrecision] * N[(z / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.8 \cdot 10^{-67} \lor \neg \left(t \leq 1.5 \cdot 10^{+19}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{y}{x} \cdot \frac{z}{x + 1}\\
\end{array}
\end{array}
if t < -9.79999999999999987e-67 or 1.5e19 < t Initial program 86.1%
*-commutative86.1%
Simplified86.1%
Taylor expanded in z around inf 87.7%
if -9.79999999999999987e-67 < t < 1.5e19Initial program 92.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in t around 0 75.1%
+-commutative75.1%
+-commutative75.1%
associate-+l+75.1%
+-commutative75.1%
mul-1-neg75.1%
unsub-neg75.1%
associate-/l*79.3%
+-commutative79.3%
Simplified79.3%
Taylor expanded in y around 0 75.0%
mul-1-neg75.0%
unsub-neg75.0%
+-commutative75.0%
*-commutative75.0%
times-frac75.0%
+-commutative75.0%
Simplified75.0%
Final simplification82.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5e-112) (not (<= z 1.8e-72))) (/ (+ x (/ y t)) (+ x 1.0)) 1.0))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5e-112) || !(z <= 1.8e-72)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-5d-112)) .or. (.not. (z <= 1.8d-72))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5e-112) || !(z <= 1.8e-72)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5e-112) or not (z <= 1.8e-72): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5e-112) || !(z <= 1.8e-72)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5e-112) || ~((z <= 1.8e-72))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5e-112], N[Not[LessEqual[z, 1.8e-72]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{-112} \lor \neg \left(z \leq 1.8 \cdot 10^{-72}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if z < -5.00000000000000044e-112 or 1.8e-72 < z Initial program 81.1%
*-commutative81.1%
Simplified81.1%
Taylor expanded in z around inf 83.6%
if -5.00000000000000044e-112 < z < 1.8e-72Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 49.5%
clear-num49.5%
inv-pow49.5%
+-commutative49.5%
+-commutative49.5%
Applied egg-rr49.5%
unpow-149.5%
Simplified49.5%
Taylor expanded in x around inf 71.9%
Final simplification78.7%
(FPCore (x y z t) :precision binary64 (if (<= x -2.6e-52) 1.0 (if (<= x 3e-110) (/ (- y (* x y)) t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.6e-52) {
tmp = 1.0;
} else if (x <= 3e-110) {
tmp = (y - (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 <= (-2.6d-52)) then
tmp = 1.0d0
else if (x <= 3d-110) then
tmp = (y - (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 <= -2.6e-52) {
tmp = 1.0;
} else if (x <= 3e-110) {
tmp = (y - (x * y)) / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.6e-52: tmp = 1.0 elif x <= 3e-110: tmp = (y - (x * y)) / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.6e-52) tmp = 1.0; elseif (x <= 3e-110) tmp = Float64(Float64(y - Float64(x * y)) / t); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.6e-52) tmp = 1.0; elseif (x <= 3e-110) tmp = (y - (x * y)) / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.6e-52], 1.0, If[LessEqual[x, 3e-110], N[(N[(y - N[(x * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{-52}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 3 \cdot 10^{-110}:\\
\;\;\;\;\frac{y - x \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -2.5999999999999999e-52 or 2.99999999999999986e-110 < x Initial program 89.8%
*-commutative89.8%
Simplified89.8%
Taylor expanded in z around inf 67.8%
clear-num67.8%
inv-pow67.8%
+-commutative67.8%
+-commutative67.8%
Applied egg-rr67.8%
unpow-167.8%
Simplified67.8%
Taylor expanded in x around inf 78.2%
if -2.5999999999999999e-52 < x < 2.99999999999999986e-110Initial program 87.6%
*-commutative87.6%
Simplified87.6%
Taylor expanded in z around inf 71.7%
Taylor expanded in y around inf 58.3%
associate-/r*58.3%
+-commutative58.3%
Simplified58.3%
Taylor expanded in x around 0 58.3%
mul-1-neg58.3%
unsub-neg58.3%
Simplified58.3%
Final simplification70.3%
(FPCore (x y z t) :precision binary64 (if (<= x -2.1e-52) 1.0 (if (<= x 4.3e-109) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.1e-52) {
tmp = 1.0;
} else if (x <= 4.3e-109) {
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.1d-52)) then
tmp = 1.0d0
else if (x <= 4.3d-109) 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.1e-52) {
tmp = 1.0;
} else if (x <= 4.3e-109) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.1e-52: tmp = 1.0 elif x <= 4.3e-109: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.1e-52) tmp = 1.0; elseif (x <= 4.3e-109) 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.1e-52) tmp = 1.0; elseif (x <= 4.3e-109) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.1e-52], 1.0, If[LessEqual[x, 4.3e-109], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{-52}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 4.3 \cdot 10^{-109}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -2.0999999999999999e-52 or 4.2999999999999997e-109 < x Initial program 89.8%
*-commutative89.8%
Simplified89.8%
Taylor expanded in z around inf 67.8%
clear-num67.8%
inv-pow67.8%
+-commutative67.8%
+-commutative67.8%
Applied egg-rr67.8%
unpow-167.8%
Simplified67.8%
Taylor expanded in x around inf 78.2%
if -2.0999999999999999e-52 < x < 4.2999999999999997e-109Initial program 87.6%
*-commutative87.6%
Simplified87.6%
clear-num87.5%
inv-pow87.5%
Applied egg-rr87.5%
unpow-187.5%
*-commutative87.5%
*-commutative87.5%
Simplified87.5%
Taylor expanded in x around 0 58.3%
Final simplification70.3%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
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
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 89.0%
*-commutative89.0%
Simplified89.0%
Taylor expanded in t around inf 49.4%
+-commutative49.4%
Simplified49.4%
Taylor expanded in x around 0 11.0%
Final simplification11.0%
(FPCore (x y z t) :precision binary64 1.0)
double code(double x, double y, double z, double t) {
return 1.0;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0
end function
public static double code(double x, double y, double z, double t) {
return 1.0;
}
def code(x, y, z, t): return 1.0
function code(x, y, z, t) return 1.0 end
function tmp = code(x, y, z, t) tmp = 1.0; end
code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 89.0%
*-commutative89.0%
Simplified89.0%
Taylor expanded in z around inf 69.3%
clear-num69.3%
inv-pow69.3%
+-commutative69.3%
+-commutative69.3%
Applied egg-rr69.3%
unpow-169.3%
Simplified69.3%
Taylor expanded in x around inf 53.3%
Final simplification53.3%
(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 2023240
(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)))