
(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 1.05e+67) (+ 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 <= 1.05e+67) {
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 <= 1.05d+67) 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 <= 1.05e+67) {
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 <= 1.05e+67: 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 <= 1.05e+67) 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 <= 1.05e+67)
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, 1.05e+67], 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 1.05 \cdot 10^{+67}:\\
\;\;\;\;1 + \frac{\frac{x}{z - y}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z - y}\\
\end{array}
\end{array}
if t < 1.0500000000000001e67Initial program 99.4%
sub-neg99.4%
neg-mul-199.4%
*-commutative99.4%
*-commutative99.4%
associate-/r*99.4%
associate-*r/99.4%
metadata-eval99.4%
times-frac99.4%
*-lft-identity99.4%
neg-mul-199.4%
sub-neg99.4%
+-commutative99.4%
distribute-neg-out99.4%
remove-double-neg99.4%
sub-neg99.4%
Simplified99.4%
if 1.0500000000000001e67 < t Initial program 98.9%
sub-neg98.9%
neg-mul-198.9%
*-commutative98.9%
*-commutative98.9%
associate-/r*98.2%
associate-*r/98.2%
metadata-eval98.2%
times-frac98.2%
*-lft-identity98.2%
neg-mul-198.2%
sub-neg98.2%
+-commutative98.2%
distribute-neg-out98.2%
remove-double-neg98.2%
sub-neg98.2%
Simplified98.2%
Taylor expanded in t around inf 98.9%
mul-1-neg98.9%
unsub-neg98.9%
associate-/r*100.0%
Simplified100.0%
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 (or (<= y -2.1e-28) (not (<= y 8.6e-29))) (+ 1.0 (/ (/ x y) (- z y))) (+ 1.0 (/ (/ x z) (- y t)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.1e-28) || !(y <= 8.6e-29)) {
tmp = 1.0 + ((x / y) / (z - y));
} else {
tmp = 1.0 + ((x / z) / (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 ((y <= (-2.1d-28)) .or. (.not. (y <= 8.6d-29))) then
tmp = 1.0d0 + ((x / y) / (z - y))
else
tmp = 1.0d0 + ((x / z) / (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 ((y <= -2.1e-28) || !(y <= 8.6e-29)) {
tmp = 1.0 + ((x / y) / (z - y));
} else {
tmp = 1.0 + ((x / z) / (y - t));
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (y <= -2.1e-28) or not (y <= 8.6e-29): tmp = 1.0 + ((x / y) / (z - y)) else: tmp = 1.0 + ((x / z) / (y - t)) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if ((y <= -2.1e-28) || !(y <= 8.6e-29)) tmp = Float64(1.0 + Float64(Float64(x / y) / Float64(z - y))); else tmp = Float64(1.0 + Float64(Float64(x / z) / 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 ((y <= -2.1e-28) || ~((y <= 8.6e-29)))
tmp = 1.0 + ((x / y) / (z - y));
else
tmp = 1.0 + ((x / z) / (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[y, -2.1e-28], N[Not[LessEqual[y, 8.6e-29]], $MachinePrecision]], N[(1.0 + N[(N[(x / y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.1 \cdot 10^{-28} \lor \neg \left(y \leq 8.6 \cdot 10^{-29}\right):\\
\;\;\;\;1 + \frac{\frac{x}{y}}{z - y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\end{array}
\end{array}
if y < -2.10000000000000006e-28 or 8.5999999999999996e-29 < y Initial program 99.9%
sub-neg99.9%
neg-mul-199.9%
*-commutative99.9%
*-commutative99.9%
associate-/r*99.9%
associate-*r/99.9%
metadata-eval99.9%
times-frac99.9%
*-lft-identity99.9%
neg-mul-199.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
div-inv99.9%
*-un-lft-identity99.9%
times-frac99.9%
Applied egg-rr99.9%
Taylor expanded in t around 0 93.9%
+-commutative93.9%
associate-/r*93.9%
Simplified93.9%
if -2.10000000000000006e-28 < y < 8.5999999999999996e-29Initial program 98.5%
sub-neg98.5%
neg-mul-198.5%
*-commutative98.5%
*-commutative98.5%
associate-/r*98.2%
associate-*r/98.2%
metadata-eval98.2%
times-frac98.2%
*-lft-identity98.2%
neg-mul-198.2%
sub-neg98.2%
+-commutative98.2%
distribute-neg-out98.2%
remove-double-neg98.2%
sub-neg98.2%
Simplified98.2%
Taylor expanded in z around inf 87.8%
Final simplification91.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 (<= y -3.5e-10) 1.0 (if (<= y 8e+29) (+ 1.0 (/ (/ x z) (- y t))) 1.0)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.5e-10) {
tmp = 1.0;
} else if (y <= 8e+29) {
tmp = 1.0 + ((x / z) / (y - 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 <= (-3.5d-10)) then
tmp = 1.0d0
else if (y <= 8d+29) then
tmp = 1.0d0 + ((x / z) / (y - 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 <= -3.5e-10) {
tmp = 1.0;
} else if (y <= 8e+29) {
tmp = 1.0 + ((x / z) / (y - 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 <= -3.5e-10: tmp = 1.0 elif y <= 8e+29: tmp = 1.0 + ((x / z) / (y - 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 <= -3.5e-10) tmp = 1.0; elseif (y <= 8e+29) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - 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 <= -3.5e-10)
tmp = 1.0;
elseif (y <= 8e+29)
tmp = 1.0 + ((x / z) / (y - 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, -3.5e-10], 1.0, If[LessEqual[y, 8e+29], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - 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 -3.5 \cdot 10^{-10}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+29}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -3.4999999999999998e-10 or 7.99999999999999931e29 < y Initial program 100.0%
sub-neg100.0%
neg-mul-1100.0%
*-commutative100.0%
*-commutative100.0%
associate-/r*100.0%
associate-*r/100.0%
metadata-eval100.0%
times-frac100.0%
*-lft-identity100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 92.4%
if -3.4999999999999998e-10 < y < 7.99999999999999931e29Initial program 98.7%
sub-neg98.7%
neg-mul-198.7%
*-commutative98.7%
*-commutative98.7%
associate-/r*98.5%
associate-*r/98.5%
metadata-eval98.5%
times-frac98.5%
*-lft-identity98.5%
neg-mul-198.5%
sub-neg98.5%
+-commutative98.5%
distribute-neg-out98.5%
remove-double-neg98.5%
sub-neg98.5%
Simplified98.5%
Taylor expanded in z around inf 84.2%
Final simplification88.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 -8.5e-82)
(+ 1.0 (/ (/ x z) (- y t)))
(if (<= z 5.8e-229)
(- 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 <= -8.5e-82) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 5.8e-229) {
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 <= (-8.5d-82)) then
tmp = 1.0d0 + ((x / z) / (y - t))
else if (z <= 5.8d-229) 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 <= -8.5e-82) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 5.8e-229) {
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 <= -8.5e-82: tmp = 1.0 + ((x / z) / (y - t)) elif z <= 5.8e-229: 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 <= -8.5e-82) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); elseif (z <= 5.8e-229) 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 <= -8.5e-82)
tmp = 1.0 + ((x / z) / (y - t));
elseif (z <= 5.8e-229)
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, -8.5e-82], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.8e-229], 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 -8.5 \cdot 10^{-82}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{-229}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z - y}\\
\end{array}
\end{array}
if z < -8.4999999999999997e-82Initial program 99.2%
sub-neg99.2%
neg-mul-199.2%
*-commutative99.2%
*-commutative99.2%
associate-/r*99.9%
associate-*r/99.9%
metadata-eval99.9%
times-frac99.9%
*-lft-identity99.9%
neg-mul-199.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in z around inf 98.1%
if -8.4999999999999997e-82 < z < 5.7999999999999999e-229Initial program 99.9%
sub-neg99.9%
neg-mul-199.9%
*-commutative99.9%
*-commutative99.9%
associate-/r*97.1%
associate-*r/97.1%
metadata-eval97.1%
times-frac97.1%
*-lft-identity97.1%
neg-mul-197.1%
sub-neg97.1%
+-commutative97.1%
distribute-neg-out97.1%
remove-double-neg97.1%
sub-neg97.1%
Simplified97.1%
Taylor expanded in z around 0 93.9%
mul-1-neg93.9%
sub-neg93.9%
Simplified93.9%
if 5.7999999999999999e-229 < z Initial program 99.1%
sub-neg99.1%
neg-mul-199.1%
*-commutative99.1%
*-commutative99.1%
associate-/r*99.9%
associate-*r/99.9%
metadata-eval99.9%
times-frac99.9%
*-lft-identity99.9%
neg-mul-199.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in t around inf 78.5%
mul-1-neg78.5%
unsub-neg78.5%
associate-/r*75.9%
Simplified75.9%
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 (<= z -4.15e-81)
(+ 1.0 (/ (/ x z) (- y t)))
(if (<= z 1.6e-228)
(- 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.15e-81) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 1.6e-228) {
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.15d-81)) then
tmp = 1.0d0 + ((x / z) / (y - t))
else if (z <= 1.6d-228) 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.15e-81) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 1.6e-228) {
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.15e-81: tmp = 1.0 + ((x / z) / (y - t)) elif z <= 1.6e-228: 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.15e-81) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); elseif (z <= 1.6e-228) tmp = Float64(1.0 - Float64(Float64(x / 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.15e-81)
tmp = 1.0 + ((x / z) / (y - t));
elseif (z <= 1.6e-228)
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.15e-81], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.6e-228], N[(1.0 - N[(N[(x / y), $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}\;z \leq -4.15 \cdot 10^{-81}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{-228}:\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z - y}\\
\end{array}
\end{array}
if z < -4.15000000000000007e-81Initial program 99.2%
sub-neg99.2%
neg-mul-199.2%
*-commutative99.2%
*-commutative99.2%
associate-/r*99.9%
associate-*r/99.9%
metadata-eval99.9%
times-frac99.9%
*-lft-identity99.9%
neg-mul-199.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in z around inf 98.1%
if -4.15000000000000007e-81 < z < 1.60000000000000011e-228Initial program 99.9%
sub-neg99.9%
neg-mul-199.9%
*-commutative99.9%
*-commutative99.9%
associate-/r*97.1%
associate-*r/97.1%
metadata-eval97.1%
times-frac97.1%
*-lft-identity97.1%
neg-mul-197.1%
sub-neg97.1%
+-commutative97.1%
distribute-neg-out97.1%
remove-double-neg97.1%
sub-neg97.1%
Simplified97.1%
Taylor expanded in z around 0 92.5%
associate-*r/92.5%
neg-mul-192.5%
Simplified92.5%
if 1.60000000000000011e-228 < z Initial program 99.1%
sub-neg99.1%
neg-mul-199.1%
*-commutative99.1%
*-commutative99.1%
associate-/r*99.9%
associate-*r/99.9%
metadata-eval99.9%
times-frac99.9%
*-lft-identity99.9%
neg-mul-199.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in t around inf 78.5%
mul-1-neg78.5%
unsub-neg78.5%
associate-/r*75.9%
Simplified75.9%
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 -9.5e-133) 1.0 (if (<= y 2.35e-60) (- 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 <= -9.5e-133) {
tmp = 1.0;
} else if (y <= 2.35e-60) {
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 <= (-9.5d-133)) then
tmp = 1.0d0
else if (y <= 2.35d-60) 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 <= -9.5e-133) {
tmp = 1.0;
} else if (y <= 2.35e-60) {
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 <= -9.5e-133: tmp = 1.0 elif y <= 2.35e-60: 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 <= -9.5e-133) tmp = 1.0; elseif (y <= 2.35e-60) 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 <= -9.5e-133)
tmp = 1.0;
elseif (y <= 2.35e-60)
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, -9.5e-133], 1.0, If[LessEqual[y, 2.35e-60], 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 -9.5 \cdot 10^{-133}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 2.35 \cdot 10^{-60}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -9.4999999999999992e-133 or 2.35e-60 < y Initial program 99.9%
sub-neg99.9%
neg-mul-199.9%
*-commutative99.9%
*-commutative99.9%
associate-/r*99.9%
associate-*r/99.9%
metadata-eval99.9%
times-frac99.9%
*-lft-identity99.9%
neg-mul-199.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in x around 0 86.6%
if -9.4999999999999992e-133 < y < 2.35e-60Initial program 98.0%
sub-neg98.0%
neg-mul-198.0%
*-commutative98.0%
*-commutative98.0%
associate-/r*97.7%
associate-*r/97.7%
metadata-eval97.7%
times-frac97.7%
*-lft-identity97.7%
neg-mul-197.7%
sub-neg97.7%
+-commutative97.7%
distribute-neg-out97.7%
remove-double-neg97.7%
sub-neg97.7%
Simplified97.7%
Taylor expanded in y around 0 80.0%
mul-1-neg80.0%
sub-neg80.0%
Simplified80.0%
Final simplification84.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 -4e-81) (+ 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 <= -4e-81) {
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 <= (-4d-81)) 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 <= -4e-81) {
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 <= -4e-81: 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 <= -4e-81) tmp = Float64(1.0 + Float64(Float64(x / 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 <= -4e-81)
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[LessEqual[z, -4e-81], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $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 -4 \cdot 10^{-81}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\
\end{array}
\end{array}
if z < -3.9999999999999998e-81Initial program 99.2%
sub-neg99.2%
neg-mul-199.2%
*-commutative99.2%
*-commutative99.2%
associate-/r*99.9%
associate-*r/99.9%
metadata-eval99.9%
times-frac99.9%
*-lft-identity99.9%
neg-mul-199.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in z around inf 98.1%
if -3.9999999999999998e-81 < z Initial program 99.4%
sub-neg99.4%
neg-mul-199.4%
*-commutative99.4%
*-commutative99.4%
associate-/r*98.9%
associate-*r/98.9%
metadata-eval98.9%
times-frac98.9%
*-lft-identity98.9%
neg-mul-198.9%
sub-neg98.9%
+-commutative98.9%
distribute-neg-out98.9%
remove-double-neg98.9%
sub-neg98.9%
Simplified98.9%
Taylor expanded in z around 0 80.6%
mul-1-neg80.6%
sub-neg80.6%
Simplified80.6%
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 (+ 1.0 (* x (/ (/ 1.0 (- 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 * ((1.0 / (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 * ((1.0d0 / (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 * ((1.0 / (z - y)) / (y - t)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 + (x * ((1.0 / (z - y)) / (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(1.0 / 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 * ((1.0 / (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[(x * N[(N[(1.0 / N[(z - y), $MachinePrecision]), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
1 + x \cdot \frac{\frac{1}{z - y}}{y - t}
\end{array}
Initial program 99.3%
sub-neg99.3%
neg-mul-199.3%
*-commutative99.3%
*-commutative99.3%
associate-/r*99.2%
associate-*r/99.2%
metadata-eval99.2%
times-frac99.2%
*-lft-identity99.2%
neg-mul-199.2%
sub-neg99.2%
+-commutative99.2%
distribute-neg-out99.2%
remove-double-neg99.2%
sub-neg99.2%
Simplified99.2%
div-inv99.2%
*-un-lft-identity99.2%
times-frac99.5%
Applied egg-rr99.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 (- 1.0 (/ x (* (- y t) (- y z)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - t) * (y - z)));
}
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) * (y - z)))
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) * (y - z)));
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return 1.0 - (x / ((y - t) * (y - z)))
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(y - z)))) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - (x / ((y - t) * (y - z)));
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[(y - z), $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(y - z\right)}
\end{array}
Initial program 99.3%
Final simplification99.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)
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 99.3%
sub-neg99.3%
neg-mul-199.3%
*-commutative99.3%
*-commutative99.3%
associate-/r*99.2%
associate-*r/99.2%
metadata-eval99.2%
times-frac99.2%
*-lft-identity99.2%
neg-mul-199.2%
sub-neg99.2%
+-commutative99.2%
distribute-neg-out99.2%
remove-double-neg99.2%
sub-neg99.2%
Simplified99.2%
Taylor expanded in x around 0 75.6%
Final simplification75.6%
herbie shell --seed 2024027
(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)))))