
(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 (- (* y z) x)) (t_2 (- (* z t) x)))
(if (<= (/ (+ x (/ t_1 t_2)) (+ x 1.0)) 2e+298)
(/ (+ x (/ 1.0 (/ t_2 t_1))) (+ x 1.0))
(/ (+ x (/ y t)) (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double t_1 = (y * z) - x;
double t_2 = (z * t) - x;
double tmp;
if (((x + (t_1 / t_2)) / (x + 1.0)) <= 2e+298) {
tmp = (x + (1.0 / (t_2 / t_1))) / (x + 1.0);
} 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) :: t_2
real(8) :: tmp
t_1 = (y * z) - x
t_2 = (z * t) - x
if (((x + (t_1 / t_2)) / (x + 1.0d0)) <= 2d+298) then
tmp = (x + (1.0d0 / (t_2 / t_1))) / (x + 1.0d0)
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 = (y * z) - x;
double t_2 = (z * t) - x;
double tmp;
if (((x + (t_1 / t_2)) / (x + 1.0)) <= 2e+298) {
tmp = (x + (1.0 / (t_2 / t_1))) / (x + 1.0);
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (y * z) - x t_2 = (z * t) - x tmp = 0 if ((x + (t_1 / t_2)) / (x + 1.0)) <= 2e+298: tmp = (x + (1.0 / (t_2 / t_1))) / (x + 1.0) else: tmp = (x + (y / t)) / (x + 1.0) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y * z) - x) t_2 = Float64(Float64(z * t) - x) tmp = 0.0 if (Float64(Float64(x + Float64(t_1 / t_2)) / Float64(x + 1.0)) <= 2e+298) tmp = Float64(Float64(x + Float64(1.0 / Float64(t_2 / t_1))) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y * z) - x; t_2 = (z * t) - x; tmp = 0.0; if (((x + (t_1 / t_2)) / (x + 1.0)) <= 2e+298) tmp = (x + (1.0 / (t_2 / t_1))) / (x + 1.0); else tmp = (x + (y / t)) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]}, If[LessEqual[N[(N[(x + N[(t$95$1 / t$95$2), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 2e+298], N[(N[(x + N[(1.0 / N[(t$95$2 / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot z - x\\
t_2 := z \cdot t - x\\
\mathbf{if}\;\frac{x + \frac{t_1}{t_2}}{x + 1} \leq 2 \cdot 10^{+298}:\\
\;\;\;\;\frac{x + \frac{1}{\frac{t_2}{t_1}}}{x + 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)) < 1.9999999999999999e298Initial program 96.6%
*-commutative96.6%
Simplified96.6%
clear-num96.6%
inv-pow96.6%
fma-neg96.6%
Applied egg-rr96.6%
unpow-196.6%
*-commutative96.6%
fma-neg96.6%
*-commutative96.6%
Simplified96.6%
if 1.9999999999999999e298 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 21.1%
*-commutative21.1%
Simplified21.1%
Taylor expanded in z around inf 80.4%
Final simplification95.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0)))) (if (<= t_1 2e+298) 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 <= 2e+298) {
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 <= 2d+298) 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 <= 2e+298) {
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 <= 2e+298: 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 <= 2e+298) 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 <= 2e+298) 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, 2e+298], 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 2 \cdot 10^{+298}:\\
\;\;\;\;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)) < 1.9999999999999999e298Initial program 96.6%
if 1.9999999999999999e298 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 21.1%
*-commutative21.1%
Simplified21.1%
Taylor expanded in z around inf 80.4%
Final simplification95.4%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.8e-53) (not (<= t 3.1e-46))) (/ (+ 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 <= -3.8e-53) || !(t <= 3.1e-46)) {
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 <= (-3.8d-53)) .or. (.not. (t <= 3.1d-46))) 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 <= -3.8e-53) || !(t <= 3.1e-46)) {
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 <= -3.8e-53) or not (t <= 3.1e-46): 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 <= -3.8e-53) || !(t <= 3.1e-46)) 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 <= -3.8e-53) || ~((t <= 3.1e-46))) 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, -3.8e-53], N[Not[LessEqual[t, 3.1e-46]], $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 -3.8 \cdot 10^{-53} \lor \neg \left(t \leq 3.1 \cdot 10^{-46}\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 < -3.7999999999999998e-53 or 3.1000000000000001e-46 < t Initial program 87.8%
*-commutative87.8%
Simplified87.8%
Taylor expanded in z around inf 93.7%
if -3.7999999999999998e-53 < t < 3.1000000000000001e-46Initial program 95.2%
*-commutative95.2%
Simplified95.2%
Taylor expanded in t around 0 82.6%
associate-+r+82.6%
mul-1-neg82.6%
unsub-neg82.6%
+-commutative82.6%
associate-/l*86.4%
+-commutative86.4%
Simplified86.4%
Final simplification90.8%
(FPCore (x y z t) :precision binary64 (if (or (<= t -8.5e-56) (not (<= t 2.6e-48))) (/ (+ x (/ y t)) (+ x 1.0)) (- 1.0 (* (/ z (+ x 1.0)) (/ y x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -8.5e-56) || !(t <= 2.6e-48)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - ((z / (x + 1.0)) * (y / x));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-8.5d-56)) .or. (.not. (t <= 2.6d-48))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 - ((z / (x + 1.0d0)) * (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -8.5e-56) || !(t <= 2.6e-48)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - ((z / (x + 1.0)) * (y / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -8.5e-56) or not (t <= 2.6e-48): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 - ((z / (x + 1.0)) * (y / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -8.5e-56) || !(t <= 2.6e-48)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 - Float64(Float64(z / Float64(x + 1.0)) * Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -8.5e-56) || ~((t <= 2.6e-48))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 - ((z / (x + 1.0)) * (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -8.5e-56], N[Not[LessEqual[t, 2.6e-48]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(z / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.5 \cdot 10^{-56} \lor \neg \left(t \leq 2.6 \cdot 10^{-48}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{z}{x + 1} \cdot \frac{y}{x}\\
\end{array}
\end{array}
if t < -8.49999999999999932e-56 or 2.59999999999999987e-48 < t Initial program 87.8%
*-commutative87.8%
Simplified87.8%
Taylor expanded in z around inf 93.7%
if -8.49999999999999932e-56 < t < 2.59999999999999987e-48Initial program 95.2%
*-commutative95.2%
Simplified95.2%
Taylor expanded in t around 0 82.6%
associate-+r+82.6%
mul-1-neg82.6%
unsub-neg82.6%
+-commutative82.6%
associate-/l*86.4%
+-commutative86.4%
Simplified86.4%
Taylor expanded in y around 0 82.6%
mul-1-neg82.6%
sub-neg82.6%
times-frac82.8%
+-commutative82.8%
Simplified82.8%
Final simplification89.4%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.16e-54) (not (<= t 4e-44))) (/ (+ x (/ y t)) (+ x 1.0)) (- 1.0 (/ (/ z (+ x 1.0)) (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.16e-54) || !(t <= 4e-44)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - ((z / (x + 1.0)) / (x / y));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-1.16d-54)) .or. (.not. (t <= 4d-44))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 - ((z / (x + 1.0d0)) / (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.16e-54) || !(t <= 4e-44)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - ((z / (x + 1.0)) / (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.16e-54) or not (t <= 4e-44): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 - ((z / (x + 1.0)) / (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.16e-54) || !(t <= 4e-44)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 - Float64(Float64(z / Float64(x + 1.0)) / Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.16e-54) || ~((t <= 4e-44))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 - ((z / (x + 1.0)) / (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.16e-54], N[Not[LessEqual[t, 4e-44]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(z / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.16 \cdot 10^{-54} \lor \neg \left(t \leq 4 \cdot 10^{-44}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{z}{x + 1}}{\frac{x}{y}}\\
\end{array}
\end{array}
if t < -1.16e-54 or 3.99999999999999981e-44 < t Initial program 87.8%
*-commutative87.8%
Simplified87.8%
Taylor expanded in z around inf 93.7%
if -1.16e-54 < t < 3.99999999999999981e-44Initial program 95.2%
*-commutative95.2%
Simplified95.2%
Taylor expanded in t around 0 82.6%
associate-+r+82.6%
mul-1-neg82.6%
unsub-neg82.6%
+-commutative82.6%
associate-/l*86.4%
+-commutative86.4%
Simplified86.4%
Taylor expanded in y around 0 82.6%
mul-1-neg82.6%
sub-neg82.6%
times-frac82.8%
+-commutative82.8%
Simplified82.8%
*-commutative82.8%
clear-num82.7%
un-div-inv83.2%
Applied egg-rr83.2%
Final simplification89.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -6.6e-57) (not (<= t 1e-46))) (/ (+ x (/ y t)) (+ x 1.0)) (- 1.0 (/ (* y z) x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -6.6e-57) || !(t <= 1e-46)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - ((y * z) / x);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-6.6d-57)) .or. (.not. (t <= 1d-46))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 - ((y * z) / x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -6.6e-57) || !(t <= 1e-46)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - ((y * z) / x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -6.6e-57) or not (t <= 1e-46): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 - ((y * z) / x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -6.6e-57) || !(t <= 1e-46)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 - Float64(Float64(y * z) / x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -6.6e-57) || ~((t <= 1e-46))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 - ((y * z) / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -6.6e-57], N[Not[LessEqual[t, 1e-46]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(y * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.6 \cdot 10^{-57} \lor \neg \left(t \leq 10^{-46}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{y \cdot z}{x}\\
\end{array}
\end{array}
if t < -6.5999999999999997e-57 or 1.00000000000000002e-46 < t Initial program 87.8%
*-commutative87.8%
Simplified87.8%
Taylor expanded in z around inf 93.7%
if -6.5999999999999997e-57 < t < 1.00000000000000002e-46Initial program 95.2%
*-commutative95.2%
Simplified95.2%
Taylor expanded in t around 0 82.6%
associate-+r+82.6%
mul-1-neg82.6%
unsub-neg82.6%
+-commutative82.6%
associate-/l*86.4%
+-commutative86.4%
Simplified86.4%
Taylor expanded in y around 0 82.6%
mul-1-neg82.6%
sub-neg82.6%
times-frac82.8%
+-commutative82.8%
Simplified82.8%
Taylor expanded in x around 0 71.4%
Final simplification84.9%
(FPCore (x y z t) :precision binary64 (if (<= x -5e-50) 1.0 (if (<= x -3.4e-118) x (if (<= x 3.75e-93) (/ y t) 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5e-50) {
tmp = 1.0;
} else if (x <= -3.4e-118) {
tmp = x;
} else if (x <= 3.75e-93) {
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 <= (-5d-50)) then
tmp = 1.0d0
else if (x <= (-3.4d-118)) then
tmp = x
else if (x <= 3.75d-93) 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 <= -5e-50) {
tmp = 1.0;
} else if (x <= -3.4e-118) {
tmp = x;
} else if (x <= 3.75e-93) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -5e-50: tmp = 1.0 elif x <= -3.4e-118: tmp = x elif x <= 3.75e-93: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -5e-50) tmp = 1.0; elseif (x <= -3.4e-118) tmp = x; elseif (x <= 3.75e-93) 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 <= -5e-50) tmp = 1.0; elseif (x <= -3.4e-118) tmp = x; elseif (x <= 3.75e-93) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -5e-50], 1.0, If[LessEqual[x, -3.4e-118], x, If[LessEqual[x, 3.75e-93], N[(y / t), $MachinePrecision], 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-50}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -3.4 \cdot 10^{-118}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3.75 \cdot 10^{-93}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -4.99999999999999968e-50 or 3.75000000000000017e-93 < x Initial program 91.2%
*-commutative91.2%
Simplified91.2%
clear-num91.2%
inv-pow91.2%
fma-neg91.2%
Applied egg-rr91.2%
unpow-191.2%
*-commutative91.2%
fma-neg91.2%
*-commutative91.2%
Simplified91.2%
Taylor expanded in z around inf 70.2%
Taylor expanded in x around inf 80.1%
if -4.99999999999999968e-50 < x < -3.39999999999999991e-118Initial program 93.4%
*-commutative93.4%
Simplified93.4%
Taylor expanded in t around inf 55.4%
+-commutative55.4%
Simplified55.4%
Taylor expanded in x around 0 55.4%
if -3.39999999999999991e-118 < x < 3.75000000000000017e-93Initial program 89.2%
*-commutative89.2%
Simplified89.2%
clear-num89.1%
inv-pow89.1%
fma-neg89.1%
Applied egg-rr89.1%
unpow-189.1%
*-commutative89.1%
fma-neg89.1%
*-commutative89.1%
Simplified89.1%
Taylor expanded in x around 0 56.1%
Final simplification71.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.1e-90) (not (<= t 2.7e+34))) (/ x (+ x 1.0)) (- 1.0 (/ (* y z) x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.1e-90) || !(t <= 2.7e+34)) {
tmp = x / (x + 1.0);
} else {
tmp = 1.0 - ((y * z) / x);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-1.1d-90)) .or. (.not. (t <= 2.7d+34))) then
tmp = x / (x + 1.0d0)
else
tmp = 1.0d0 - ((y * z) / x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.1e-90) || !(t <= 2.7e+34)) {
tmp = x / (x + 1.0);
} else {
tmp = 1.0 - ((y * z) / x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.1e-90) or not (t <= 2.7e+34): tmp = x / (x + 1.0) else: tmp = 1.0 - ((y * z) / x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.1e-90) || !(t <= 2.7e+34)) tmp = Float64(x / Float64(x + 1.0)); else tmp = Float64(1.0 - Float64(Float64(y * z) / x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.1e-90) || ~((t <= 2.7e+34))) tmp = x / (x + 1.0); else tmp = 1.0 - ((y * z) / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.1e-90], N[Not[LessEqual[t, 2.7e+34]], $MachinePrecision]], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(y * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.1 \cdot 10^{-90} \lor \neg \left(t \leq 2.7 \cdot 10^{+34}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{y \cdot z}{x}\\
\end{array}
\end{array}
if t < -1.09999999999999993e-90 or 2.7e34 < t Initial program 87.9%
*-commutative87.9%
Simplified87.9%
Taylor expanded in t around inf 77.0%
+-commutative77.0%
Simplified77.0%
if -1.09999999999999993e-90 < t < 2.7e34Initial program 94.6%
*-commutative94.6%
Simplified94.6%
Taylor expanded in t around 0 79.1%
associate-+r+79.1%
mul-1-neg79.1%
unsub-neg79.1%
+-commutative79.1%
associate-/l*82.6%
+-commutative82.6%
Simplified82.6%
Taylor expanded in y around 0 79.0%
mul-1-neg79.0%
sub-neg79.0%
times-frac79.2%
+-commutative79.2%
Simplified79.2%
Taylor expanded in x around 0 68.6%
Final simplification73.4%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.05e-5) (not (<= t 2.6e+29))) (/ x (+ x 1.0)) 1.0))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.05e-5) || !(t <= 2.6e+29)) {
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 <= (-1.05d-5)) .or. (.not. (t <= 2.6d+29))) 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 <= -1.05e-5) || !(t <= 2.6e+29)) {
tmp = x / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.05e-5) or not (t <= 2.6e+29): tmp = x / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.05e-5) || !(t <= 2.6e+29)) 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 <= -1.05e-5) || ~((t <= 2.6e+29))) tmp = x / (x + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.05e-5], N[Not[LessEqual[t, 2.6e+29]], $MachinePrecision]], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.05 \cdot 10^{-5} \lor \neg \left(t \leq 2.6 \cdot 10^{+29}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if t < -1.04999999999999994e-5 or 2.6e29 < t Initial program 86.8%
*-commutative86.8%
Simplified86.8%
Taylor expanded in t around inf 79.1%
+-commutative79.1%
Simplified79.1%
if -1.04999999999999994e-5 < t < 2.6e29Initial program 95.1%
*-commutative95.1%
Simplified95.1%
clear-num95.1%
inv-pow95.1%
fma-neg95.1%
Applied egg-rr95.1%
unpow-195.1%
*-commutative95.1%
fma-neg95.1%
*-commutative95.1%
Simplified95.1%
Taylor expanded in z around inf 49.2%
Taylor expanded in x around inf 60.0%
Final simplification70.0%
(FPCore (x y z t) :precision binary64 (if (<= x -5.1e-50) 1.0 (if (<= x 1.4e-61) x 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5.1e-50) {
tmp = 1.0;
} else if (x <= 1.4e-61) {
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 <= (-5.1d-50)) then
tmp = 1.0d0
else if (x <= 1.4d-61) 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 <= -5.1e-50) {
tmp = 1.0;
} else if (x <= 1.4e-61) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -5.1e-50: tmp = 1.0 elif x <= 1.4e-61: tmp = x else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -5.1e-50) tmp = 1.0; elseif (x <= 1.4e-61) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -5.1e-50) tmp = 1.0; elseif (x <= 1.4e-61) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -5.1e-50], 1.0, If[LessEqual[x, 1.4e-61], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.1 \cdot 10^{-50}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{-61}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -5.10000000000000045e-50 or 1.4000000000000001e-61 < x Initial program 90.9%
*-commutative90.9%
Simplified90.9%
clear-num90.9%
inv-pow90.9%
fma-neg90.9%
Applied egg-rr90.9%
unpow-190.9%
*-commutative90.9%
fma-neg90.9%
*-commutative90.9%
Simplified90.9%
Taylor expanded in z around inf 70.2%
Taylor expanded in x around inf 82.3%
if -5.10000000000000045e-50 < x < 1.4000000000000001e-61Initial program 90.5%
*-commutative90.5%
Simplified90.5%
Taylor expanded in t around inf 34.3%
+-commutative34.3%
Simplified34.3%
Taylor expanded in x around 0 34.3%
Final simplification64.5%
(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.7%
*-commutative90.7%
Simplified90.7%
clear-num90.7%
inv-pow90.7%
fma-neg90.7%
Applied egg-rr90.7%
unpow-190.7%
*-commutative90.7%
fma-neg90.7%
*-commutative90.7%
Simplified90.7%
Taylor expanded in z around inf 73.3%
Taylor expanded in x around inf 55.8%
Final simplification55.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 2024024
(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)))