
(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
(/
(* y (+ (+ (/ x y) (/ z t_1)) (/ x (* y (- x (* z t))))))
(+ x 1.0)))
(t_3 (/ (+ x (/ (- (* y z) x) t_1)) (+ x 1.0))))
(if (<= t_3 -2e+46)
t_2
(if (<= t_3 1e+16)
t_3
(if (<= t_3 INFINITY)
t_2
(+
(/ (+ (/ y (+ x 1.0)) (/ x (* z (- -1.0 x)))) t)
(/ x (+ x 1.0))))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double t_2 = (y * (((x / y) + (z / t_1)) + (x / (y * (x - (z * t)))))) / (x + 1.0);
double t_3 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
double tmp;
if (t_3 <= -2e+46) {
tmp = t_2;
} else if (t_3 <= 1e+16) {
tmp = t_3;
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = (((y / (x + 1.0)) + (x / (z * (-1.0 - x)))) / t) + (x / (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 = (y * (((x / y) + (z / t_1)) + (x / (y * (x - (z * t)))))) / (x + 1.0);
double t_3 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
double tmp;
if (t_3 <= -2e+46) {
tmp = t_2;
} else if (t_3 <= 1e+16) {
tmp = t_3;
} else if (t_3 <= Double.POSITIVE_INFINITY) {
tmp = t_2;
} else {
tmp = (((y / (x + 1.0)) + (x / (z * (-1.0 - x)))) / t) + (x / (x + 1.0));
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * t) - x t_2 = (y * (((x / y) + (z / t_1)) + (x / (y * (x - (z * t)))))) / (x + 1.0) t_3 = (x + (((y * z) - x) / t_1)) / (x + 1.0) tmp = 0 if t_3 <= -2e+46: tmp = t_2 elif t_3 <= 1e+16: tmp = t_3 elif t_3 <= math.inf: tmp = t_2 else: tmp = (((y / (x + 1.0)) + (x / (z * (-1.0 - x)))) / t) + (x / (x + 1.0)) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * t) - x) t_2 = Float64(Float64(y * Float64(Float64(Float64(x / y) + Float64(z / t_1)) + Float64(x / Float64(y * Float64(x - Float64(z * t)))))) / Float64(x + 1.0)) t_3 = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / t_1)) / Float64(x + 1.0)) tmp = 0.0 if (t_3 <= -2e+46) tmp = t_2; elseif (t_3 <= 1e+16) tmp = t_3; elseif (t_3 <= Inf) tmp = t_2; else tmp = Float64(Float64(Float64(Float64(y / Float64(x + 1.0)) + Float64(x / Float64(z * Float64(-1.0 - x)))) / t) + Float64(x / Float64(x + 1.0))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * t) - x; t_2 = (y * (((x / y) + (z / t_1)) + (x / (y * (x - (z * t)))))) / (x + 1.0); t_3 = (x + (((y * z) - x) / t_1)) / (x + 1.0); tmp = 0.0; if (t_3 <= -2e+46) tmp = t_2; elseif (t_3 <= 1e+16) tmp = t_3; elseif (t_3 <= Inf) tmp = t_2; else tmp = (((y / (x + 1.0)) + (x / (z * (-1.0 - x)))) / t) + (x / (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[(y * N[(N[(N[(x / y), $MachinePrecision] + N[(z / t$95$1), $MachinePrecision]), $MachinePrecision] + N[(x / N[(y * N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = 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$3, -2e+46], t$95$2, If[LessEqual[t$95$3, 1e+16], t$95$3, If[LessEqual[t$95$3, Infinity], t$95$2, N[(N[(N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(x / N[(z * N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] + N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot t - x\\
t_2 := \frac{y \cdot \left(\left(\frac{x}{y} + \frac{z}{t\_1}\right) + \frac{x}{y \cdot \left(x - z \cdot t\right)}\right)}{x + 1}\\
t_3 := \frac{x + \frac{y \cdot z - x}{t\_1}}{x + 1}\\
\mathbf{if}\;t\_3 \leq -2 \cdot 10^{+46}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 10^{+16}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{x + 1} + \frac{x}{z \cdot \left(-1 - x\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 #s(literal 1 binary64))) < -2e46 or 1e16 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < +inf.0Initial program 69.9%
*-commutative69.9%
Simplified69.9%
Taylor expanded in y around inf 99.7%
if -2e46 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 1e16Initial program 99.5%
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 t around -inf 100.0%
Final simplification99.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0))))
(if (<= t_1 5e+243)
t_1
(+ (/ (+ (/ y (+ x 1.0)) (/ x (* z (- -1.0 x)))) t) (/ x (+ x 1.0))))))
double code(double x, double y, double z, double t) {
double t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_1 <= 5e+243) {
tmp = t_1;
} else {
tmp = (((y / (x + 1.0)) + (x / (z * (-1.0 - x)))) / 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 + (((y * z) - x) / ((z * t) - x))) / (x + 1.0d0)
if (t_1 <= 5d+243) then
tmp = t_1
else
tmp = (((y / (x + 1.0d0)) + (x / (z * ((-1.0d0) - x)))) / 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 + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_1 <= 5e+243) {
tmp = t_1;
} else {
tmp = (((y / (x + 1.0)) + (x / (z * (-1.0 - x)))) / t) + (x / (x + 1.0));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0) tmp = 0 if t_1 <= 5e+243: tmp = t_1 else: tmp = (((y / (x + 1.0)) + (x / (z * (-1.0 - x)))) / t) + (x / (x + 1.0)) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(z * t) - x))) / Float64(x + 1.0)) tmp = 0.0 if (t_1 <= 5e+243) tmp = t_1; else tmp = Float64(Float64(Float64(Float64(y / Float64(x + 1.0)) + Float64(x / Float64(z * Float64(-1.0 - x)))) / t) + Float64(x / Float64(x + 1.0))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0); tmp = 0.0; if (t_1 <= 5e+243) tmp = t_1; else tmp = (((y / (x + 1.0)) + (x / (z * (-1.0 - x)))) / t) + (x / (x + 1.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+243], t$95$1, N[(N[(N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(x / N[(z * N[(-1.0 - x), $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{y \cdot z - x}{z \cdot t - x}}{x + 1}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{+243}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{x + 1} + \frac{x}{z \cdot \left(-1 - x\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 #s(literal 1 binary64))) < 5.00000000000000037e243Initial program 96.1%
if 5.00000000000000037e243 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 16.7%
*-commutative16.7%
Simplified16.7%
Taylor expanded in t around -inf 78.8%
Final simplification94.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0)))) (if (<= t_1 5e+243) t_1 (/ (+ x (/ y t)) (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_1 <= 5e+243) {
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 + (((y * z) - x) / ((z * t) - x))) / (x + 1.0d0)
if (t_1 <= 5d+243) 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 + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_1 <= 5e+243) {
tmp = t_1;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0) tmp = 0 if t_1 <= 5e+243: 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(Float64(y * z) - x) / Float64(Float64(z * t) - x))) / Float64(x + 1.0)) tmp = 0.0 if (t_1 <= 5e+243) 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 + (((y * z) - x) / ((z * t) - x))) / (x + 1.0); tmp = 0.0; if (t_1 <= 5e+243) 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[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+243], 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{y \cdot z - x}{z \cdot t - x}}{x + 1}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{+243}:\\
\;\;\;\;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 #s(literal 1 binary64))) < 5.00000000000000037e243Initial program 96.1%
if 5.00000000000000037e243 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 16.7%
*-commutative16.7%
Simplified16.7%
Taylor expanded in z around inf 78.6%
Final simplification94.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -5.6e+66) (not (<= t 1.32e-28))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (+ 1.0 (- x (* y (/ z x)))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.6e+66) || !(t <= 1.32e-28)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-5.6d+66)) .or. (.not. (t <= 1.32d-28))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = (1.0d0 + (x - (y * (z / x)))) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.6e+66) || !(t <= 1.32e-28)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -5.6e+66) or not (t <= 1.32e-28): tmp = (x + (y / t)) / (x + 1.0) else: tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -5.6e+66) || !(t <= 1.32e-28)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(1.0 + Float64(x - Float64(y * Float64(z / x)))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -5.6e+66) || ~((t <= 1.32e-28))) tmp = (x + (y / t)) / (x + 1.0); else tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -5.6e+66], N[Not[LessEqual[t, 1.32e-28]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.6 \cdot 10^{+66} \lor \neg \left(t \leq 1.32 \cdot 10^{-28}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - y \cdot \frac{z}{x}\right)}{x + 1}\\
\end{array}
\end{array}
if t < -5.6000000000000001e66 or 1.32000000000000011e-28 < t Initial program 85.8%
*-commutative85.8%
Simplified85.8%
Taylor expanded in z around inf 91.7%
if -5.6000000000000001e66 < t < 1.32000000000000011e-28Initial program 89.8%
*-commutative89.8%
Simplified89.8%
Taylor expanded in t around 0 70.1%
mul-1-neg70.1%
unsub-neg70.1%
associate-/l*76.7%
Simplified76.7%
Final simplification84.5%
(FPCore (x y z t) :precision binary64 (if (<= x -7.5e-33) 1.0 (if (<= x 2.3e-31) (+ x (/ (- y (/ x z)) t)) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.5e-33) {
tmp = 1.0;
} else if (x <= 2.3e-31) {
tmp = x + ((y - (x / z)) / 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 <= (-7.5d-33)) then
tmp = 1.0d0
else if (x <= 2.3d-31) then
tmp = x + ((y - (x / z)) / 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 <= -7.5e-33) {
tmp = 1.0;
} else if (x <= 2.3e-31) {
tmp = x + ((y - (x / z)) / t);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -7.5e-33: tmp = 1.0 elif x <= 2.3e-31: tmp = x + ((y - (x / z)) / t) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -7.5e-33) tmp = 1.0; elseif (x <= 2.3e-31) tmp = Float64(x + Float64(Float64(y - Float64(x / z)) / t)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -7.5e-33) tmp = 1.0; elseif (x <= 2.3e-31) tmp = x + ((y - (x / z)) / t); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -7.5e-33], 1.0, If[LessEqual[x, 2.3e-31], N[(x + N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{-33}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-31}:\\
\;\;\;\;x + \frac{y - \frac{x}{z}}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -7.5000000000000001e-33 or 2.2999999999999998e-31 < x Initial program 84.6%
*-commutative84.6%
Simplified84.6%
Taylor expanded in z around inf 66.4%
div-inv66.3%
Applied egg-rr66.3%
Taylor expanded in x around inf 86.3%
if -7.5000000000000001e-33 < x < 2.2999999999999998e-31Initial program 91.2%
*-commutative91.2%
Simplified91.2%
Taylor expanded in t around -inf 78.8%
mul-1-neg78.8%
unsub-neg78.8%
sub-neg78.8%
mul-1-neg78.8%
remove-double-neg78.8%
+-commutative78.8%
mul-1-neg78.8%
unsub-neg78.8%
Simplified78.8%
Taylor expanded in x around 0 78.8%
Final simplification82.7%
(FPCore (x y z t) :precision binary64 (if (<= x -7500.0) 1.0 (if (<= x 3.6e-31) (/ (+ x (/ y t)) (+ x 1.0)) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7500.0) {
tmp = 1.0;
} else if (x <= 3.6e-31) {
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 <= (-7500.0d0)) then
tmp = 1.0d0
else if (x <= 3.6d-31) 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 <= -7500.0) {
tmp = 1.0;
} else if (x <= 3.6e-31) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -7500.0: tmp = 1.0 elif x <= 3.6e-31: tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -7500.0) tmp = 1.0; elseif (x <= 3.6e-31) 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 <= -7500.0) tmp = 1.0; elseif (x <= 3.6e-31) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -7500.0], 1.0, If[LessEqual[x, 3.6e-31], 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 -7500:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{-31}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -7500 or 3.60000000000000004e-31 < x Initial program 84.0%
*-commutative84.0%
Simplified84.0%
Taylor expanded in z around inf 67.3%
div-inv67.3%
Applied egg-rr67.3%
Taylor expanded in x around inf 88.4%
if -7500 < x < 3.60000000000000004e-31Initial program 91.5%
*-commutative91.5%
Simplified91.5%
Taylor expanded in z around inf 74.1%
(FPCore (x y z t) :precision binary64 (if (<= x -7.6e-33) 1.0 (if (<= x 3.65e-31) (+ x (/ y t)) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.6e-33) {
tmp = 1.0;
} else if (x <= 3.65e-31) {
tmp = x + (y / t);
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-7.6d-33)) then
tmp = 1.0d0
else if (x <= 3.65d-31) then
tmp = x + (y / t)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7.6e-33) {
tmp = 1.0;
} else if (x <= 3.65e-31) {
tmp = x + (y / t);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -7.6e-33: tmp = 1.0 elif x <= 3.65e-31: tmp = x + (y / t) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -7.6e-33) tmp = 1.0; elseif (x <= 3.65e-31) tmp = Float64(x + Float64(y / t)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -7.6e-33) tmp = 1.0; elseif (x <= 3.65e-31) tmp = x + (y / t); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -7.6e-33], 1.0, If[LessEqual[x, 3.65e-31], N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.6 \cdot 10^{-33}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 3.65 \cdot 10^{-31}:\\
\;\;\;\;x + \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -7.59999999999999988e-33 or 3.6500000000000001e-31 < x Initial program 84.6%
*-commutative84.6%
Simplified84.6%
Taylor expanded in z around inf 66.4%
div-inv66.3%
Applied egg-rr66.3%
Taylor expanded in x around inf 86.3%
if -7.59999999999999988e-33 < x < 3.6500000000000001e-31Initial program 91.2%
*-commutative91.2%
Simplified91.2%
Taylor expanded in z around inf 75.5%
Taylor expanded in x around 0 75.5%
Final simplification81.2%
(FPCore (x y z t) :precision binary64 (if (<= x -2.7e-52) (/ x (+ x 1.0)) (if (<= x 3.7e-34) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.7e-52) {
tmp = x / (x + 1.0);
} else if (x <= 3.7e-34) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-2.7d-52)) then
tmp = x / (x + 1.0d0)
else if (x <= 3.7d-34) then
tmp = y / t
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.7e-52) {
tmp = x / (x + 1.0);
} else if (x <= 3.7e-34) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.7e-52: tmp = x / (x + 1.0) elif x <= 3.7e-34: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.7e-52) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 3.7e-34) tmp = Float64(y / t); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.7e-52) tmp = x / (x + 1.0); elseif (x <= 3.7e-34) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.7e-52], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.7e-34], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{-52}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 3.7 \cdot 10^{-34}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -2.70000000000000009e-52Initial program 83.9%
*-commutative83.9%
Simplified83.9%
Taylor expanded in x around inf 85.1%
if -2.70000000000000009e-52 < x < 3.69999999999999988e-34Initial program 90.9%
*-commutative90.9%
Simplified90.9%
Taylor expanded in z around inf 76.5%
div-inv76.4%
Applied egg-rr76.4%
Taylor expanded in x around 0 52.1%
if 3.69999999999999988e-34 < x Initial program 86.2%
*-commutative86.2%
Simplified86.2%
Taylor expanded in z around inf 66.4%
div-inv66.3%
Applied egg-rr66.3%
Taylor expanded in x around inf 84.7%
(FPCore (x y z t) :precision binary64 (if (<= x -4e-33) 1.0 (if (<= x 5.7e-34) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4e-33) {
tmp = 1.0;
} else if (x <= 5.7e-34) {
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 <= (-4d-33)) then
tmp = 1.0d0
else if (x <= 5.7d-34) 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 <= -4e-33) {
tmp = 1.0;
} else if (x <= 5.7e-34) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -4e-33: tmp = 1.0 elif x <= 5.7e-34: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -4e-33) tmp = 1.0; elseif (x <= 5.7e-34) 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 <= -4e-33) tmp = 1.0; elseif (x <= 5.7e-34) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -4e-33], 1.0, If[LessEqual[x, 5.7e-34], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-33}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 5.7 \cdot 10^{-34}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -4.0000000000000002e-33 or 5.69999999999999974e-34 < x Initial program 84.6%
*-commutative84.6%
Simplified84.6%
Taylor expanded in z around inf 66.4%
div-inv66.3%
Applied egg-rr66.3%
Taylor expanded in x around inf 86.3%
if -4.0000000000000002e-33 < x < 5.69999999999999974e-34Initial program 91.2%
*-commutative91.2%
Simplified91.2%
Taylor expanded in z around inf 75.5%
div-inv75.4%
Applied egg-rr75.4%
Taylor expanded in x around 0 50.9%
(FPCore (x y z t) :precision binary64 (if (<= x -2.2e-41) 1.0 (if (<= x 8.6e-33) x 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.2e-41) {
tmp = 1.0;
} else if (x <= 8.6e-33) {
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 <= (-2.2d-41)) then
tmp = 1.0d0
else if (x <= 8.6d-33) 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 <= -2.2e-41) {
tmp = 1.0;
} else if (x <= 8.6e-33) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.2e-41: tmp = 1.0 elif x <= 8.6e-33: tmp = x else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.2e-41) tmp = 1.0; elseif (x <= 8.6e-33) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.2e-41) tmp = 1.0; elseif (x <= 8.6e-33) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.2e-41], 1.0, If[LessEqual[x, 8.6e-33], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{-41}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 8.6 \cdot 10^{-33}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -2.2e-41 or 8.60000000000000062e-33 < x Initial program 84.6%
*-commutative84.6%
Simplified84.6%
Taylor expanded in z around inf 66.4%
div-inv66.3%
Applied egg-rr66.3%
Taylor expanded in x around inf 86.3%
if -2.2e-41 < x < 8.60000000000000062e-33Initial program 91.2%
*-commutative91.2%
Simplified91.2%
Taylor expanded in x around inf 26.3%
Taylor expanded in x around 0 26.3%
Final simplification57.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 87.7%
*-commutative87.7%
Simplified87.7%
Taylor expanded in z around inf 70.7%
div-inv70.6%
Applied egg-rr70.6%
Taylor expanded in x around inf 52.8%
(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 2024116
(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)))