
(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 10 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 (<= t 2.65e-12) (+ 1.0 (/ (/ x (- z y)) (- y t))) (- 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 <= 2.65e-12) {
tmp = 1.0 + ((x / (z - y)) / (y - t));
} 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 <= 2.65d-12) then
tmp = 1.0d0 + ((x / (z - y)) / (y - t))
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 <= 2.65e-12) {
tmp = 1.0 + ((x / (z - y)) / (y - t));
} 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 <= 2.65e-12: tmp = 1.0 + ((x / (z - y)) / (y - t)) 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 <= 2.65e-12) tmp = Float64(1.0 + Float64(Float64(x / Float64(z - y)) / Float64(y - t))); else tmp = Float64(1.0 - Float64(Float64(x / 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 <= 2.65e-12)
tmp = 1.0 + ((x / (z - y)) / (y - t));
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, 2.65e-12], N[(1.0 + N[(N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / t), $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}\;t \leq 2.65 \cdot 10^{-12}:\\
\;\;\;\;1 + \frac{\frac{x}{z - y}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z - y}\\
\end{array}
\end{array}
if t < 2.64999999999999982e-12Initial program 99.3%
sub-neg99.3%
distribute-frac-neg99.3%
*-lft-identity99.3%
associate-/r*98.9%
associate-*r/98.9%
metadata-eval98.9%
times-frac98.9%
neg-mul-198.9%
remove-double-neg98.9%
neg-mul-198.9%
sub-neg98.9%
distribute-neg-out98.9%
remove-double-neg98.9%
+-commutative98.9%
sub-neg98.9%
Simplified98.9%
if 2.64999999999999982e-12 < t Initial program 99.9%
clear-num99.9%
associate-/r/100.0%
*-commutative100.0%
associate-/r*100.0%
Applied egg-rr100.0%
Taylor expanded in t around inf 100.0%
associate-/r*100.0%
Simplified100.0%
Taylor expanded in t around 0 99.9%
associate-*r/99.9%
associate-*l/100.0%
associate-/r*100.0%
*-rgt-identity100.0%
associate-*r/99.8%
associate-*l/100.0%
associate-*r/100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-/r*100.0%
neg-mul-1100.0%
*-lft-identity100.0%
associate-*l/99.8%
associate-*r/100.0%
*-rgt-identity100.0%
associate-/r/96.0%
associate-/l*99.9%
neg-mul-199.9%
associate-*l/99.9%
*-lft-identity99.9%
associate-/r*99.9%
Simplified99.9%
frac-2neg99.9%
div-inv99.9%
distribute-neg-frac99.9%
frac-2neg99.9%
sub-neg99.9%
distribute-neg-in99.9%
add-sqr-sqrt51.1%
sqrt-unprod95.2%
sqr-neg95.2%
sqrt-unprod42.7%
add-sqr-sqrt90.3%
add-sqr-sqrt47.6%
sqrt-unprod95.2%
sqr-neg95.2%
sqrt-unprod48.7%
add-sqr-sqrt99.9%
Applied egg-rr99.9%
associate-*r/99.9%
*-rgt-identity99.9%
+-commutative99.9%
unsub-neg99.9%
Simplified99.9%
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 (if (or (<= z -6.8e-91) (not (<= z 6.5e-100))) (+ 1.0 (/ x (* z (- y t)))) (+ 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 <= -6.8e-91) || !(z <= 6.5e-100)) {
tmp = 1.0 + (x / (z * (y - t)));
} 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 <= (-6.8d-91)) .or. (.not. (z <= 6.5d-100))) then
tmp = 1.0d0 + (x / (z * (y - t)))
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 <= -6.8e-91) || !(z <= 6.5e-100)) {
tmp = 1.0 + (x / (z * (y - t)));
} 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 <= -6.8e-91) or not (z <= 6.5e-100): tmp = 1.0 + (x / (z * (y - t))) 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 <= -6.8e-91) || !(z <= 6.5e-100)) tmp = Float64(1.0 + Float64(x / Float64(z * Float64(y - t)))); 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 <= -6.8e-91) || ~((z <= 6.5e-100)))
tmp = 1.0 + (x / (z * (y - t)));
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[Or[LessEqual[z, -6.8e-91], N[Not[LessEqual[z, 6.5e-100]], $MachinePrecision]], N[(1.0 + N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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 -6.8 \cdot 10^{-91} \lor \neg \left(z \leq 6.5 \cdot 10^{-100}\right):\\
\;\;\;\;1 + \frac{x}{z \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{y \cdot t}\\
\end{array}
\end{array}
if z < -6.80000000000000053e-91 or 6.50000000000000013e-100 < z Initial program 99.9%
sub-neg99.9%
distribute-frac-neg99.9%
*-lft-identity99.9%
associate-/r*99.4%
associate-*r/99.4%
metadata-eval99.4%
times-frac99.4%
neg-mul-199.4%
remove-double-neg99.4%
neg-mul-199.4%
sub-neg99.4%
distribute-neg-out99.4%
remove-double-neg99.4%
+-commutative99.4%
sub-neg99.4%
Simplified99.4%
Taylor expanded in z around inf 92.8%
*-commutative92.8%
Simplified92.8%
if -6.80000000000000053e-91 < z < 6.50000000000000013e-100Initial program 98.9%
sub-neg98.9%
distribute-frac-neg98.9%
*-lft-identity98.9%
associate-/r*95.1%
associate-*r/95.1%
metadata-eval95.1%
times-frac95.1%
neg-mul-195.1%
remove-double-neg95.1%
neg-mul-195.1%
sub-neg95.1%
distribute-neg-out95.1%
remove-double-neg95.1%
+-commutative95.1%
sub-neg95.1%
Simplified95.1%
Taylor expanded in z around 0 91.7%
mul-1-neg91.7%
distribute-frac-neg91.7%
associate-/r*87.9%
Simplified87.9%
Taylor expanded in y around 0 75.7%
Final simplification86.3%
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 (<= z -2.35e-91) (not (<= z 3e-95))) (+ 1.0 (/ x (* z (- y t)))) (- 1.0 (* x (/ -1.0 (* y t))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.35e-91) || !(z <= 3e-95)) {
tmp = 1.0 + (x / (z * (y - t)));
} else {
tmp = 1.0 - (x * (-1.0 / (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 <= (-2.35d-91)) .or. (.not. (z <= 3d-95))) then
tmp = 1.0d0 + (x / (z * (y - t)))
else
tmp = 1.0d0 - (x * ((-1.0d0) / (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 <= -2.35e-91) || !(z <= 3e-95)) {
tmp = 1.0 + (x / (z * (y - t)));
} else {
tmp = 1.0 - (x * (-1.0 / (y * t)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (z <= -2.35e-91) or not (z <= 3e-95): tmp = 1.0 + (x / (z * (y - t))) else: tmp = 1.0 - (x * (-1.0 / (y * t))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if ((z <= -2.35e-91) || !(z <= 3e-95)) tmp = Float64(1.0 + Float64(x / Float64(z * Float64(y - t)))); else tmp = Float64(1.0 - Float64(x * Float64(-1.0 / 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 <= -2.35e-91) || ~((z <= 3e-95)))
tmp = 1.0 + (x / (z * (y - t)));
else
tmp = 1.0 - (x * (-1.0 / (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[Or[LessEqual[z, -2.35e-91], N[Not[LessEqual[z, 3e-95]], $MachinePrecision]], N[(1.0 + N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x * N[(-1.0 / N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.35 \cdot 10^{-91} \lor \neg \left(z \leq 3 \cdot 10^{-95}\right):\\
\;\;\;\;1 + \frac{x}{z \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - x \cdot \frac{-1}{y \cdot t}\\
\end{array}
\end{array}
if z < -2.35000000000000003e-91 or 3e-95 < z Initial program 99.9%
sub-neg99.9%
distribute-frac-neg99.9%
*-lft-identity99.9%
associate-/r*99.4%
associate-*r/99.4%
metadata-eval99.4%
times-frac99.4%
neg-mul-199.4%
remove-double-neg99.4%
neg-mul-199.4%
sub-neg99.4%
distribute-neg-out99.4%
remove-double-neg99.4%
+-commutative99.4%
sub-neg99.4%
Simplified99.4%
Taylor expanded in z around inf 92.7%
*-commutative92.7%
Simplified92.7%
if -2.35000000000000003e-91 < z < 3e-95Initial program 98.9%
clear-num98.9%
associate-/r/98.9%
*-commutative98.9%
associate-/r*98.9%
Applied egg-rr98.9%
Taylor expanded in t around inf 81.0%
associate-/r*81.0%
Simplified81.0%
Taylor expanded in y around inf 75.0%
Final simplification85.9%
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 (<= z -6.5e-38) (not (<= z 1.36e-95))) (+ 1.0 (/ x (* z (- y t)))) (- 1.0 (/ x (* y (- y t))))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.5e-38) || !(z <= 1.36e-95)) {
tmp = 1.0 + (x / (z * (y - t)));
} else {
tmp = 1.0 - (x / (y * (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 <= (-6.5d-38)) .or. (.not. (z <= 1.36d-95))) then
tmp = 1.0d0 + (x / (z * (y - t)))
else
tmp = 1.0d0 - (x / (y * (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 <= -6.5e-38) || !(z <= 1.36e-95)) {
tmp = 1.0 + (x / (z * (y - t)));
} else {
tmp = 1.0 - (x / (y * (y - t)));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (z <= -6.5e-38) or not (z <= 1.36e-95): tmp = 1.0 + (x / (z * (y - t))) else: tmp = 1.0 - (x / (y * (y - t))) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if ((z <= -6.5e-38) || !(z <= 1.36e-95)) tmp = Float64(1.0 + Float64(x / Float64(z * Float64(y - t)))); else tmp = Float64(1.0 - Float64(x / Float64(y * 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 <= -6.5e-38) || ~((z <= 1.36e-95)))
tmp = 1.0 + (x / (z * (y - t)));
else
tmp = 1.0 - (x / (y * (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[Or[LessEqual[z, -6.5e-38], N[Not[LessEqual[z, 1.36e-95]], $MachinePrecision]], N[(1.0 + N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(y * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{-38} \lor \neg \left(z \leq 1.36 \cdot 10^{-95}\right):\\
\;\;\;\;1 + \frac{x}{z \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\
\end{array}
\end{array}
if z < -6.49999999999999949e-38 or 1.36e-95 < z Initial program 99.9%
sub-neg99.9%
distribute-frac-neg99.9%
*-lft-identity99.9%
associate-/r*99.3%
associate-*r/99.3%
metadata-eval99.3%
times-frac99.3%
neg-mul-199.3%
remove-double-neg99.3%
neg-mul-199.3%
sub-neg99.3%
distribute-neg-out99.3%
remove-double-neg99.3%
+-commutative99.3%
sub-neg99.3%
Simplified99.3%
Taylor expanded in z around inf 95.5%
*-commutative95.5%
Simplified95.5%
if -6.49999999999999949e-38 < z < 1.36e-95Initial program 99.0%
Taylor expanded in z around 0 91.7%
Final simplification93.9%
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 -4.1e-40)
(+ 1.0 (/ x (* z (- y t))))
(if (<= z 8.5e-132)
(- 1.0 (/ x (* y (- y t))))
(- 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 <= -4.1e-40) {
tmp = 1.0 + (x / (z * (y - t)));
} else if (z <= 8.5e-132) {
tmp = 1.0 - (x / (y * (y - t)));
} 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 <= (-4.1d-40)) then
tmp = 1.0d0 + (x / (z * (y - t)))
else if (z <= 8.5d-132) then
tmp = 1.0d0 - (x / (y * (y - t)))
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 <= -4.1e-40) {
tmp = 1.0 + (x / (z * (y - t)));
} else if (z <= 8.5e-132) {
tmp = 1.0 - (x / (y * (y - t)));
} 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 <= -4.1e-40: tmp = 1.0 + (x / (z * (y - t))) elif z <= 8.5e-132: tmp = 1.0 - (x / (y * (y - t))) 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 <= -4.1e-40) tmp = Float64(1.0 + Float64(x / Float64(z * Float64(y - t)))); elseif (z <= 8.5e-132) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - t)))); else tmp = Float64(1.0 - Float64(Float64(x / 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 <= -4.1e-40)
tmp = 1.0 + (x / (z * (y - t)));
elseif (z <= 8.5e-132)
tmp = 1.0 - (x / (y * (y - t)));
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, -4.1e-40], N[(1.0 + N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.5e-132], N[(1.0 - N[(x / N[(y * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / t), $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 -4.1 \cdot 10^{-40}:\\
\;\;\;\;1 + \frac{x}{z \cdot \left(y - t\right)}\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-132}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z - y}\\
\end{array}
\end{array}
if z < -4.09999999999999963e-40Initial program 99.9%
sub-neg99.9%
distribute-frac-neg99.9%
*-lft-identity99.9%
associate-/r*99.9%
associate-*r/99.9%
metadata-eval99.9%
times-frac99.9%
neg-mul-199.9%
remove-double-neg99.9%
neg-mul-199.9%
sub-neg99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in z around inf 97.9%
*-commutative97.9%
Simplified97.9%
if -4.09999999999999963e-40 < z < 8.49999999999999988e-132Initial program 98.9%
Taylor expanded in z around 0 93.7%
if 8.49999999999999988e-132 < z Initial program 99.9%
clear-num99.9%
associate-/r/99.9%
*-commutative99.9%
associate-/r*99.9%
Applied egg-rr99.9%
Taylor expanded in t around inf 73.5%
associate-/r*73.5%
Simplified73.5%
Taylor expanded in t around 0 73.5%
associate-*r/73.5%
associate-*l/73.5%
associate-/r*73.5%
*-rgt-identity73.5%
associate-*r/73.5%
associate-*l/73.5%
associate-*r/73.5%
metadata-eval73.5%
metadata-eval73.5%
associate-/r*73.5%
neg-mul-173.5%
*-lft-identity73.5%
associate-*l/73.5%
associate-*r/73.5%
*-rgt-identity73.5%
associate-/r/73.0%
associate-/l*73.3%
neg-mul-173.3%
associate-*l/73.4%
*-lft-identity73.4%
associate-/r*73.4%
Simplified73.4%
frac-2neg73.4%
div-inv73.3%
distribute-neg-frac73.3%
frac-2neg73.3%
sub-neg73.3%
distribute-neg-in73.3%
add-sqr-sqrt0.0%
sqrt-unprod61.0%
sqr-neg61.0%
sqrt-unprod61.1%
add-sqr-sqrt61.1%
add-sqr-sqrt0.0%
sqrt-unprod73.2%
sqr-neg73.2%
sqrt-unprod73.3%
add-sqr-sqrt73.3%
Applied egg-rr73.3%
associate-*r/73.4%
*-rgt-identity73.4%
+-commutative73.4%
unsub-neg73.4%
Simplified73.4%
Final simplification88.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 (<= z -0.017) (+ 1.0 (/ (/ x z) y)) (if (<= z 1.55e-95) (+ 1.0 (/ x (* y t))) (- 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 (z <= -0.017) {
tmp = 1.0 + ((x / z) / y);
} else if (z <= 1.55e-95) {
tmp = 1.0 + (x / (y * t));
} 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 (z <= (-0.017d0)) then
tmp = 1.0d0 + ((x / z) / y)
else if (z <= 1.55d-95) then
tmp = 1.0d0 + (x / (y * t))
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 (z <= -0.017) {
tmp = 1.0 + ((x / z) / y);
} else if (z <= 1.55e-95) {
tmp = 1.0 + (x / (y * t));
} 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 z <= -0.017: tmp = 1.0 + ((x / z) / y) elif z <= 1.55e-95: tmp = 1.0 + (x / (y * t)) 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 (z <= -0.017) tmp = Float64(1.0 + Float64(Float64(x / z) / y)); elseif (z <= 1.55e-95) tmp = Float64(1.0 + Float64(x / Float64(y * t))); 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 (z <= -0.017)
tmp = 1.0 + ((x / z) / y);
elseif (z <= 1.55e-95)
tmp = 1.0 + (x / (y * t));
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[LessEqual[z, -0.017], N[(1.0 + N[(N[(x / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.55e-95], N[(1.0 + N[(x / N[(y * t), $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}\;z \leq -0.017:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y}\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{-95}:\\
\;\;\;\;1 + \frac{x}{y \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\end{array}
\end{array}
if z < -0.017000000000000001Initial program 99.9%
sub-neg99.9%
distribute-frac-neg99.9%
*-lft-identity99.9%
associate-/r*99.9%
associate-*r/99.9%
metadata-eval99.9%
times-frac99.9%
neg-mul-199.9%
remove-double-neg99.9%
neg-mul-199.9%
sub-neg99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in z around inf 98.4%
associate-/r*98.4%
Simplified98.4%
Taylor expanded in y around inf 76.6%
*-commutative76.6%
Simplified76.6%
Taylor expanded in x around 0 76.6%
associate-/l/76.6%
Simplified76.6%
if -0.017000000000000001 < z < 1.54999999999999996e-95Initial program 99.0%
sub-neg99.0%
distribute-frac-neg99.0%
*-lft-identity99.0%
associate-/r*95.8%
associate-*r/95.8%
metadata-eval95.8%
times-frac95.8%
neg-mul-195.8%
remove-double-neg95.8%
neg-mul-195.8%
sub-neg95.8%
distribute-neg-out95.8%
remove-double-neg95.8%
+-commutative95.8%
sub-neg95.8%
Simplified95.8%
Taylor expanded in z around 0 90.4%
mul-1-neg90.4%
distribute-frac-neg90.4%
associate-/r*87.1%
Simplified87.1%
Taylor expanded in y around 0 74.0%
if 1.54999999999999996e-95 < z Initial program 99.9%
Taylor expanded in y around 0 68.8%
Final simplification73.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 (/ x (* (- y z) (- y t)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (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 / ((y - z) * (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 / ((y - z) * (y - t)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 - (x / ((y - z) * (y - t)))
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(y - t)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - (x / ((y - z) * (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[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $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(y - t\right)}
\end{array}
Initial program 99.5%
Final simplification99.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 (<= z -0.37) (+ 1.0 (/ x (* y z))) (+ 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 <= -0.37) {
tmp = 1.0 + (x / (y * z));
} 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 <= (-0.37d0)) then
tmp = 1.0d0 + (x / (y * z))
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 <= -0.37) {
tmp = 1.0 + (x / (y * z));
} 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 <= -0.37: tmp = 1.0 + (x / (y * z)) 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 <= -0.37) tmp = Float64(1.0 + Float64(x / Float64(y * z))); 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 <= -0.37)
tmp = 1.0 + (x / (y * z));
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, -0.37], N[(1.0 + N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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 -0.37:\\
\;\;\;\;1 + \frac{x}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{y \cdot t}\\
\end{array}
\end{array}
if z < -0.37Initial program 99.9%
sub-neg99.9%
distribute-frac-neg99.9%
*-lft-identity99.9%
associate-/r*99.9%
associate-*r/99.9%
metadata-eval99.9%
times-frac99.9%
neg-mul-199.9%
remove-double-neg99.9%
neg-mul-199.9%
sub-neg99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in z around inf 98.4%
associate-/r*98.4%
Simplified98.4%
Taylor expanded in y around inf 77.7%
*-commutative77.7%
Simplified77.7%
if -0.37 < z Initial program 99.4%
sub-neg99.4%
distribute-frac-neg99.4%
*-lft-identity99.4%
associate-/r*97.0%
associate-*r/97.0%
metadata-eval97.0%
times-frac97.0%
neg-mul-197.0%
remove-double-neg97.0%
neg-mul-197.0%
sub-neg97.0%
distribute-neg-out97.0%
remove-double-neg97.0%
+-commutative97.0%
sub-neg97.0%
Simplified97.0%
Taylor expanded in z around 0 77.8%
mul-1-neg77.8%
distribute-frac-neg77.8%
associate-/r*75.9%
Simplified75.9%
Taylor expanded in y around 0 62.3%
Final simplification66.3%
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.3) (+ 1.0 (/ (/ x z) y)) (+ 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 <= -0.3) {
tmp = 1.0 + ((x / z) / y);
} 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 <= (-0.3d0)) then
tmp = 1.0d0 + ((x / z) / y)
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 <= -0.3) {
tmp = 1.0 + ((x / z) / y);
} 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 <= -0.3: tmp = 1.0 + ((x / z) / y) 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 <= -0.3) tmp = Float64(1.0 + Float64(Float64(x / z) / y)); 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 <= -0.3)
tmp = 1.0 + ((x / z) / y);
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, -0.3], N[(1.0 + N[(N[(x / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 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 -0.3:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{y \cdot t}\\
\end{array}
\end{array}
if z < -0.299999999999999989Initial program 99.9%
sub-neg99.9%
distribute-frac-neg99.9%
*-lft-identity99.9%
associate-/r*99.9%
associate-*r/99.9%
metadata-eval99.9%
times-frac99.9%
neg-mul-199.9%
remove-double-neg99.9%
neg-mul-199.9%
sub-neg99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in z around inf 98.4%
associate-/r*98.4%
Simplified98.4%
Taylor expanded in y around inf 77.7%
*-commutative77.7%
Simplified77.7%
Taylor expanded in x around 0 77.7%
associate-/l/77.7%
Simplified77.7%
if -0.299999999999999989 < z Initial program 99.4%
sub-neg99.4%
distribute-frac-neg99.4%
*-lft-identity99.4%
associate-/r*97.0%
associate-*r/97.0%
metadata-eval97.0%
times-frac97.0%
neg-mul-197.0%
remove-double-neg97.0%
neg-mul-197.0%
sub-neg97.0%
distribute-neg-out97.0%
remove-double-neg97.0%
+-commutative97.0%
sub-neg97.0%
Simplified97.0%
Taylor expanded in z around 0 77.8%
mul-1-neg77.8%
distribute-frac-neg77.8%
associate-/r*75.9%
Simplified75.9%
Taylor expanded in y around 0 62.3%
Final simplification66.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 t))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 + (x / (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 / (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 / (y * t));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + (x / (y * t))
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(x / 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 / (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[(x / N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + \frac{x}{y \cdot t}
\end{array}
Initial program 99.5%
sub-neg99.5%
distribute-frac-neg99.5%
*-lft-identity99.5%
associate-/r*97.7%
associate-*r/97.7%
metadata-eval97.7%
times-frac97.7%
neg-mul-197.7%
remove-double-neg97.7%
neg-mul-197.7%
sub-neg97.7%
distribute-neg-out97.7%
remove-double-neg97.7%
+-commutative97.7%
sub-neg97.7%
Simplified97.7%
Taylor expanded in z around 0 75.3%
mul-1-neg75.3%
distribute-frac-neg75.3%
associate-/r*73.8%
Simplified73.8%
Taylor expanded in y around 0 60.9%
Final simplification60.9%
herbie shell --seed 2023322
(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)))))