
(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 12 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: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z -5e-70) (+ 1.0 (/ x (* (- y z) (- t y)))) (+ 1.0 (/ (/ x (- y t)) (- z y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5e-70) {
tmp = 1.0 + (x / ((y - z) * (t - y)));
} else {
tmp = 1.0 + ((x / (y - t)) / (z - y));
}
return tmp;
}
NOTE: x, y, 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 <= (-5d-70)) then
tmp = 1.0d0 + (x / ((y - z) * (t - y)))
else
tmp = 1.0d0 + ((x / (y - t)) / (z - y))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5e-70) {
tmp = 1.0 + (x / ((y - z) * (t - y)));
} else {
tmp = 1.0 + ((x / (y - t)) / (z - y));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= -5e-70: tmp = 1.0 + (x / ((y - z) * (t - y))) else: tmp = 1.0 + ((x / (y - t)) / (z - y)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= -5e-70) tmp = Float64(1.0 + Float64(x / Float64(Float64(y - z) * Float64(t - y)))); else tmp = Float64(1.0 + Float64(Float64(x / Float64(y - t)) / Float64(z - y))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= -5e-70)
tmp = 1.0 + (x / ((y - z) * (t - y)));
else
tmp = 1.0 + ((x / (y - t)) / (z - y));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, -5e-70], N[(1.0 + N[(x / N[(N[(y - z), $MachinePrecision] * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x / N[(y - t), $MachinePrecision]), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{-70}:\\
\;\;\;\;1 + \frac{x}{\left(y - z\right) \cdot \left(t - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{y - t}}{z - y}\\
\end{array}
\end{array}
if z < -4.9999999999999998e-70Initial program 99.9%
if -4.9999999999999998e-70 < z Initial program 96.9%
associate-/r*98.8%
div-inv98.7%
Applied egg-rr98.7%
associate-*l/98.7%
un-div-inv98.7%
Applied egg-rr98.7%
Final simplification99.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y -1.85e-82)
1.0
(if (<= y 2.7e-117)
(- 1.0 (/ x (* z t)))
(if (<= y 1.14e-29)
(+ 1.0 (/ x (* y t)))
(if (<= y 1.6e+24) (/ (+ y (/ x z)) y) 1.0)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.85e-82) {
tmp = 1.0;
} else if (y <= 2.7e-117) {
tmp = 1.0 - (x / (z * t));
} else if (y <= 1.14e-29) {
tmp = 1.0 + (x / (y * t));
} else if (y <= 1.6e+24) {
tmp = (y + (x / z)) / y;
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: x, y, 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.85d-82)) then
tmp = 1.0d0
else if (y <= 2.7d-117) then
tmp = 1.0d0 - (x / (z * t))
else if (y <= 1.14d-29) then
tmp = 1.0d0 + (x / (y * t))
else if (y <= 1.6d+24) then
tmp = (y + (x / z)) / y
else
tmp = 1.0d0
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.85e-82) {
tmp = 1.0;
} else if (y <= 2.7e-117) {
tmp = 1.0 - (x / (z * t));
} else if (y <= 1.14e-29) {
tmp = 1.0 + (x / (y * t));
} else if (y <= 1.6e+24) {
tmp = (y + (x / z)) / y;
} else {
tmp = 1.0;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= -1.85e-82: tmp = 1.0 elif y <= 2.7e-117: tmp = 1.0 - (x / (z * t)) elif y <= 1.14e-29: tmp = 1.0 + (x / (y * t)) elif y <= 1.6e+24: tmp = (y + (x / z)) / y else: tmp = 1.0 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -1.85e-82) tmp = 1.0; elseif (y <= 2.7e-117) tmp = Float64(1.0 - Float64(x / Float64(z * t))); elseif (y <= 1.14e-29) tmp = Float64(1.0 + Float64(x / Float64(y * t))); elseif (y <= 1.6e+24) tmp = Float64(Float64(y + Float64(x / z)) / y); else tmp = 1.0; end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -1.85e-82)
tmp = 1.0;
elseif (y <= 2.7e-117)
tmp = 1.0 - (x / (z * t));
elseif (y <= 1.14e-29)
tmp = 1.0 + (x / (y * t));
elseif (y <= 1.6e+24)
tmp = (y + (x / z)) / y;
else
tmp = 1.0;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, -1.85e-82], 1.0, If[LessEqual[y, 2.7e-117], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.14e-29], N[(1.0 + N[(x / N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.6e+24], N[(N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], 1.0]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.85 \cdot 10^{-82}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{-117}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\mathbf{elif}\;y \leq 1.14 \cdot 10^{-29}:\\
\;\;\;\;1 + \frac{x}{y \cdot t}\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+24}:\\
\;\;\;\;\frac{y + \frac{x}{z}}{y}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.85e-82 or 1.5999999999999999e24 < y Initial program 100.0%
Taylor expanded in t around 0 95.6%
Taylor expanded in y around 0 68.1%
associate-*r/68.1%
neg-mul-168.1%
Simplified68.1%
Taylor expanded in x around 0 90.4%
if -1.85e-82 < y < 2.70000000000000003e-117Initial program 94.1%
Taylor expanded in y around 0 73.9%
if 2.70000000000000003e-117 < y < 1.13999999999999995e-29Initial program 99.9%
Taylor expanded in z around 0 73.2%
Taylor expanded in y around 0 54.5%
associate-*r/54.5%
neg-mul-154.5%
*-commutative54.5%
Simplified54.5%
if 1.13999999999999995e-29 < y < 1.5999999999999999e24Initial program 99.8%
Taylor expanded in t around 0 65.7%
Taylor expanded in y around 0 29.8%
associate-*r/29.8%
neg-mul-129.8%
Simplified29.8%
Taylor expanded in y around 0 29.8%
sub-neg29.8%
mul-1-neg29.8%
remove-double-neg29.8%
Simplified29.8%
Final simplification77.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= y -4e-77)
1.0
(if (<= y 6e-118)
(- 1.0 (/ x (* z t)))
(if (<= y 7.8e-30)
(+ 1.0 (/ (/ x y) t))
(if (<= y 1.6e+24) (/ (+ y (/ x z)) y) 1.0)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4e-77) {
tmp = 1.0;
} else if (y <= 6e-118) {
tmp = 1.0 - (x / (z * t));
} else if (y <= 7.8e-30) {
tmp = 1.0 + ((x / y) / t);
} else if (y <= 1.6e+24) {
tmp = (y + (x / z)) / y;
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: x, y, 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 <= (-4d-77)) then
tmp = 1.0d0
else if (y <= 6d-118) then
tmp = 1.0d0 - (x / (z * t))
else if (y <= 7.8d-30) then
tmp = 1.0d0 + ((x / y) / t)
else if (y <= 1.6d+24) then
tmp = (y + (x / z)) / y
else
tmp = 1.0d0
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4e-77) {
tmp = 1.0;
} else if (y <= 6e-118) {
tmp = 1.0 - (x / (z * t));
} else if (y <= 7.8e-30) {
tmp = 1.0 + ((x / y) / t);
} else if (y <= 1.6e+24) {
tmp = (y + (x / z)) / y;
} else {
tmp = 1.0;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= -4e-77: tmp = 1.0 elif y <= 6e-118: tmp = 1.0 - (x / (z * t)) elif y <= 7.8e-30: tmp = 1.0 + ((x / y) / t) elif y <= 1.6e+24: tmp = (y + (x / z)) / y else: tmp = 1.0 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -4e-77) tmp = 1.0; elseif (y <= 6e-118) tmp = Float64(1.0 - Float64(x / Float64(z * t))); elseif (y <= 7.8e-30) tmp = Float64(1.0 + Float64(Float64(x / y) / t)); elseif (y <= 1.6e+24) tmp = Float64(Float64(y + Float64(x / z)) / y); else tmp = 1.0; end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -4e-77)
tmp = 1.0;
elseif (y <= 6e-118)
tmp = 1.0 - (x / (z * t));
elseif (y <= 7.8e-30)
tmp = 1.0 + ((x / y) / t);
elseif (y <= 1.6e+24)
tmp = (y + (x / z)) / y;
else
tmp = 1.0;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, -4e-77], 1.0, If[LessEqual[y, 6e-118], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.8e-30], N[(1.0 + N[(N[(x / y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.6e+24], N[(N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], 1.0]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{-77}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 6 \cdot 10^{-118}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\mathbf{elif}\;y \leq 7.8 \cdot 10^{-30}:\\
\;\;\;\;1 + \frac{\frac{x}{y}}{t}\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+24}:\\
\;\;\;\;\frac{y + \frac{x}{z}}{y}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -3.9999999999999997e-77 or 1.5999999999999999e24 < y Initial program 100.0%
Taylor expanded in t around 0 95.6%
Taylor expanded in y around 0 68.1%
associate-*r/68.1%
neg-mul-168.1%
Simplified68.1%
Taylor expanded in x around 0 90.4%
if -3.9999999999999997e-77 < y < 6.00000000000000035e-118Initial program 94.1%
Taylor expanded in y around 0 73.9%
if 6.00000000000000035e-118 < y < 7.8000000000000007e-30Initial program 99.9%
Taylor expanded in z around 0 73.2%
Taylor expanded in y around 0 54.5%
associate-*r/54.5%
neg-mul-154.5%
*-commutative54.5%
Simplified54.5%
Taylor expanded in x around 0 54.5%
mul-1-neg54.5%
associate-/l/54.6%
distribute-neg-frac254.6%
Simplified54.6%
if 7.8000000000000007e-30 < y < 1.5999999999999999e24Initial program 99.8%
Taylor expanded in t around 0 65.7%
Taylor expanded in y around 0 29.8%
associate-*r/29.8%
neg-mul-129.8%
Simplified29.8%
Taylor expanded in y around 0 29.8%
sub-neg29.8%
mul-1-neg29.8%
remove-double-neg29.8%
Simplified29.8%
Final simplification77.6%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= y -8e-105) (not (<= y 4.8e-119))) (+ 1.0 (/ x (* y (- t y)))) (- 1.0 (/ x (* z t)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -8e-105) || !(y <= 4.8e-119)) {
tmp = 1.0 + (x / (y * (t - y)));
} else {
tmp = 1.0 - (x / (z * t));
}
return tmp;
}
NOTE: x, y, 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 <= (-8d-105)) .or. (.not. (y <= 4.8d-119))) then
tmp = 1.0d0 + (x / (y * (t - y)))
else
tmp = 1.0d0 - (x / (z * t))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -8e-105) || !(y <= 4.8e-119)) {
tmp = 1.0 + (x / (y * (t - y)));
} else {
tmp = 1.0 - (x / (z * t));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (y <= -8e-105) or not (y <= 4.8e-119): tmp = 1.0 + (x / (y * (t - y))) else: tmp = 1.0 - (x / (z * t)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if ((y <= -8e-105) || !(y <= 4.8e-119)) tmp = Float64(1.0 + Float64(x / Float64(y * Float64(t - y)))); else tmp = Float64(1.0 - Float64(x / Float64(z * t))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((y <= -8e-105) || ~((y <= 4.8e-119)))
tmp = 1.0 + (x / (y * (t - y)));
else
tmp = 1.0 - (x / (z * t));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[Or[LessEqual[y, -8e-105], N[Not[LessEqual[y, 4.8e-119]], $MachinePrecision]], N[(1.0 + N[(x / N[(y * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8 \cdot 10^{-105} \lor \neg \left(y \leq 4.8 \cdot 10^{-119}\right):\\
\;\;\;\;1 + \frac{x}{y \cdot \left(t - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\end{array}
\end{array}
if y < -7.99999999999999972e-105 or 4.80000000000000017e-119 < y Initial program 100.0%
Taylor expanded in z around 0 91.7%
if -7.99999999999999972e-105 < y < 4.80000000000000017e-119Initial program 93.7%
Taylor expanded in y around 0 73.2%
Final simplification85.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= y -5.4e-50) (not (<= y 2.8e-119))) (+ 1.0 (/ x (* y (- z y)))) (- 1.0 (/ x (* z t)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -5.4e-50) || !(y <= 2.8e-119)) {
tmp = 1.0 + (x / (y * (z - y)));
} else {
tmp = 1.0 - (x / (z * t));
}
return tmp;
}
NOTE: x, y, 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 <= (-5.4d-50)) .or. (.not. (y <= 2.8d-119))) then
tmp = 1.0d0 + (x / (y * (z - y)))
else
tmp = 1.0d0 - (x / (z * t))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -5.4e-50) || !(y <= 2.8e-119)) {
tmp = 1.0 + (x / (y * (z - y)));
} else {
tmp = 1.0 - (x / (z * t));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (y <= -5.4e-50) or not (y <= 2.8e-119): tmp = 1.0 + (x / (y * (z - y))) else: tmp = 1.0 - (x / (z * t)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if ((y <= -5.4e-50) || !(y <= 2.8e-119)) tmp = Float64(1.0 + Float64(x / Float64(y * Float64(z - y)))); else tmp = Float64(1.0 - Float64(x / Float64(z * t))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((y <= -5.4e-50) || ~((y <= 2.8e-119)))
tmp = 1.0 + (x / (y * (z - y)));
else
tmp = 1.0 - (x / (z * t));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[Or[LessEqual[y, -5.4e-50], N[Not[LessEqual[y, 2.8e-119]], $MachinePrecision]], N[(1.0 + N[(x / N[(y * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.4 \cdot 10^{-50} \lor \neg \left(y \leq 2.8 \cdot 10^{-119}\right):\\
\;\;\;\;1 + \frac{x}{y \cdot \left(z - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\end{array}
\end{array}
if y < -5.3999999999999999e-50 or 2.8e-119 < y Initial program 100.0%
Taylor expanded in t around 0 92.6%
if -5.3999999999999999e-50 < y < 2.8e-119Initial program 94.5%
Taylor expanded in y around 0 73.3%
Final simplification85.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= t -3.75e-107) (not (<= t 1.7e-66))) (+ 1.0 (/ (/ x t) (- y z))) (+ 1.0 (/ x (* y (- z y))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.75e-107) || !(t <= 1.7e-66)) {
tmp = 1.0 + ((x / t) / (y - z));
} else {
tmp = 1.0 + (x / (y * (z - y)));
}
return tmp;
}
NOTE: x, y, 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 <= (-3.75d-107)) .or. (.not. (t <= 1.7d-66))) then
tmp = 1.0d0 + ((x / t) / (y - z))
else
tmp = 1.0d0 + (x / (y * (z - y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.75e-107) || !(t <= 1.7e-66)) {
tmp = 1.0 + ((x / t) / (y - z));
} else {
tmp = 1.0 + (x / (y * (z - y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (t <= -3.75e-107) or not (t <= 1.7e-66): tmp = 1.0 + ((x / t) / (y - z)) else: tmp = 1.0 + (x / (y * (z - y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if ((t <= -3.75e-107) || !(t <= 1.7e-66)) tmp = Float64(1.0 + Float64(Float64(x / t) / Float64(y - z))); else tmp = Float64(1.0 + Float64(x / Float64(y * Float64(z - y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((t <= -3.75e-107) || ~((t <= 1.7e-66)))
tmp = 1.0 + ((x / t) / (y - z));
else
tmp = 1.0 + (x / (y * (z - y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3.75e-107], N[Not[LessEqual[t, 1.7e-66]], $MachinePrecision]], N[(1.0 + N[(N[(x / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x / N[(y * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.75 \cdot 10^{-107} \lor \neg \left(t \leq 1.7 \cdot 10^{-66}\right):\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{y \cdot \left(z - y\right)}\\
\end{array}
\end{array}
if t < -3.75000000000000023e-107 or 1.69999999999999999e-66 < t Initial program 100.0%
associate-/r*98.8%
div-inv98.7%
Applied egg-rr98.7%
un-div-inv98.8%
Applied egg-rr98.8%
Taylor expanded in t around inf 93.0%
mul-1-neg93.0%
associate-/r*91.8%
Simplified91.8%
if -3.75000000000000023e-107 < t < 1.69999999999999999e-66Initial program 94.5%
Taylor expanded in t around 0 79.0%
Final simplification87.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= t -1.1e-106)
(+ 1.0 (/ (/ x t) (- y z)))
(if (<= t 2.7e-69)
(+ 1.0 (/ x (* y (- z y))))
(- 1.0 (/ x (* t (- z y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.1e-106) {
tmp = 1.0 + ((x / t) / (y - z));
} else if (t <= 2.7e-69) {
tmp = 1.0 + (x / (y * (z - y)));
} else {
tmp = 1.0 - (x / (t * (z - y)));
}
return tmp;
}
NOTE: x, y, 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 <= (-1.1d-106)) then
tmp = 1.0d0 + ((x / t) / (y - z))
else if (t <= 2.7d-69) then
tmp = 1.0d0 + (x / (y * (z - y)))
else
tmp = 1.0d0 - (x / (t * (z - y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.1e-106) {
tmp = 1.0 + ((x / t) / (y - z));
} else if (t <= 2.7e-69) {
tmp = 1.0 + (x / (y * (z - y)));
} else {
tmp = 1.0 - (x / (t * (z - y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if t <= -1.1e-106: tmp = 1.0 + ((x / t) / (y - z)) elif t <= 2.7e-69: tmp = 1.0 + (x / (y * (z - y))) else: tmp = 1.0 - (x / (t * (z - y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (t <= -1.1e-106) tmp = Float64(1.0 + Float64(Float64(x / t) / Float64(y - z))); elseif (t <= 2.7e-69) tmp = Float64(1.0 + Float64(x / Float64(y * Float64(z - y)))); else tmp = Float64(1.0 - Float64(x / Float64(t * Float64(z - y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (t <= -1.1e-106)
tmp = 1.0 + ((x / t) / (y - z));
elseif (t <= 2.7e-69)
tmp = 1.0 + (x / (y * (z - y)));
else
tmp = 1.0 - (x / (t * (z - y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[t, -1.1e-106], N[(1.0 + N[(N[(x / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.7e-69], N[(1.0 + N[(x / N[(y * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.1 \cdot 10^{-106}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\mathbf{elif}\;t \leq 2.7 \cdot 10^{-69}:\\
\;\;\;\;1 + \frac{x}{y \cdot \left(z - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\
\end{array}
\end{array}
if t < -1.09999999999999997e-106Initial program 99.9%
associate-/r*99.9%
div-inv99.9%
Applied egg-rr99.9%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in t around inf 91.7%
mul-1-neg91.7%
associate-/r*90.5%
Simplified90.5%
if -1.09999999999999997e-106 < t < 2.6999999999999997e-69Initial program 94.5%
Taylor expanded in t around 0 79.0%
if 2.6999999999999997e-69 < t Initial program 100.0%
Taylor expanded in t around inf 94.6%
associate-*r/94.6%
neg-mul-194.6%
Simplified94.6%
Final simplification87.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= z -0.395)
(+ 1.0 (/ (/ x z) (- y t)))
(if (<= z 5.8e-205)
(+ 1.0 (/ (/ x y) (- t y)))
(- 1.0 (/ x (* t (- z y)))))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.395) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 5.8e-205) {
tmp = 1.0 + ((x / y) / (t - y));
} else {
tmp = 1.0 - (x / (t * (z - y)));
}
return tmp;
}
NOTE: x, y, 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 <= (-0.395d0)) then
tmp = 1.0d0 + ((x / z) / (y - t))
else if (z <= 5.8d-205) then
tmp = 1.0d0 + ((x / y) / (t - y))
else
tmp = 1.0d0 - (x / (t * (z - y)))
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.395) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 5.8e-205) {
tmp = 1.0 + ((x / y) / (t - y));
} else {
tmp = 1.0 - (x / (t * (z - y)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= -0.395: tmp = 1.0 + ((x / z) / (y - t)) elif z <= 5.8e-205: tmp = 1.0 + ((x / y) / (t - y)) else: tmp = 1.0 - (x / (t * (z - y))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= -0.395) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); elseif (z <= 5.8e-205) tmp = Float64(1.0 + Float64(Float64(x / y) / Float64(t - y))); else tmp = Float64(1.0 - Float64(x / Float64(t * Float64(z - y)))); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= -0.395)
tmp = 1.0 + ((x / z) / (y - t));
elseif (z <= 5.8e-205)
tmp = 1.0 + ((x / y) / (t - y));
else
tmp = 1.0 - (x / (t * (z - y)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[z, -0.395], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.8e-205], N[(1.0 + N[(N[(x / y), $MachinePrecision] / N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.395:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{-205}:\\
\;\;\;\;1 + \frac{\frac{x}{y}}{t - y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\
\end{array}
\end{array}
if z < -0.39500000000000002Initial program 100.0%
Taylor expanded in z around inf 100.0%
mul-1-neg100.0%
associate-/r*100.0%
distribute-neg-frac100.0%
Simplified100.0%
if -0.39500000000000002 < z < 5.80000000000000036e-205Initial program 94.5%
Taylor expanded in z around 0 83.4%
associate-/r*86.2%
Simplified86.2%
if 5.80000000000000036e-205 < z Initial program 99.4%
Taylor expanded in t around inf 77.6%
associate-*r/77.6%
neg-mul-177.6%
Simplified77.6%
Final simplification86.7%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -5.5e-74) 1.0 (if (<= y 1.6e-82) (- 1.0 (/ x (* z t))) 1.0)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5.5e-74) {
tmp = 1.0;
} else if (y <= 1.6e-82) {
tmp = 1.0 - (x / (z * t));
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: x, y, 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 <= (-5.5d-74)) then
tmp = 1.0d0
else if (y <= 1.6d-82) then
tmp = 1.0d0 - (x / (z * t))
else
tmp = 1.0d0
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5.5e-74) {
tmp = 1.0;
} else if (y <= 1.6e-82) {
tmp = 1.0 - (x / (z * t));
} else {
tmp = 1.0;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= -5.5e-74: tmp = 1.0 elif y <= 1.6e-82: tmp = 1.0 - (x / (z * t)) else: tmp = 1.0 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -5.5e-74) tmp = 1.0; elseif (y <= 1.6e-82) tmp = Float64(1.0 - Float64(x / Float64(z * t))); else tmp = 1.0; end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -5.5e-74)
tmp = 1.0;
elseif (y <= 1.6e-82)
tmp = 1.0 - (x / (z * t));
else
tmp = 1.0;
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, -5.5e-74], 1.0, If[LessEqual[y, 1.6e-82], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.5 \cdot 10^{-74}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{-82}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -5.5000000000000001e-74 or 1.6000000000000001e-82 < y Initial program 100.0%
Taylor expanded in t around 0 91.3%
Taylor expanded in y around 0 64.7%
associate-*r/64.7%
neg-mul-164.7%
Simplified64.7%
Taylor expanded in x around 0 83.7%
if -5.5000000000000001e-74 < y < 1.6000000000000001e-82Initial program 94.6%
Taylor expanded in y around 0 72.1%
Final simplification79.3%
NOTE: x, y, 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) (- t y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 + (x / ((y - z) * (t - y)));
}
NOTE: x, y, 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) * (t - y)))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 + (x / ((y - z) * (t - y)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + (x / ((y - z) * (t - y)))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(x / Float64(Float64(y - z) * Float64(t - y)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + (x / ((y - z) * (t - y)));
end
NOTE: x, y, 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 - z), $MachinePrecision] * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \frac{x}{\left(y - z\right) \cdot \left(t - y\right)}
\end{array}
Initial program 97.9%
Final simplification97.9%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ 1.0 (/ (/ x (- z y)) (- y t))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 + ((x / (z - y)) / (y - t));
}
NOTE: x, y, 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 / (z - y)) / (y - t))
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 + ((x / (z - y)) / (y - t));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + ((x / (z - y)) / (y - t))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(Float64(x / Float64(z - y)) / Float64(y - t))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + ((x / (z - y)) / (y - t));
end
NOTE: x, y, 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[(z - y), $MachinePrecision]), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \frac{\frac{x}{z - y}}{y - t}
\end{array}
Initial program 97.9%
associate-/r*99.2%
div-inv99.0%
Applied egg-rr99.0%
un-div-inv99.2%
Applied egg-rr99.2%
Final simplification99.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 1.0)
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0;
}
NOTE: x, y, 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 x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return 1.0;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return 1.0 end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1
\end{array}
Initial program 97.9%
Taylor expanded in t around 0 71.3%
Taylor expanded in y around 0 53.8%
associate-*r/53.8%
neg-mul-153.8%
Simplified53.8%
Taylor expanded in x around 0 69.4%
Final simplification69.4%
herbie shell --seed 2024115
(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)))))