
(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 (+ 1.0 (/ (/ x (- y t)) (- z y))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 + ((x / (y - t)) / (z - 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 - t)) / (z - 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 - t)) / (z - y));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + ((x / (y - t)) / (z - y))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(Float64(x / Float64(y - t)) / Float64(z - y))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + ((x / (y - t)) / (z - 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[(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])\\
\\
1 + \frac{\frac{x}{y - t}}{z - y}
\end{array}
Initial program 98.8%
Taylor expanded in x around 0 98.8%
associate-/r*98.1%
Simplified98.1%
Final simplification98.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 (or (<= y -7.5e-49) (not (<= y 8e-40))) (+ 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 ((y <= -7.5e-49) || !(y <= 8e-40)) {
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 ((y <= (-7.5d-49)) .or. (.not. (y <= 8d-40))) 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 ((y <= -7.5e-49) || !(y <= 8e-40)) {
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 (y <= -7.5e-49) or not (y <= 8e-40): 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 ((y <= -7.5e-49) || !(y <= 8e-40)) tmp = Float64(1.0 + Float64(x / Float64(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 ((y <= -7.5e-49) || ~((y <= 8e-40)))
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[Or[LessEqual[y, -7.5e-49], N[Not[LessEqual[y, 8e-40]], $MachinePrecision]], N[(1.0 + N[(x / N[(y * N[(t - 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}\;y \leq -7.5 \cdot 10^{-49} \lor \neg \left(y \leq 8 \cdot 10^{-40}\right):\\
\;\;\;\;1 + \frac{x}{y \cdot \left(t - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\
\end{array}
\end{array}
if y < -7.4999999999999998e-49 or 7.9999999999999994e-40 < y Initial program 100.0%
Taylor expanded in z around 0 92.3%
if -7.4999999999999998e-49 < y < 7.9999999999999994e-40Initial program 97.0%
*-commutative97.0%
sub-neg97.0%
distribute-lft-in97.0%
Applied egg-rr97.0%
Taylor expanded in t around inf 84.7%
neg-mul-184.7%
unsub-neg84.7%
Simplified84.7%
Final simplification89.2%
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 -8.6e-138) (not (<= t 2.65e-83))) (- 1.0 (/ x (* t (- z y)))) (+ 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 <= -8.6e-138) || !(t <= 2.65e-83)) {
tmp = 1.0 - (x / (t * (z - y)));
} 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 <= (-8.6d-138)) .or. (.not. (t <= 2.65d-83))) then
tmp = 1.0d0 - (x / (t * (z - y)))
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 <= -8.6e-138) || !(t <= 2.65e-83)) {
tmp = 1.0 - (x / (t * (z - y)));
} 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 <= -8.6e-138) or not (t <= 2.65e-83): tmp = 1.0 - (x / (t * (z - y))) 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 <= -8.6e-138) || !(t <= 2.65e-83)) tmp = Float64(1.0 - Float64(x / Float64(t * Float64(z - y)))); 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 <= -8.6e-138) || ~((t <= 2.65e-83)))
tmp = 1.0 - (x / (t * (z - y)));
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, -8.6e-138], N[Not[LessEqual[t, 2.65e-83]], $MachinePrecision]], N[(1.0 - N[(x / N[(t * N[(z - y), $MachinePrecision]), $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 -8.6 \cdot 10^{-138} \lor \neg \left(t \leq 2.65 \cdot 10^{-83}\right):\\
\;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{y \cdot \left(z - y\right)}\\
\end{array}
\end{array}
if t < -8.6000000000000001e-138 or 2.65e-83 < t Initial program 99.4%
*-commutative99.4%
sub-neg99.4%
distribute-lft-in89.5%
Applied egg-rr89.5%
Taylor expanded in t around inf 92.8%
neg-mul-192.8%
unsub-neg92.8%
Simplified92.8%
if -8.6000000000000001e-138 < t < 2.65e-83Initial program 97.2%
Taylor expanded in t around 0 81.5%
Final simplification89.5%
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.3e-103) 1.0 (if (<= y 1.12e-18) (+ 1.0 (* (/ x t) (/ -1.0 z))) 1.0)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.3e-103) {
tmp = 1.0;
} else if (y <= 1.12e-18) {
tmp = 1.0 + ((x / t) * (-1.0 / z));
} 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.3d-103)) then
tmp = 1.0d0
else if (y <= 1.12d-18) then
tmp = 1.0d0 + ((x / t) * ((-1.0d0) / z))
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.3e-103) {
tmp = 1.0;
} else if (y <= 1.12e-18) {
tmp = 1.0 + ((x / t) * (-1.0 / z));
} 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.3e-103: tmp = 1.0 elif y <= 1.12e-18: tmp = 1.0 + ((x / t) * (-1.0 / z)) 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.3e-103) tmp = 1.0; elseif (y <= 1.12e-18) tmp = Float64(1.0 + Float64(Float64(x / t) * Float64(-1.0 / z))); 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.3e-103)
tmp = 1.0;
elseif (y <= 1.12e-18)
tmp = 1.0 + ((x / t) * (-1.0 / z));
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.3e-103], 1.0, If[LessEqual[y, 1.12e-18], N[(1.0 + N[(N[(x / t), $MachinePrecision] * N[(-1.0 / z), $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 -1.3 \cdot 10^{-103}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.12 \cdot 10^{-18}:\\
\;\;\;\;1 + \frac{x}{t} \cdot \frac{-1}{z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.29999999999999998e-103 or 1.12000000000000001e-18 < y Initial program 100.0%
Taylor expanded in z around 0 90.5%
*-commutative90.5%
associate-/r*90.5%
Simplified90.5%
Taylor expanded in y around 0 72.3%
mul-1-neg72.3%
distribute-neg-frac272.3%
Simplified72.3%
add072.3%
associate-/l/72.3%
add-sqr-sqrt40.5%
sqrt-unprod64.5%
sqr-neg64.5%
sqrt-unprod30.9%
add-sqr-sqrt69.5%
Applied egg-rr69.5%
associate-/r*69.5%
add069.5%
Simplified69.5%
Taylor expanded in x around 0 87.6%
if -1.29999999999999998e-103 < y < 1.12000000000000001e-18Initial program 96.6%
Taylor expanded in y around 0 76.0%
associate-/r*74.8%
div-inv74.8%
Applied egg-rr74.8%
Final simplification83.0%
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 -3.5e+16) 1.0 (if (<= y 8.4e+56) (- 1.0 (/ x (* t (- z y)))) (- 1.0 (/ (/ x y) y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.5e+16) {
tmp = 1.0;
} else if (y <= 8.4e+56) {
tmp = 1.0 - (x / (t * (z - y)));
} else {
tmp = 1.0 - ((x / y) / 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 (y <= (-3.5d+16)) then
tmp = 1.0d0
else if (y <= 8.4d+56) then
tmp = 1.0d0 - (x / (t * (z - y)))
else
tmp = 1.0d0 - ((x / y) / 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 (y <= -3.5e+16) {
tmp = 1.0;
} else if (y <= 8.4e+56) {
tmp = 1.0 - (x / (t * (z - y)));
} else {
tmp = 1.0 - ((x / y) / y);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if y <= -3.5e+16: tmp = 1.0 elif y <= 8.4e+56: tmp = 1.0 - (x / (t * (z - y))) else: tmp = 1.0 - ((x / y) / y) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -3.5e+16) tmp = 1.0; elseif (y <= 8.4e+56) tmp = Float64(1.0 - Float64(x / Float64(t * Float64(z - y)))); else tmp = Float64(1.0 - Float64(Float64(x / y) / 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 (y <= -3.5e+16)
tmp = 1.0;
elseif (y <= 8.4e+56)
tmp = 1.0 - (x / (t * (z - y)));
else
tmp = 1.0 - ((x / y) / 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[y, -3.5e+16], 1.0, If[LessEqual[y, 8.4e+56], N[(1.0 - N[(x / N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{+16}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 8.4 \cdot 10^{+56}:\\
\;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y}\\
\end{array}
\end{array}
if y < -3.5e16Initial program 100.0%
Taylor expanded in z around 0 95.3%
*-commutative95.3%
associate-/r*95.3%
Simplified95.3%
Taylor expanded in y around 0 76.1%
mul-1-neg76.1%
distribute-neg-frac276.1%
Simplified76.1%
add076.1%
associate-/l/76.2%
add-sqr-sqrt38.1%
sqrt-unprod64.3%
sqr-neg64.3%
sqrt-unprod38.2%
add-sqr-sqrt75.7%
Applied egg-rr75.7%
associate-/r*75.7%
add075.7%
Simplified75.7%
Taylor expanded in x around 0 96.4%
if -3.5e16 < y < 8.40000000000000068e56Initial program 97.7%
*-commutative97.7%
sub-neg97.7%
distribute-lft-in97.7%
Applied egg-rr97.7%
Taylor expanded in t around inf 80.3%
neg-mul-180.3%
unsub-neg80.3%
Simplified80.3%
if 8.40000000000000068e56 < y Initial program 100.0%
Taylor expanded in z around 0 100.0%
*-commutative100.0%
associate-/r*100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
Final simplification88.5%
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 -8.6e-138)
(- 1.0 (/ (/ x t) (+ y z)))
(if (<= t 2.1e-83)
(+ 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 <= -8.6e-138) {
tmp = 1.0 - ((x / t) / (y + z));
} else if (t <= 2.1e-83) {
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 <= (-8.6d-138)) then
tmp = 1.0d0 - ((x / t) / (y + z))
else if (t <= 2.1d-83) 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 <= -8.6e-138) {
tmp = 1.0 - ((x / t) / (y + z));
} else if (t <= 2.1e-83) {
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 <= -8.6e-138: tmp = 1.0 - ((x / t) / (y + z)) elif t <= 2.1e-83: 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 <= -8.6e-138) tmp = Float64(1.0 - Float64(Float64(x / t) / Float64(y + z))); elseif (t <= 2.1e-83) 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 <= -8.6e-138)
tmp = 1.0 - ((x / t) / (y + z));
elseif (t <= 2.1e-83)
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, -8.6e-138], N[(1.0 - N[(N[(x / t), $MachinePrecision] / N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.1e-83], 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 -8.6 \cdot 10^{-138}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{y + z}\\
\mathbf{elif}\;t \leq 2.1 \cdot 10^{-83}:\\
\;\;\;\;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 < -8.6000000000000001e-138Initial program 99.0%
Taylor expanded in t around inf 91.9%
associate-*r/91.9%
neg-mul-191.9%
Simplified91.9%
add091.9%
associate-/r*92.8%
add-sqr-sqrt55.2%
sqrt-unprod69.9%
sqr-neg69.9%
sqrt-unprod32.5%
add-sqr-sqrt77.6%
sub-neg77.6%
add-sqr-sqrt43.1%
sqrt-unprod81.4%
sqr-neg81.4%
sqrt-unprod38.6%
add-sqr-sqrt87.2%
Applied egg-rr87.2%
add087.2%
+-commutative87.2%
Simplified87.2%
if -8.6000000000000001e-138 < t < 2.0999999999999999e-83Initial program 97.2%
Taylor expanded in t around 0 81.5%
if 2.0999999999999999e-83 < t Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
distribute-lft-in83.9%
Applied egg-rr83.9%
Taylor expanded in t around inf 94.1%
neg-mul-194.1%
unsub-neg94.1%
Simplified94.1%
Final simplification87.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 (<= z -1.7e-145)
(+ 1.0 (/ x (* (- y t) z)))
(if (<= z 3.5e-206)
(+ 1.0 (/ (/ x (- t y)) 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 <= -1.7e-145) {
tmp = 1.0 + (x / ((y - t) * z));
} else if (z <= 3.5e-206) {
tmp = 1.0 + ((x / (t - y)) / 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 <= (-1.7d-145)) then
tmp = 1.0d0 + (x / ((y - t) * z))
else if (z <= 3.5d-206) then
tmp = 1.0d0 + ((x / (t - y)) / 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 <= -1.7e-145) {
tmp = 1.0 + (x / ((y - t) * z));
} else if (z <= 3.5e-206) {
tmp = 1.0 + ((x / (t - y)) / 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 <= -1.7e-145: tmp = 1.0 + (x / ((y - t) * z)) elif z <= 3.5e-206: tmp = 1.0 + ((x / (t - y)) / 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 <= -1.7e-145) tmp = Float64(1.0 + Float64(x / Float64(Float64(y - t) * z))); elseif (z <= 3.5e-206) tmp = Float64(1.0 + Float64(Float64(x / Float64(t - y)) / 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 <= -1.7e-145)
tmp = 1.0 + (x / ((y - t) * z));
elseif (z <= 3.5e-206)
tmp = 1.0 + ((x / (t - y)) / 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, -1.7e-145], N[(1.0 + N[(x / N[(N[(y - t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.5e-206], N[(1.0 + N[(N[(x / N[(t - y), $MachinePrecision]), $MachinePrecision] / y), $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 -1.7 \cdot 10^{-145}:\\
\;\;\;\;1 + \frac{x}{\left(y - t\right) \cdot z}\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-206}:\\
\;\;\;\;1 + \frac{\frac{x}{t - y}}{y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\
\end{array}
\end{array}
if z < -1.6999999999999999e-145Initial program 99.8%
Taylor expanded in z around inf 94.5%
associate-*r/94.5%
neg-mul-194.5%
*-commutative94.5%
Simplified94.5%
if -1.6999999999999999e-145 < z < 3.49999999999999989e-206Initial program 95.3%
Taylor expanded in z around 0 95.3%
*-commutative95.3%
associate-/r*96.2%
Simplified96.2%
if 3.49999999999999989e-206 < z Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
distribute-lft-in92.2%
Applied egg-rr92.2%
Taylor expanded in t around inf 74.5%
neg-mul-174.5%
unsub-neg74.5%
Simplified74.5%
Final simplification86.8%
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 -1.7e-145)
(- 1.0 (* (/ -1.0 (- y t)) (/ x z)))
(if (<= z 5.8e-208)
(+ 1.0 (/ (/ x (- t y)) 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 <= -1.7e-145) {
tmp = 1.0 - ((-1.0 / (y - t)) * (x / z));
} else if (z <= 5.8e-208) {
tmp = 1.0 + ((x / (t - y)) / 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 <= (-1.7d-145)) then
tmp = 1.0d0 - (((-1.0d0) / (y - t)) * (x / z))
else if (z <= 5.8d-208) then
tmp = 1.0d0 + ((x / (t - y)) / 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 <= -1.7e-145) {
tmp = 1.0 - ((-1.0 / (y - t)) * (x / z));
} else if (z <= 5.8e-208) {
tmp = 1.0 + ((x / (t - y)) / 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 <= -1.7e-145: tmp = 1.0 - ((-1.0 / (y - t)) * (x / z)) elif z <= 5.8e-208: tmp = 1.0 + ((x / (t - y)) / 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 <= -1.7e-145) tmp = Float64(1.0 - Float64(Float64(-1.0 / Float64(y - t)) * Float64(x / z))); elseif (z <= 5.8e-208) tmp = Float64(1.0 + Float64(Float64(x / Float64(t - y)) / 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 <= -1.7e-145)
tmp = 1.0 - ((-1.0 / (y - t)) * (x / z));
elseif (z <= 5.8e-208)
tmp = 1.0 + ((x / (t - y)) / 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, -1.7e-145], N[(1.0 - N[(N[(-1.0 / N[(y - t), $MachinePrecision]), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.8e-208], N[(1.0 + N[(N[(x / N[(t - y), $MachinePrecision]), $MachinePrecision] / y), $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 -1.7 \cdot 10^{-145}:\\
\;\;\;\;1 - \frac{-1}{y - t} \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{-208}:\\
\;\;\;\;1 + \frac{\frac{x}{t - y}}{y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\
\end{array}
\end{array}
if z < -1.6999999999999999e-145Initial program 99.8%
Taylor expanded in z around inf 94.5%
associate-*r/94.5%
neg-mul-194.5%
*-commutative94.5%
Simplified94.5%
neg-mul-194.5%
times-frac94.5%
Applied egg-rr94.5%
if -1.6999999999999999e-145 < z < 5.7999999999999999e-208Initial program 95.3%
Taylor expanded in z around 0 95.3%
*-commutative95.3%
associate-/r*96.2%
Simplified96.2%
if 5.7999999999999999e-208 < z Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
distribute-lft-in92.2%
Applied egg-rr92.2%
Taylor expanded in t around inf 74.5%
neg-mul-174.5%
unsub-neg74.5%
Simplified74.5%
Final simplification86.8%
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.2e-110) 1.0 (if (<= y 1.12e-18) (- 1.0 (/ x (* t z))) 1.0)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5.2e-110) {
tmp = 1.0;
} else if (y <= 1.12e-18) {
tmp = 1.0 - (x / (t * z));
} 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.2d-110)) then
tmp = 1.0d0
else if (y <= 1.12d-18) then
tmp = 1.0d0 - (x / (t * z))
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.2e-110) {
tmp = 1.0;
} else if (y <= 1.12e-18) {
tmp = 1.0 - (x / (t * z));
} 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.2e-110: tmp = 1.0 elif y <= 1.12e-18: tmp = 1.0 - (x / (t * z)) 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.2e-110) tmp = 1.0; elseif (y <= 1.12e-18) tmp = Float64(1.0 - Float64(x / Float64(t * z))); 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.2e-110)
tmp = 1.0;
elseif (y <= 1.12e-18)
tmp = 1.0 - (x / (t * z));
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.2e-110], 1.0, If[LessEqual[y, 1.12e-18], N[(1.0 - N[(x / N[(t * z), $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.2 \cdot 10^{-110}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.12 \cdot 10^{-18}:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -5.19999999999999979e-110 or 1.12000000000000001e-18 < y Initial program 100.0%
Taylor expanded in z around 0 90.5%
*-commutative90.5%
associate-/r*90.5%
Simplified90.5%
Taylor expanded in y around 0 72.3%
mul-1-neg72.3%
distribute-neg-frac272.3%
Simplified72.3%
add072.3%
associate-/l/72.3%
add-sqr-sqrt40.5%
sqrt-unprod64.5%
sqr-neg64.5%
sqrt-unprod30.9%
add-sqr-sqrt69.5%
Applied egg-rr69.5%
associate-/r*69.5%
add069.5%
Simplified69.5%
Taylor expanded in x around 0 87.6%
if -5.19999999999999979e-110 < y < 1.12000000000000001e-18Initial program 96.6%
Taylor expanded in y around 0 76.0%
Final simplification83.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 -1.7e-147) 1.0 (+ 1.0 (/ x (* y t)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.7e-147) {
tmp = 1.0;
} else {
tmp = 1.0 + (x / (y * 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 (z <= (-1.7d-147)) then
tmp = 1.0d0
else
tmp = 1.0d0 + (x / (y * 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 (z <= -1.7e-147) {
tmp = 1.0;
} else {
tmp = 1.0 + (x / (y * t));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= -1.7e-147: tmp = 1.0 else: tmp = 1.0 + (x / (y * t)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= -1.7e-147) tmp = 1.0; else tmp = Float64(1.0 + Float64(x / Float64(y * 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 (z <= -1.7e-147)
tmp = 1.0;
else
tmp = 1.0 + (x / (y * 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[LessEqual[z, -1.7e-147], 1.0, N[(1.0 + N[(x / N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{-147}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{y \cdot t}\\
\end{array}
\end{array}
if z < -1.69999999999999998e-147Initial program 99.8%
Taylor expanded in z around 0 64.8%
*-commutative64.8%
associate-/r*64.8%
Simplified64.8%
Taylor expanded in y around 0 57.3%
mul-1-neg57.3%
distribute-neg-frac257.3%
Simplified57.3%
add057.3%
associate-/l/57.3%
add-sqr-sqrt31.3%
sqrt-unprod58.1%
sqr-neg58.1%
sqrt-unprod26.0%
add-sqr-sqrt56.4%
Applied egg-rr56.4%
associate-/r*56.4%
add056.4%
Simplified56.4%
Taylor expanded in x around 0 77.8%
if -1.69999999999999998e-147 < z Initial program 98.2%
Taylor expanded in z around 0 74.9%
*-commutative74.9%
associate-/r*75.3%
Simplified75.3%
Taylor expanded in y around 0 58.7%
mul-1-neg58.7%
distribute-neg-frac258.7%
Simplified58.7%
add058.7%
associate-/l/58.7%
add-sqr-sqrt32.6%
sqrt-unprod48.6%
sqr-neg48.6%
sqrt-unprod21.7%
add-sqr-sqrt50.0%
Applied egg-rr50.0%
associate-/r*50.1%
add050.1%
Simplified50.1%
sub-neg50.1%
associate-/l/50.0%
distribute-neg-frac50.0%
add-sqr-sqrt29.8%
sqrt-unprod49.8%
sqr-neg49.8%
sqrt-unprod25.4%
add-sqr-sqrt58.7%
Applied egg-rr58.7%
+-commutative58.7%
Simplified58.7%
Final simplification65.5%
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 t) (- z y)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 + (x / ((y - t) * (z - 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 - t) * (z - 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 - t) * (z - y)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + (x / ((y - t) * (z - 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 - t) * Float64(z - y)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + (x / ((y - t) * (z - 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 - t), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \frac{x}{\left(y - t\right) \cdot \left(z - y\right)}
\end{array}
Initial program 98.8%
Final simplification98.8%
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 98.8%
Taylor expanded in z around 0 71.3%
*-commutative71.3%
associate-/r*71.6%
Simplified71.6%
Taylor expanded in y around 0 58.2%
mul-1-neg58.2%
distribute-neg-frac258.2%
Simplified58.2%
add058.2%
associate-/l/58.2%
add-sqr-sqrt32.1%
sqrt-unprod52.0%
sqr-neg52.0%
sqrt-unprod23.2%
add-sqr-sqrt52.3%
Applied egg-rr52.3%
associate-/r*52.3%
add052.3%
Simplified52.3%
Taylor expanded in x around 0 73.4%
Final simplification73.4%
herbie shell --seed 2024046
(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)))))