
(FPCore (x y z t) :precision binary64 (- 1.0 (/ x (* (- y z) (- y t)))))
double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
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 - (x / ((y - z) * (y - t)))
end function
public static double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
def code(x, y, z, t): return 1.0 - (x / ((y - z) * (y - t)))
function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t)))) end
function tmp = code(x, y, z, t) tmp = 1.0 - (x / ((y - z) * (y - t))); end
code[x_, y_, z_, t_] := N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- 1.0 (/ x (* (- y z) (- y t)))))
double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
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 - (x / ((y - z) * (y - t)))
end function
public static double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
def code(x, y, z, t): return 1.0 - (x / ((y - z) * (y - t)))
function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t)))) end
function tmp = code(x, y, z, t) tmp = 1.0 - (x / ((y - z) * (y - t))); end
code[x_, y_, z_, t_] := N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}
\end{array}
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (let* ((t_1 (cbrt (- y z)))) (- 1.0 (/ (/ x (* (- y t) t_1)) (pow t_1 2.0)))))
assert(z < t);
double code(double x, double y, double z, double t) {
double t_1 = cbrt((y - z));
return 1.0 - ((x / ((y - t) * t_1)) / pow(t_1, 2.0));
}
assert z < t;
public static double code(double x, double y, double z, double t) {
double t_1 = Math.cbrt((y - z));
return 1.0 - ((x / ((y - t) * t_1)) / Math.pow(t_1, 2.0));
}
z, t = sort([z, t]) function code(x, y, z, t) t_1 = cbrt(Float64(y - z)) return Float64(1.0 - Float64(Float64(x / Float64(Float64(y - t) * t_1)) / (t_1 ^ 2.0))) end
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Power[N[(y - z), $MachinePrecision], 1/3], $MachinePrecision]}, N[(1.0 - N[(N[(x / N[(N[(y - t), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] / N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \sqrt[3]{y - z}\\
1 - \frac{\frac{x}{\left(y - t\right) \cdot t_1}}{{t_1}^{2}}
\end{array}
\end{array}
Initial program 98.5%
associate-/l/99.2%
div-inv99.2%
add-cube-cbrt98.8%
times-frac99.2%
pow299.2%
Applied egg-rr99.2%
associate-*l/99.2%
associate-/l/99.2%
associate-*r/99.2%
*-rgt-identity99.2%
*-commutative99.2%
Simplified99.2%
Final simplification99.2%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= y -1.05e-112) (not (<= y 7.2e-65))) (- 1.0 (/ x (* y (- y z)))) (- 1.0 (/ x (* t z)))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.05e-112) || !(y <= 7.2e-65)) {
tmp = 1.0 - (x / (y * (y - z)));
} else {
tmp = 1.0 - (x / (t * z));
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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 ((y <= (-1.05d-112)) .or. (.not. (y <= 7.2d-65))) then
tmp = 1.0d0 - (x / (y * (y - z)))
else
tmp = 1.0d0 - (x / (t * z))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.05e-112) || !(y <= 7.2e-65)) {
tmp = 1.0 - (x / (y * (y - z)));
} else {
tmp = 1.0 - (x / (t * z));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if (y <= -1.05e-112) or not (y <= 7.2e-65): tmp = 1.0 - (x / (y * (y - z))) else: tmp = 1.0 - (x / (t * z)) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if ((y <= -1.05e-112) || !(y <= 7.2e-65)) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - z)))); else tmp = Float64(1.0 - Float64(x / Float64(t * z))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((y <= -1.05e-112) || ~((y <= 7.2e-65)))
tmp = 1.0 - (x / (y * (y - z)));
else
tmp = 1.0 - (x / (t * z));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.05e-112], N[Not[LessEqual[y, 7.2e-65]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{-112} \lor \neg \left(y \leq 7.2 \cdot 10^{-65}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\end{array}
\end{array}
if y < -1.05e-112 or 7.1999999999999996e-65 < y Initial program 99.7%
Taylor expanded in t around 0 90.6%
if -1.05e-112 < y < 7.1999999999999996e-65Initial program 96.1%
Taylor expanded in y around 0 74.3%
Final simplification85.0%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= y -4.8e-124) (not (<= y 5.6e-161))) (- 1.0 (/ x (* y (- y t)))) (- 1.0 (/ x (* t z)))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.8e-124) || !(y <= 5.6e-161)) {
tmp = 1.0 - (x / (y * (y - t)));
} else {
tmp = 1.0 - (x / (t * z));
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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 ((y <= (-4.8d-124)) .or. (.not. (y <= 5.6d-161))) then
tmp = 1.0d0 - (x / (y * (y - t)))
else
tmp = 1.0d0 - (x / (t * z))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.8e-124) || !(y <= 5.6e-161)) {
tmp = 1.0 - (x / (y * (y - t)));
} else {
tmp = 1.0 - (x / (t * z));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if (y <= -4.8e-124) or not (y <= 5.6e-161): tmp = 1.0 - (x / (y * (y - t))) else: tmp = 1.0 - (x / (t * z)) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if ((y <= -4.8e-124) || !(y <= 5.6e-161)) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - t)))); else tmp = Float64(1.0 - Float64(x / Float64(t * z))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((y <= -4.8e-124) || ~((y <= 5.6e-161)))
tmp = 1.0 - (x / (y * (y - t)));
else
tmp = 1.0 - (x / (t * z));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4.8e-124], N[Not[LessEqual[y, 5.6e-161]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{-124} \lor \neg \left(y \leq 5.6 \cdot 10^{-161}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\end{array}
\end{array}
if y < -4.79999999999999985e-124 or 5.59999999999999984e-161 < y Initial program 99.4%
Taylor expanded in z around 0 89.6%
if -4.79999999999999985e-124 < y < 5.59999999999999984e-161Initial program 95.7%
Taylor expanded in y around 0 83.3%
Final simplification88.0%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= y -1.05e-123) (not (<= y 5.6e-161))) (- 1.0 (/ (/ x y) (- y t))) (- 1.0 (/ x (* t z)))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.05e-123) || !(y <= 5.6e-161)) {
tmp = 1.0 - ((x / y) / (y - t));
} else {
tmp = 1.0 - (x / (t * z));
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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 ((y <= (-1.05d-123)) .or. (.not. (y <= 5.6d-161))) then
tmp = 1.0d0 - ((x / y) / (y - t))
else
tmp = 1.0d0 - (x / (t * z))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.05e-123) || !(y <= 5.6e-161)) {
tmp = 1.0 - ((x / y) / (y - t));
} else {
tmp = 1.0 - (x / (t * z));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if (y <= -1.05e-123) or not (y <= 5.6e-161): tmp = 1.0 - ((x / y) / (y - t)) else: tmp = 1.0 - (x / (t * z)) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if ((y <= -1.05e-123) || !(y <= 5.6e-161)) tmp = Float64(1.0 - Float64(Float64(x / y) / Float64(y - t))); else tmp = Float64(1.0 - Float64(x / Float64(t * z))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((y <= -1.05e-123) || ~((y <= 5.6e-161)))
tmp = 1.0 - ((x / y) / (y - t));
else
tmp = 1.0 - (x / (t * z));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.05e-123], N[Not[LessEqual[y, 5.6e-161]], $MachinePrecision]], N[(1.0 - N[(N[(x / y), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{-123} \lor \neg \left(y \leq 5.6 \cdot 10^{-161}\right):\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\end{array}
\end{array}
if y < -1.05e-123 or 5.59999999999999984e-161 < y Initial program 99.4%
Taylor expanded in z around 0 89.6%
associate-/l/89.8%
Simplified89.8%
if -1.05e-123 < y < 5.59999999999999984e-161Initial program 95.7%
Taylor expanded in y around 0 83.3%
Final simplification88.2%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= t -8.8e-61) (not (<= t 2.4e-24))) (+ 1.0 (/ x (* t (- y z)))) (- 1.0 (/ x (* y (- y z))))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -8.8e-61) || !(t <= 2.4e-24)) {
tmp = 1.0 + (x / (t * (y - z)));
} else {
tmp = 1.0 - (x / (y * (y - z)));
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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.8d-61)) .or. (.not. (t <= 2.4d-24))) then
tmp = 1.0d0 + (x / (t * (y - z)))
else
tmp = 1.0d0 - (x / (y * (y - z)))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -8.8e-61) || !(t <= 2.4e-24)) {
tmp = 1.0 + (x / (t * (y - z)));
} else {
tmp = 1.0 - (x / (y * (y - z)));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if (t <= -8.8e-61) or not (t <= 2.4e-24): tmp = 1.0 + (x / (t * (y - z))) else: tmp = 1.0 - (x / (y * (y - z))) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if ((t <= -8.8e-61) || !(t <= 2.4e-24)) tmp = Float64(1.0 + Float64(x / Float64(t * Float64(y - z)))); else tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - z)))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((t <= -8.8e-61) || ~((t <= 2.4e-24)))
tmp = 1.0 + (x / (t * (y - z)));
else
tmp = 1.0 - (x / (y * (y - z)));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[Or[LessEqual[t, -8.8e-61], N[Not[LessEqual[t, 2.4e-24]], $MachinePrecision]], N[(1.0 + N[(x / N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(y * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.8 \cdot 10^{-61} \lor \neg \left(t \leq 2.4 \cdot 10^{-24}\right):\\
\;\;\;\;1 + \frac{x}{t \cdot \left(y - z\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\
\end{array}
\end{array}
if t < -8.80000000000000035e-61 or 2.3999999999999998e-24 < t Initial program 99.7%
Taylor expanded in t around inf 98.3%
associate-*r/98.3%
neg-mul-198.3%
Simplified98.3%
if -8.80000000000000035e-61 < t < 2.3999999999999998e-24Initial program 96.9%
Taylor expanded in t around 0 84.5%
Final simplification92.3%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -3e-126) 1.0 (if (<= y 6.6e-24) (+ 1.0 (/ -1.0 (* z (/ t x)))) (- 1.0 (/ (/ x y) y)))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3e-126) {
tmp = 1.0;
} else if (y <= 6.6e-24) {
tmp = 1.0 + (-1.0 / (z * (t / x)));
} else {
tmp = 1.0 - ((x / y) / y);
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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 (y <= (-3d-126)) then
tmp = 1.0d0
else if (y <= 6.6d-24) then
tmp = 1.0d0 + ((-1.0d0) / (z * (t / x)))
else
tmp = 1.0d0 - ((x / y) / y)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3e-126) {
tmp = 1.0;
} else if (y <= 6.6e-24) {
tmp = 1.0 + (-1.0 / (z * (t / x)));
} else {
tmp = 1.0 - ((x / y) / y);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if y <= -3e-126: tmp = 1.0 elif y <= 6.6e-24: tmp = 1.0 + (-1.0 / (z * (t / x))) else: tmp = 1.0 - ((x / y) / y) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -3e-126) tmp = 1.0; elseif (y <= 6.6e-24) tmp = Float64(1.0 + Float64(-1.0 / Float64(z * Float64(t / x)))); else tmp = Float64(1.0 - Float64(Float64(x / y) / y)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -3e-126)
tmp = 1.0;
elseif (y <= 6.6e-24)
tmp = 1.0 + (-1.0 / (z * (t / x)));
else
tmp = 1.0 - ((x / y) / y);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, -3e-126], 1.0, If[LessEqual[y, 6.6e-24], N[(1.0 + N[(-1.0 / N[(z * N[(t / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{-126}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 6.6 \cdot 10^{-24}:\\
\;\;\;\;1 + \frac{-1}{z \cdot \frac{t}{x}}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y}\\
\end{array}
\end{array}
if y < -3.0000000000000002e-126Initial program 99.6%
Taylor expanded in t around 0 88.7%
Taylor expanded in x around 0 87.5%
if -3.0000000000000002e-126 < y < 6.59999999999999968e-24Initial program 96.4%
Taylor expanded in y around 0 72.1%
associate-/r*72.0%
div-inv71.9%
Applied egg-rr71.9%
clear-num72.4%
frac-times72.5%
metadata-eval72.5%
Applied egg-rr72.5%
if 6.59999999999999968e-24 < y Initial program 99.9%
Taylor expanded in y around inf 94.4%
unpow294.4%
associate-/r*94.4%
Simplified94.4%
Final simplification83.9%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -7e-129) (- 1.0 (/ (/ x y) (- y t))) (if (<= y 5.6e-161) (- 1.0 (/ x (* t z))) (- 1.0 (/ (/ x (- y t)) y)))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7e-129) {
tmp = 1.0 - ((x / y) / (y - t));
} else if (y <= 5.6e-161) {
tmp = 1.0 - (x / (t * z));
} else {
tmp = 1.0 - ((x / (y - t)) / y);
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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 (y <= (-7d-129)) then
tmp = 1.0d0 - ((x / y) / (y - t))
else if (y <= 5.6d-161) then
tmp = 1.0d0 - (x / (t * z))
else
tmp = 1.0d0 - ((x / (y - t)) / y)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7e-129) {
tmp = 1.0 - ((x / y) / (y - t));
} else if (y <= 5.6e-161) {
tmp = 1.0 - (x / (t * z));
} else {
tmp = 1.0 - ((x / (y - t)) / y);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if y <= -7e-129: tmp = 1.0 - ((x / y) / (y - t)) elif y <= 5.6e-161: tmp = 1.0 - (x / (t * z)) else: tmp = 1.0 - ((x / (y - t)) / y) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -7e-129) tmp = Float64(1.0 - Float64(Float64(x / y) / Float64(y - t))); elseif (y <= 5.6e-161) tmp = Float64(1.0 - Float64(x / Float64(t * z))); else tmp = Float64(1.0 - Float64(Float64(x / Float64(y - t)) / y)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -7e-129)
tmp = 1.0 - ((x / y) / (y - t));
elseif (y <= 5.6e-161)
tmp = 1.0 - (x / (t * z));
else
tmp = 1.0 - ((x / (y - t)) / y);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, -7e-129], N[(1.0 - N[(N[(x / y), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.6e-161], N[(1.0 - N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / N[(y - t), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7 \cdot 10^{-129}:\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y - t}\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{-161}:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{y - t}}{y}\\
\end{array}
\end{array}
if y < -6.9999999999999995e-129Initial program 99.6%
Taylor expanded in z around 0 91.7%
associate-/l/92.1%
Simplified92.1%
if -6.9999999999999995e-129 < y < 5.59999999999999984e-161Initial program 95.7%
Taylor expanded in y around 0 83.3%
if 5.59999999999999984e-161 < y Initial program 99.3%
associate-/l/100.0%
div-inv99.9%
Applied egg-rr99.9%
clear-num99.8%
frac-times99.9%
metadata-eval99.9%
Applied egg-rr99.9%
Taylor expanded in z around 0 87.8%
associate-/r*88.0%
Simplified88.0%
Final simplification88.2%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= z -1.45e-53)
(+ 1.0 (/ x (* (- y t) z)))
(if (<= z 1.65e-219)
(- 1.0 (/ (/ x y) (- y t)))
(+ 1.0 (/ x (* t (- y z)))))))assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.45e-53) {
tmp = 1.0 + (x / ((y - t) * z));
} else if (z <= 1.65e-219) {
tmp = 1.0 - ((x / y) / (y - t));
} else {
tmp = 1.0 + (x / (t * (y - z)));
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.45d-53)) then
tmp = 1.0d0 + (x / ((y - t) * z))
else if (z <= 1.65d-219) then
tmp = 1.0d0 - ((x / y) / (y - t))
else
tmp = 1.0d0 + (x / (t * (y - z)))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.45e-53) {
tmp = 1.0 + (x / ((y - t) * z));
} else if (z <= 1.65e-219) {
tmp = 1.0 - ((x / y) / (y - t));
} else {
tmp = 1.0 + (x / (t * (y - z)));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if z <= -1.45e-53: tmp = 1.0 + (x / ((y - t) * z)) elif z <= 1.65e-219: tmp = 1.0 - ((x / y) / (y - t)) else: tmp = 1.0 + (x / (t * (y - z))) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= -1.45e-53) tmp = Float64(1.0 + Float64(x / Float64(Float64(y - t) * z))); elseif (z <= 1.65e-219) tmp = Float64(1.0 - Float64(Float64(x / y) / Float64(y - t))); else tmp = Float64(1.0 + Float64(x / Float64(t * Float64(y - z)))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= -1.45e-53)
tmp = 1.0 + (x / ((y - t) * z));
elseif (z <= 1.65e-219)
tmp = 1.0 - ((x / y) / (y - t));
else
tmp = 1.0 + (x / (t * (y - z)));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, -1.45e-53], N[(1.0 + N[(x / N[(N[(y - t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.65e-219], N[(1.0 - N[(N[(x / y), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x / N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{-53}:\\
\;\;\;\;1 + \frac{x}{\left(y - t\right) \cdot z}\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{-219}:\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{t \cdot \left(y - z\right)}\\
\end{array}
\end{array}
if z < -1.4499999999999999e-53Initial program 99.5%
Taylor expanded in z around inf 93.5%
associate-*r/93.5%
neg-mul-193.5%
Simplified93.5%
if -1.4499999999999999e-53 < z < 1.6500000000000001e-219Initial program 96.4%
Taylor expanded in z around 0 87.9%
associate-/l/88.1%
Simplified88.1%
if 1.6500000000000001e-219 < z Initial program 99.3%
Taylor expanded in t around inf 80.1%
associate-*r/80.1%
neg-mul-180.1%
Simplified80.1%
Final simplification86.6%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ 1.0 (* (/ x (- y z)) (/ -1.0 (- y t)))))
assert(z < t);
double code(double x, double y, double z, double t) {
return 1.0 + ((x / (y - z)) * (-1.0 / (y - t)));
}
NOTE: z and t should be sorted in increasing order before calling this function.
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 + ((x / (y - z)) * ((-1.0d0) / (y - t)))
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 + ((x / (y - z)) * (-1.0 / (y - t)));
}
[z, t] = sort([z, t]) def code(x, y, z, t): return 1.0 + ((x / (y - z)) * (-1.0 / (y - t)))
z, t = sort([z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(Float64(x / Float64(y - z)) * Float64(-1.0 / Float64(y - t)))) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + ((x / (y - z)) * (-1.0 / (y - t)));
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 + N[(N[(x / N[(y - z), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
1 + \frac{x}{y - z} \cdot \frac{-1}{y - t}
\end{array}
Initial program 98.5%
associate-/r*98.8%
div-inv98.8%
Applied egg-rr98.8%
Final simplification98.8%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -4.8e-124) 1.0 (if (<= y 6e-61) (- 1.0 (/ x (* t z))) 1.0)))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.8e-124) {
tmp = 1.0;
} else if (y <= 6e-61) {
tmp = 1.0 - (x / (t * z));
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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 (y <= (-4.8d-124)) then
tmp = 1.0d0
else if (y <= 6d-61) then
tmp = 1.0d0 - (x / (t * z))
else
tmp = 1.0d0
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.8e-124) {
tmp = 1.0;
} else if (y <= 6e-61) {
tmp = 1.0 - (x / (t * z));
} else {
tmp = 1.0;
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if y <= -4.8e-124: tmp = 1.0 elif y <= 6e-61: tmp = 1.0 - (x / (t * z)) else: tmp = 1.0 return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -4.8e-124) tmp = 1.0; elseif (y <= 6e-61) tmp = Float64(1.0 - Float64(x / Float64(t * z))); else tmp = 1.0; end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -4.8e-124)
tmp = 1.0;
elseif (y <= 6e-61)
tmp = 1.0 - (x / (t * z));
else
tmp = 1.0;
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, -4.8e-124], 1.0, If[LessEqual[y, 6e-61], N[(1.0 - N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{-124}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 6 \cdot 10^{-61}:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -4.79999999999999985e-124 or 6.00000000000000024e-61 < y Initial program 99.7%
Taylor expanded in t around 0 89.5%
Taylor expanded in x around 0 87.5%
if -4.79999999999999985e-124 < y < 6.00000000000000024e-61Initial program 95.9%
Taylor expanded in y around 0 74.6%
Final simplification83.3%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -1.05e-123) 1.0 (if (<= y 6.6e-26) (- 1.0 (/ x (* t z))) (- 1.0 (/ (/ x y) y)))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.05e-123) {
tmp = 1.0;
} else if (y <= 6.6e-26) {
tmp = 1.0 - (x / (t * z));
} else {
tmp = 1.0 - ((x / y) / y);
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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 (y <= (-1.05d-123)) then
tmp = 1.0d0
else if (y <= 6.6d-26) then
tmp = 1.0d0 - (x / (t * z))
else
tmp = 1.0d0 - ((x / y) / y)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.05e-123) {
tmp = 1.0;
} else if (y <= 6.6e-26) {
tmp = 1.0 - (x / (t * z));
} else {
tmp = 1.0 - ((x / y) / y);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if y <= -1.05e-123: tmp = 1.0 elif y <= 6.6e-26: tmp = 1.0 - (x / (t * z)) else: tmp = 1.0 - ((x / y) / y) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -1.05e-123) tmp = 1.0; elseif (y <= 6.6e-26) tmp = Float64(1.0 - Float64(x / Float64(t * z))); else tmp = Float64(1.0 - Float64(Float64(x / y) / y)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -1.05e-123)
tmp = 1.0;
elseif (y <= 6.6e-26)
tmp = 1.0 - (x / (t * z));
else
tmp = 1.0 - ((x / y) / y);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, -1.05e-123], 1.0, If[LessEqual[y, 6.6e-26], N[(1.0 - N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{-123}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 6.6 \cdot 10^{-26}:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y}\\
\end{array}
\end{array}
if y < -1.05e-123Initial program 99.6%
Taylor expanded in t around 0 88.7%
Taylor expanded in x around 0 87.5%
if -1.05e-123 < y < 6.5999999999999997e-26Initial program 96.4%
Taylor expanded in y around 0 72.1%
if 6.5999999999999997e-26 < y Initial program 99.9%
Taylor expanded in y around inf 94.4%
unpow294.4%
associate-/r*94.4%
Simplified94.4%
Final simplification83.8%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- 1.0 (/ x (* (- y t) (- y z)))))
assert(z < t);
double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - t) * (y - z)));
}
NOTE: z and t should be sorted in increasing order before calling this function.
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 - (x / ((y - t) * (y - z)))
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - t) * (y - z)));
}
[z, t] = sort([z, t]) def code(x, y, z, t): return 1.0 - (x / ((y - t) * (y - z)))
z, t = sort([z, t]) function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(Float64(y - t) * Float64(y - z)))) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - (x / ((y - t) * (y - z)));
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 - N[(x / N[(N[(y - t), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
1 - \frac{x}{\left(y - t\right) \cdot \left(y - z\right)}
\end{array}
Initial program 98.5%
Final simplification98.5%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- 1.0 (/ (/ x (- y t)) (- y z))))
assert(z < t);
double code(double x, double y, double z, double t) {
return 1.0 - ((x / (y - t)) / (y - z));
}
NOTE: z and t should be sorted in increasing order before calling this function.
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 - ((x / (y - t)) / (y - z))
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 - ((x / (y - t)) / (y - z));
}
[z, t] = sort([z, t]) def code(x, y, z, t): return 1.0 - ((x / (y - t)) / (y - z))
z, t = sort([z, t]) function code(x, y, z, t) return Float64(1.0 - Float64(Float64(x / Float64(y - t)) / Float64(y - z))) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - ((x / (y - t)) / (y - z));
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 - N[(N[(x / N[(y - t), $MachinePrecision]), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
1 - \frac{\frac{x}{y - t}}{y - z}
\end{array}
Initial program 98.5%
associate-/l/99.2%
Simplified99.2%
Final simplification99.2%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 1.0)
assert(z < t);
double code(double x, double y, double z, double t) {
return 1.0;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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
assert z < t;
public static double code(double x, double y, double z, double t) {
return 1.0;
}
[z, t] = sort([z, t]) def code(x, y, z, t): return 1.0
z, t = sort([z, t]) function code(x, y, z, t) return 1.0 end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
1
\end{array}
Initial program 98.5%
Taylor expanded in t around 0 73.3%
Taylor expanded in x around 0 74.6%
Final simplification74.6%
herbie shell --seed 2023199
(FPCore (x y z t)
:name "Data.Random.Distribution.Triangular:triangularCDF from random-fu-0.2.6.2, A"
:precision binary64
(- 1.0 (/ x (* (- y z) (- y t)))))