
(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 11 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 (+ (* (/ x (- y z)) (/ -1.0 (- y t))) 1.0))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return ((x / (y - z)) * (-1.0 / (y - t))) + 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 = ((x / (y - z)) * ((-1.0d0) / (y - t))) + 1.0d0
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return ((x / (y - z)) * (-1.0 / (y - t))) + 1.0;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return ((x / (y - z)) * (-1.0 / (y - t))) + 1.0
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(Float64(x / Float64(y - z)) * Float64(-1.0 / Float64(y - t))) + 1.0) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = ((x / (y - z)) * (-1.0 / (y - t))) + 1.0;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[(N[(x / N[(y - z), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\frac{x}{y - z} \cdot \frac{-1}{y - t} + 1
\end{array}
Initial program 98.7%
associate-/r*98.5%
div-inv98.5%
Applied egg-rr98.5%
Final simplification98.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 -2.6e-77)
1.0
(if (<= y 2.6e-104)
(- 1.0 (/ (/ x z) t))
(if (<= y 4.4e-39)
(+ (/ (/ x t) y) 1.0)
(if (<= y 5.5e+65) (+ (/ (/ x z) y) 1.0) 1.0)))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.6e-77) {
tmp = 1.0;
} else if (y <= 2.6e-104) {
tmp = 1.0 - ((x / z) / t);
} else if (y <= 4.4e-39) {
tmp = ((x / t) / y) + 1.0;
} else if (y <= 5.5e+65) {
tmp = ((x / z) / y) + 1.0;
} 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 <= (-2.6d-77)) then
tmp = 1.0d0
else if (y <= 2.6d-104) then
tmp = 1.0d0 - ((x / z) / t)
else if (y <= 4.4d-39) then
tmp = ((x / t) / y) + 1.0d0
else if (y <= 5.5d+65) then
tmp = ((x / z) / y) + 1.0d0
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 <= -2.6e-77) {
tmp = 1.0;
} else if (y <= 2.6e-104) {
tmp = 1.0 - ((x / z) / t);
} else if (y <= 4.4e-39) {
tmp = ((x / t) / y) + 1.0;
} else if (y <= 5.5e+65) {
tmp = ((x / z) / y) + 1.0;
} 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 <= -2.6e-77: tmp = 1.0 elif y <= 2.6e-104: tmp = 1.0 - ((x / z) / t) elif y <= 4.4e-39: tmp = ((x / t) / y) + 1.0 elif y <= 5.5e+65: tmp = ((x / z) / y) + 1.0 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 <= -2.6e-77) tmp = 1.0; elseif (y <= 2.6e-104) tmp = Float64(1.0 - Float64(Float64(x / z) / t)); elseif (y <= 4.4e-39) tmp = Float64(Float64(Float64(x / t) / y) + 1.0); elseif (y <= 5.5e+65) tmp = Float64(Float64(Float64(x / z) / y) + 1.0); 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 <= -2.6e-77)
tmp = 1.0;
elseif (y <= 2.6e-104)
tmp = 1.0 - ((x / z) / t);
elseif (y <= 4.4e-39)
tmp = ((x / t) / y) + 1.0;
elseif (y <= 5.5e+65)
tmp = ((x / z) / y) + 1.0;
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, -2.6e-77], 1.0, If[LessEqual[y, 2.6e-104], N[(1.0 - N[(N[(x / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.4e-39], N[(N[(N[(x / t), $MachinePrecision] / y), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[y, 5.5e+65], N[(N[(N[(x / z), $MachinePrecision] / y), $MachinePrecision] + 1.0), $MachinePrecision], 1.0]]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.6 \cdot 10^{-77}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{-104}:\\
\;\;\;\;1 - \frac{\frac{x}{z}}{t}\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{-39}:\\
\;\;\;\;\frac{\frac{x}{t}}{y} + 1\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{+65}:\\
\;\;\;\;\frac{\frac{x}{z}}{y} + 1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -2.6000000000000001e-77 or 5.4999999999999996e65 < y Initial program 100.0%
Taylor expanded in y around 0 45.1%
frac-2neg45.1%
neg-sub045.1%
div-sub44.8%
*-commutative44.8%
distribute-rgt-neg-in44.8%
add-sqr-sqrt21.8%
sqrt-unprod45.0%
sqr-neg45.0%
sqrt-unprod22.9%
add-sqr-sqrt44.6%
frac-2neg44.6%
*-commutative44.6%
Applied egg-rr44.6%
div044.9%
neg-sub044.9%
distribute-neg-frac244.9%
distribute-rgt-neg-out44.9%
Simplified44.9%
Taylor expanded in x around 0 96.4%
if -2.6000000000000001e-77 < y < 2.60000000000000003e-104Initial program 96.1%
Taylor expanded in y around 0 81.4%
associate-/r*82.5%
div-inv82.5%
Applied egg-rr82.5%
associate-*l/82.5%
div-inv82.5%
Applied egg-rr82.5%
if 2.60000000000000003e-104 < y < 4.40000000000000002e-39Initial program 99.8%
Taylor expanded in z around 0 67.3%
*-commutative67.3%
associate-/r*67.4%
Simplified67.4%
Taylor expanded in y around 0 61.3%
mul-1-neg61.3%
distribute-neg-frac261.3%
Simplified61.3%
if 4.40000000000000002e-39 < y < 5.4999999999999996e65Initial program 99.9%
Taylor expanded in t around 0 85.7%
*-commutative85.7%
associate-/r*85.8%
Simplified85.8%
Taylor expanded in y around 0 65.0%
mul-1-neg65.0%
distribute-neg-frac265.0%
Simplified65.0%
Final simplification87.1%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= y -7.6e-67) (not (<= y 1.7e-124))) (+ (/ x (* y (- t y))) 1.0) (- 1.0 (/ (/ x z) t))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.6e-67) || !(y <= 1.7e-124)) {
tmp = (x / (y * (t - y))) + 1.0;
} else {
tmp = 1.0 - ((x / z) / t);
}
return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-7.6d-67)) .or. (.not. (y <= 1.7d-124))) then
tmp = (x / (y * (t - y))) + 1.0d0
else
tmp = 1.0d0 - ((x / z) / t)
end if
code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.6e-67) || !(y <= 1.7e-124)) {
tmp = (x / (y * (t - y))) + 1.0;
} else {
tmp = 1.0 - ((x / z) / t);
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if (y <= -7.6e-67) or not (y <= 1.7e-124): tmp = (x / (y * (t - y))) + 1.0 else: tmp = 1.0 - ((x / z) / t) return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if ((y <= -7.6e-67) || !(y <= 1.7e-124)) tmp = Float64(Float64(x / Float64(y * Float64(t - y))) + 1.0); else tmp = Float64(1.0 - Float64(Float64(x / z) / t)); end return tmp end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((y <= -7.6e-67) || ~((y <= 1.7e-124)))
tmp = (x / (y * (t - y))) + 1.0;
else
tmp = 1.0 - ((x / z) / t);
end
tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[Or[LessEqual[y, -7.6e-67], N[Not[LessEqual[y, 1.7e-124]], $MachinePrecision]], N[(N[(x / N[(y * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(1.0 - N[(N[(x / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.6 \cdot 10^{-67} \lor \neg \left(y \leq 1.7 \cdot 10^{-124}\right):\\
\;\;\;\;\frac{x}{y \cdot \left(t - y\right)} + 1\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{z}}{t}\\
\end{array}
\end{array}
if y < -7.59999999999999976e-67 or 1.7e-124 < y Initial program 100.0%
Taylor expanded in z around 0 94.2%
if -7.59999999999999976e-67 < y < 1.7e-124Initial program 96.0%
Taylor expanded in y around 0 81.0%
associate-/r*82.0%
div-inv82.0%
Applied egg-rr82.0%
associate-*l/82.1%
div-inv82.1%
Applied egg-rr82.1%
Final simplification90.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 -3.5e-79) (- 1.0 (/ (/ x z) (- t y))) (if (<= z 9.6e-91) (+ (/ x (* y (- t y))) 1.0) (- 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 <= -3.5e-79) {
tmp = 1.0 - ((x / z) / (t - y));
} else if (z <= 9.6e-91) {
tmp = (x / (y * (t - y))) + 1.0;
} 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 <= (-3.5d-79)) then
tmp = 1.0d0 - ((x / z) / (t - y))
else if (z <= 9.6d-91) then
tmp = (x / (y * (t - y))) + 1.0d0
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 <= -3.5e-79) {
tmp = 1.0 - ((x / z) / (t - y));
} else if (z <= 9.6e-91) {
tmp = (x / (y * (t - y))) + 1.0;
} 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 <= -3.5e-79: tmp = 1.0 - ((x / z) / (t - y)) elif z <= 9.6e-91: tmp = (x / (y * (t - y))) + 1.0 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 <= -3.5e-79) tmp = Float64(1.0 - Float64(Float64(x / z) / Float64(t - y))); elseif (z <= 9.6e-91) tmp = Float64(Float64(x / Float64(y * Float64(t - y))) + 1.0); 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 <= -3.5e-79)
tmp = 1.0 - ((x / z) / (t - y));
elseif (z <= 9.6e-91)
tmp = (x / (y * (t - y))) + 1.0;
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, -3.5e-79], N[(1.0 - N[(N[(x / z), $MachinePrecision] / N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.6e-91], N[(N[(x / N[(y * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $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 -3.5 \cdot 10^{-79}:\\
\;\;\;\;1 - \frac{\frac{x}{z}}{t - y}\\
\mathbf{elif}\;z \leq 9.6 \cdot 10^{-91}:\\
\;\;\;\;\frac{x}{y \cdot \left(t - y\right)} + 1\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\end{array}
\end{array}
if z < -3.5000000000000003e-79Initial program 99.9%
associate-/r*100.0%
div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in z around inf 97.9%
mul-1-neg97.9%
associate-/r*97.9%
distribute-neg-frac297.9%
Simplified97.9%
Taylor expanded in x around 0 97.9%
associate-/r*97.9%
Simplified97.9%
if -3.5000000000000003e-79 < z < 9.60000000000000043e-91Initial program 96.5%
Taylor expanded in z around 0 91.5%
if 9.60000000000000043e-91 < z Initial program 99.9%
Taylor expanded in y around 0 70.4%
Final simplification87.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z -4.2e-80) (- 1.0 (/ (/ x z) (- t y))) (if (<= z 9.6e-91) (+ (/ (/ x (- t y)) y) 1.0) (- 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 <= -4.2e-80) {
tmp = 1.0 - ((x / z) / (t - y));
} else if (z <= 9.6e-91) {
tmp = ((x / (t - y)) / y) + 1.0;
} 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 <= (-4.2d-80)) then
tmp = 1.0d0 - ((x / z) / (t - y))
else if (z <= 9.6d-91) then
tmp = ((x / (t - y)) / y) + 1.0d0
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 <= -4.2e-80) {
tmp = 1.0 - ((x / z) / (t - y));
} else if (z <= 9.6e-91) {
tmp = ((x / (t - y)) / y) + 1.0;
} 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 <= -4.2e-80: tmp = 1.0 - ((x / z) / (t - y)) elif z <= 9.6e-91: tmp = ((x / (t - y)) / y) + 1.0 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 <= -4.2e-80) tmp = Float64(1.0 - Float64(Float64(x / z) / Float64(t - y))); elseif (z <= 9.6e-91) tmp = Float64(Float64(Float64(x / Float64(t - y)) / y) + 1.0); 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 <= -4.2e-80)
tmp = 1.0 - ((x / z) / (t - y));
elseif (z <= 9.6e-91)
tmp = ((x / (t - y)) / y) + 1.0;
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, -4.2e-80], N[(1.0 - N[(N[(x / z), $MachinePrecision] / N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.6e-91], N[(N[(N[(x / N[(t - y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] + 1.0), $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 -4.2 \cdot 10^{-80}:\\
\;\;\;\;1 - \frac{\frac{x}{z}}{t - y}\\
\mathbf{elif}\;z \leq 9.6 \cdot 10^{-91}:\\
\;\;\;\;\frac{\frac{x}{t - y}}{y} + 1\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\end{array}
\end{array}
if z < -4.20000000000000003e-80Initial program 99.9%
associate-/r*100.0%
div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in z around inf 96.8%
mul-1-neg96.8%
associate-/r*96.8%
distribute-neg-frac296.8%
Simplified96.8%
Taylor expanded in x around 0 96.8%
associate-/r*96.8%
Simplified96.8%
if -4.20000000000000003e-80 < z < 9.60000000000000043e-91Initial program 96.4%
Taylor expanded in z around 0 91.4%
*-commutative91.4%
associate-/r*92.6%
Simplified92.6%
if 9.60000000000000043e-91 < z Initial program 99.9%
Taylor expanded in y around 0 70.4%
Final simplification87.4%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= z -9e-80)
(- 1.0 (/ (/ x z) (- t y)))
(if (<= z 8.6e-191)
(+ (/ (/ x (- t y)) y) 1.0)
(+ (/ x (* (- y z) t)) 1.0))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -9e-80) {
tmp = 1.0 - ((x / z) / (t - y));
} else if (z <= 8.6e-191) {
tmp = ((x / (t - y)) / y) + 1.0;
} else {
tmp = (x / ((y - z) * t)) + 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 (z <= (-9d-80)) then
tmp = 1.0d0 - ((x / z) / (t - y))
else if (z <= 8.6d-191) then
tmp = ((x / (t - y)) / y) + 1.0d0
else
tmp = (x / ((y - z) * t)) + 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 (z <= -9e-80) {
tmp = 1.0 - ((x / z) / (t - y));
} else if (z <= 8.6e-191) {
tmp = ((x / (t - y)) / y) + 1.0;
} else {
tmp = (x / ((y - z) * t)) + 1.0;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= -9e-80: tmp = 1.0 - ((x / z) / (t - y)) elif z <= 8.6e-191: tmp = ((x / (t - y)) / y) + 1.0 else: tmp = (x / ((y - z) * t)) + 1.0 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= -9e-80) tmp = Float64(1.0 - Float64(Float64(x / z) / Float64(t - y))); elseif (z <= 8.6e-191) tmp = Float64(Float64(Float64(x / Float64(t - y)) / y) + 1.0); else tmp = Float64(Float64(x / Float64(Float64(y - z) * t)) + 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 (z <= -9e-80)
tmp = 1.0 - ((x / z) / (t - y));
elseif (z <= 8.6e-191)
tmp = ((x / (t - y)) / y) + 1.0;
else
tmp = (x / ((y - z) * t)) + 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[z, -9e-80], N[(1.0 - N[(N[(x / z), $MachinePrecision] / N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.6e-191], N[(N[(N[(x / N[(t - y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(x / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{-80}:\\
\;\;\;\;1 - \frac{\frac{x}{z}}{t - y}\\
\mathbf{elif}\;z \leq 8.6 \cdot 10^{-191}:\\
\;\;\;\;\frac{\frac{x}{t - y}}{y} + 1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(y - z\right) \cdot t} + 1\\
\end{array}
\end{array}
if z < -9.0000000000000006e-80Initial program 99.9%
associate-/r*100.0%
div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in z around inf 97.9%
mul-1-neg97.9%
associate-/r*97.9%
distribute-neg-frac297.9%
Simplified97.9%
Taylor expanded in x around 0 97.9%
associate-/r*97.9%
Simplified97.9%
if -9.0000000000000006e-80 < z < 8.59999999999999966e-191Initial program 95.9%
Taylor expanded in z around 0 91.8%
*-commutative91.8%
associate-/r*93.2%
Simplified93.2%
if 8.59999999999999966e-191 < z Initial program 99.6%
Taylor expanded in t around inf 77.1%
associate-*r/77.1%
neg-mul-177.1%
Simplified77.1%
Final simplification88.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 (<= z -7.5e-82)
(- 1.0 (/ (/ x z) (- t y)))
(if (<= z 1.15e-191)
(+ (/ (/ x (- t y)) y) 1.0)
(+ (/ (/ x t) (- y z)) 1.0))))assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.5e-82) {
tmp = 1.0 - ((x / z) / (t - y));
} else if (z <= 1.15e-191) {
tmp = ((x / (t - y)) / y) + 1.0;
} else {
tmp = ((x / t) / (y - z)) + 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 (z <= (-7.5d-82)) then
tmp = 1.0d0 - ((x / z) / (t - y))
else if (z <= 1.15d-191) then
tmp = ((x / (t - y)) / y) + 1.0d0
else
tmp = ((x / t) / (y - z)) + 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 (z <= -7.5e-82) {
tmp = 1.0 - ((x / z) / (t - y));
} else if (z <= 1.15e-191) {
tmp = ((x / (t - y)) / y) + 1.0;
} else {
tmp = ((x / t) / (y - z)) + 1.0;
}
return tmp;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): tmp = 0 if z <= -7.5e-82: tmp = 1.0 - ((x / z) / (t - y)) elif z <= 1.15e-191: tmp = ((x / (t - y)) / y) + 1.0 else: tmp = ((x / t) / (y - z)) + 1.0 return tmp
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= -7.5e-82) tmp = Float64(1.0 - Float64(Float64(x / z) / Float64(t - y))); elseif (z <= 1.15e-191) tmp = Float64(Float64(Float64(x / Float64(t - y)) / y) + 1.0); else tmp = Float64(Float64(Float64(x / t) / Float64(y - z)) + 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 (z <= -7.5e-82)
tmp = 1.0 - ((x / z) / (t - y));
elseif (z <= 1.15e-191)
tmp = ((x / (t - y)) / y) + 1.0;
else
tmp = ((x / t) / (y - z)) + 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[z, -7.5e-82], N[(1.0 - N[(N[(x / z), $MachinePrecision] / N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.15e-191], N[(N[(N[(x / N[(t - y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(N[(x / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{-82}:\\
\;\;\;\;1 - \frac{\frac{x}{z}}{t - y}\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{-191}:\\
\;\;\;\;\frac{\frac{x}{t - y}}{y} + 1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{t}}{y - z} + 1\\
\end{array}
\end{array}
if z < -7.4999999999999997e-82Initial program 99.9%
associate-/r*100.0%
div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in z around inf 96.8%
mul-1-neg96.8%
associate-/r*96.8%
distribute-neg-frac296.8%
Simplified96.8%
Taylor expanded in x around 0 96.8%
associate-/r*96.8%
Simplified96.8%
if -7.4999999999999997e-82 < z < 1.15000000000000005e-191Initial program 95.7%
Taylor expanded in z around 0 91.5%
*-commutative91.5%
associate-/r*93.0%
Simplified93.0%
if 1.15000000000000005e-191 < z Initial program 99.6%
associate-/r*97.9%
div-inv97.9%
Applied egg-rr97.9%
associate-*l/98.9%
div-inv98.9%
Applied egg-rr98.9%
Taylor expanded in y around 0 77.3%
mul-1-neg53.2%
distribute-neg-frac253.2%
Simplified77.3%
Final simplification88.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 (<= y -2.45e-78) 1.0 (if (<= y 4e-122) (- 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 <= -2.45e-78) {
tmp = 1.0;
} else if (y <= 4e-122) {
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 <= (-2.45d-78)) then
tmp = 1.0d0
else if (y <= 4d-122) 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 <= -2.45e-78) {
tmp = 1.0;
} else if (y <= 4e-122) {
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 <= -2.45e-78: tmp = 1.0 elif y <= 4e-122: 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 <= -2.45e-78) tmp = 1.0; elseif (y <= 4e-122) 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 <= -2.45e-78)
tmp = 1.0;
elseif (y <= 4e-122)
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, -2.45e-78], 1.0, If[LessEqual[y, 4e-122], 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 -2.45 \cdot 10^{-78}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 4 \cdot 10^{-122}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -2.45000000000000015e-78 or 4.00000000000000024e-122 < y Initial program 100.0%
Taylor expanded in y around 0 45.7%
frac-2neg45.7%
neg-sub045.7%
div-sub45.4%
*-commutative45.4%
distribute-rgt-neg-in45.4%
add-sqr-sqrt21.6%
sqrt-unprod46.1%
sqr-neg46.1%
sqrt-unprod24.3%
add-sqr-sqrt45.8%
frac-2neg45.8%
*-commutative45.8%
Applied egg-rr45.8%
div046.1%
neg-sub046.1%
distribute-neg-frac246.1%
distribute-rgt-neg-out46.1%
Simplified46.1%
Taylor expanded in x around 0 91.1%
if -2.45000000000000015e-78 < y < 4.00000000000000024e-122Initial program 96.0%
Taylor expanded in y around 0 80.9%
Final simplification87.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 -1.72e-77) 1.0 (if (<= y 4.4e-116) (- 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 <= -1.72e-77) {
tmp = 1.0;
} else if (y <= 4.4e-116) {
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 <= (-1.72d-77)) then
tmp = 1.0d0
else if (y <= 4.4d-116) 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 <= -1.72e-77) {
tmp = 1.0;
} else if (y <= 4.4e-116) {
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 <= -1.72e-77: tmp = 1.0 elif y <= 4.4e-116: 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 <= -1.72e-77) tmp = 1.0; elseif (y <= 4.4e-116) tmp = Float64(1.0 - Float64(Float64(x / 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 <= -1.72e-77)
tmp = 1.0;
elseif (y <= 4.4e-116)
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, -1.72e-77], 1.0, If[LessEqual[y, 4.4e-116], N[(1.0 - N[(N[(x / z), $MachinePrecision] / t), $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.72 \cdot 10^{-77}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{-116}:\\
\;\;\;\;1 - \frac{\frac{x}{z}}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.71999999999999997e-77 or 4.4000000000000002e-116 < y Initial program 100.0%
Taylor expanded in y around 0 45.7%
frac-2neg45.7%
neg-sub045.7%
div-sub45.4%
*-commutative45.4%
distribute-rgt-neg-in45.4%
add-sqr-sqrt21.6%
sqrt-unprod46.1%
sqr-neg46.1%
sqrt-unprod24.3%
add-sqr-sqrt45.8%
frac-2neg45.8%
*-commutative45.8%
Applied egg-rr45.8%
div046.1%
neg-sub046.1%
distribute-neg-frac246.1%
distribute-rgt-neg-out46.1%
Simplified46.1%
Taylor expanded in x around 0 91.1%
if -1.71999999999999997e-77 < y < 4.4000000000000002e-116Initial program 96.0%
Taylor expanded in y around 0 80.9%
associate-/r*82.1%
div-inv82.0%
Applied egg-rr82.0%
associate-*l/82.0%
div-inv82.1%
Applied egg-rr82.1%
Final simplification88.2%
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (+ (/ x (* (- y z) (- t y))) 1.0))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
return (x / ((y - z) * (t - y))) + 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 = (x / ((y - z) * (t - y))) + 1.0d0
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
return (x / ((y - z) * (t - y))) + 1.0;
}
[x, y, z, t] = sort([x, y, z, t]) def code(x, y, z, t): return (x / ((y - z) * (t - y))) + 1.0
x, y, z, t = sort([x, y, z, t]) function code(x, y, z, t) return Float64(Float64(x / Float64(Float64(y - z) * Float64(t - y))) + 1.0) end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
tmp = (x / ((y - z) * (t - y))) + 1.0;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(N[(x / N[(N[(y - z), $MachinePrecision] * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\frac{x}{\left(y - z\right) \cdot \left(t - y\right)} + 1
\end{array}
Initial program 98.7%
Final simplification98.7%
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.7%
Taylor expanded in y around 0 57.0%
frac-2neg57.0%
neg-sub057.0%
div-sub55.5%
*-commutative55.5%
distribute-rgt-neg-in55.5%
add-sqr-sqrt24.2%
sqrt-unprod51.0%
sqr-neg51.0%
sqrt-unprod26.8%
add-sqr-sqrt46.6%
frac-2neg46.6%
*-commutative46.6%
Applied egg-rr46.6%
div047.2%
neg-sub047.2%
distribute-neg-frac247.2%
distribute-rgt-neg-out47.2%
Simplified47.2%
Taylor expanded in x around 0 78.4%
Final simplification78.4%
herbie shell --seed 2024043
(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)))))