
(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: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- 1.0 (* (/ (/ 1.0 (- y t)) (- y z)) x)))
assert(z < t);
double code(double x, double y, double z, double t) {
return 1.0 - (((1.0 / (y - t)) / (y - z)) * x);
}
NOTE: 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 - (((1.0d0 / (y - t)) / (y - z)) * x)
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 - (((1.0 / (y - t)) / (y - z)) * x);
}
[z, t] = sort([z, t]) def code(x, y, z, t): return 1.0 - (((1.0 / (y - t)) / (y - z)) * x)
z, t = sort([z, t]) function code(x, y, z, t) return Float64(1.0 - Float64(Float64(Float64(1.0 / Float64(y - t)) / Float64(y - z)) * x)) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - (((1.0 / (y - t)) / (y - z)) * x);
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := N[(1.0 - N[(N[(N[(1.0 / N[(y - t), $MachinePrecision]), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
1 - \frac{\frac{1}{y - t}}{y - z} \cdot x
\end{array}
Initial program 99.4%
clear-num99.3%
associate-/r/99.3%
*-commutative99.3%
associate-/r*99.6%
Applied egg-rr99.6%
Final simplification99.6%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= t -2.5e-146)
(+ 1.0 (* x (/ (/ -1.0 t) z)))
(if (<= t 2.7e-98)
(+ 1.0 (* x (/ (/ -1.0 y) (- y z))))
(+ 1.0 (/ (/ x t) (- y z))))))assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.5e-146) {
tmp = 1.0 + (x * ((-1.0 / t) / z));
} else if (t <= 2.7e-98) {
tmp = 1.0 + (x * ((-1.0 / y) / (y - z)));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
NOTE: 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.5d-146)) then
tmp = 1.0d0 + (x * (((-1.0d0) / t) / z))
else if (t <= 2.7d-98) then
tmp = 1.0d0 + (x * (((-1.0d0) / y) / (y - z)))
else
tmp = 1.0d0 + ((x / t) / (y - z))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.5e-146) {
tmp = 1.0 + (x * ((-1.0 / t) / z));
} else if (t <= 2.7e-98) {
tmp = 1.0 + (x * ((-1.0 / y) / (y - z)));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if t <= -2.5e-146: tmp = 1.0 + (x * ((-1.0 / t) / z)) elif t <= 2.7e-98: tmp = 1.0 + (x * ((-1.0 / y) / (y - z))) else: tmp = 1.0 + ((x / t) / (y - z)) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (t <= -2.5e-146) tmp = Float64(1.0 + Float64(x * Float64(Float64(-1.0 / t) / z))); elseif (t <= 2.7e-98) tmp = Float64(1.0 + Float64(x * Float64(Float64(-1.0 / y) / Float64(y - z)))); else tmp = Float64(1.0 + Float64(Float64(x / t) / Float64(y - z))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (t <= -2.5e-146)
tmp = 1.0 + (x * ((-1.0 / t) / z));
elseif (t <= 2.7e-98)
tmp = 1.0 + (x * ((-1.0 / y) / (y - z)));
else
tmp = 1.0 + ((x / t) / (y - z));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[t, -2.5e-146], N[(1.0 + N[(x * N[(N[(-1.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.7e-98], N[(1.0 + N[(x * N[(N[(-1.0 / y), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.5 \cdot 10^{-146}:\\
\;\;\;\;1 + x \cdot \frac{\frac{-1}{t}}{z}\\
\mathbf{elif}\;t \leq 2.7 \cdot 10^{-98}:\\
\;\;\;\;1 + x \cdot \frac{\frac{-1}{y}}{y - z}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if t < -2.49999999999999979e-146Initial program 99.3%
clear-num99.3%
associate-/r/99.3%
*-commutative99.3%
associate-/r*99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 67.1%
associate-/r*67.1%
Simplified67.1%
if -2.49999999999999979e-146 < t < 2.6999999999999999e-98Initial program 98.7%
clear-num98.6%
associate-/r/98.7%
*-commutative98.7%
associate-/r*98.7%
Applied egg-rr98.7%
Taylor expanded in t around 0 93.4%
associate-/r*93.4%
Simplified93.4%
if 2.6999999999999999e-98 < t Initial program 99.9%
Taylor expanded in t around inf 95.8%
mul-1-neg95.8%
distribute-frac-neg95.8%
associate-/r*94.7%
Simplified94.7%
Final simplification84.7%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= y -1.8e-111) (not (<= y 1.48e-120))) (- 1.0 (/ x (* y (- y z)))) (- 1.0 (/ x (* t z)))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.8e-111) || !(y <= 1.48e-120)) {
tmp = 1.0 - (x / (y * (y - z)));
} else {
tmp = 1.0 - (x / (t * z));
}
return tmp;
}
NOTE: 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.8d-111)) .or. (.not. (y <= 1.48d-120))) then
tmp = 1.0d0 - (x / (y * (y - z)))
else
tmp = 1.0d0 - (x / (t * z))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.8e-111) || !(y <= 1.48e-120)) {
tmp = 1.0 - (x / (y * (y - z)));
} else {
tmp = 1.0 - (x / (t * z));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if (y <= -1.8e-111) or not (y <= 1.48e-120): tmp = 1.0 - (x / (y * (y - z))) else: tmp = 1.0 - (x / (t * z)) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if ((y <= -1.8e-111) || !(y <= 1.48e-120)) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - z)))); else tmp = Float64(1.0 - Float64(x / Float64(t * z))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((y <= -1.8e-111) || ~((y <= 1.48e-120)))
tmp = 1.0 - (x / (y * (y - z)));
else
tmp = 1.0 - (x / (t * z));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.8e-111], N[Not[LessEqual[y, 1.48e-120]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.8 \cdot 10^{-111} \lor \neg \left(y \leq 1.48 \cdot 10^{-120}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\end{array}
\end{array}
if y < -1.80000000000000005e-111 or 1.4800000000000001e-120 < y Initial program 99.6%
Taylor expanded in t around 0 91.5%
if -1.80000000000000005e-111 < y < 1.4800000000000001e-120Initial program 98.9%
Taylor expanded in y around 0 83.0%
Final simplification88.6%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -2.7e-110) (- 1.0 (/ x (* y (- y z)))) (if (<= y 3.9e-137) (- 1.0 (/ x (* t z))) (- 1.0 (/ x (* y (- y t)))))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.7e-110) {
tmp = 1.0 - (x / (y * (y - z)));
} else if (y <= 3.9e-137) {
tmp = 1.0 - (x / (t * z));
} else {
tmp = 1.0 - (x / (y * (y - t)));
}
return tmp;
}
NOTE: 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.7d-110)) then
tmp = 1.0d0 - (x / (y * (y - z)))
else if (y <= 3.9d-137) then
tmp = 1.0d0 - (x / (t * z))
else
tmp = 1.0d0 - (x / (y * (y - t)))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.7e-110) {
tmp = 1.0 - (x / (y * (y - z)));
} else if (y <= 3.9e-137) {
tmp = 1.0 - (x / (t * z));
} else {
tmp = 1.0 - (x / (y * (y - t)));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if y <= -2.7e-110: tmp = 1.0 - (x / (y * (y - z))) elif y <= 3.9e-137: tmp = 1.0 - (x / (t * z)) else: tmp = 1.0 - (x / (y * (y - t))) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -2.7e-110) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - z)))); elseif (y <= 3.9e-137) tmp = Float64(1.0 - Float64(x / Float64(t * z))); else tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - t)))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -2.7e-110)
tmp = 1.0 - (x / (y * (y - z)));
elseif (y <= 3.9e-137)
tmp = 1.0 - (x / (t * z));
else
tmp = 1.0 - (x / (y * (y - t)));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, -2.7e-110], N[(1.0 - N[(x / N[(y * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.9e-137], N[(1.0 - N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(y * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.7 \cdot 10^{-110}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\
\mathbf{elif}\;y \leq 3.9 \cdot 10^{-137}:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\
\end{array}
\end{array}
if y < -2.6999999999999998e-110Initial program 99.9%
Taylor expanded in t around 0 92.9%
if -2.6999999999999998e-110 < y < 3.8999999999999999e-137Initial program 98.8%
Taylor expanded in y around 0 84.3%
if 3.8999999999999999e-137 < y Initial program 99.3%
Taylor expanded in z around 0 85.6%
Final simplification87.6%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -1.05e-109) (- 1.0 (/ x (* y (- y z)))) (if (<= y 9.5e-137) (- 1.0 (/ x (* t z))) (- 1.0 (/ (/ x y) (- y t))))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.05e-109) {
tmp = 1.0 - (x / (y * (y - z)));
} else if (y <= 9.5e-137) {
tmp = 1.0 - (x / (t * z));
} else {
tmp = 1.0 - ((x / y) / (y - t));
}
return tmp;
}
NOTE: 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.05d-109)) then
tmp = 1.0d0 - (x / (y * (y - z)))
else if (y <= 9.5d-137) then
tmp = 1.0d0 - (x / (t * z))
else
tmp = 1.0d0 - ((x / y) / (y - t))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.05e-109) {
tmp = 1.0 - (x / (y * (y - z)));
} else if (y <= 9.5e-137) {
tmp = 1.0 - (x / (t * z));
} else {
tmp = 1.0 - ((x / y) / (y - t));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if y <= -1.05e-109: tmp = 1.0 - (x / (y * (y - z))) elif y <= 9.5e-137: tmp = 1.0 - (x / (t * z)) else: tmp = 1.0 - ((x / y) / (y - t)) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -1.05e-109) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - z)))); elseif (y <= 9.5e-137) tmp = Float64(1.0 - Float64(x / Float64(t * z))); else tmp = Float64(1.0 - Float64(Float64(x / y) / Float64(y - t))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -1.05e-109)
tmp = 1.0 - (x / (y * (y - z)));
elseif (y <= 9.5e-137)
tmp = 1.0 - (x / (t * z));
else
tmp = 1.0 - ((x / y) / (y - t));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[y, -1.05e-109], N[(1.0 - N[(x / N[(y * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.5e-137], N[(1.0 - N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / y), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{-109}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\
\mathbf{elif}\;y \leq 9.5 \cdot 10^{-137}:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y - t}\\
\end{array}
\end{array}
if y < -1.04999999999999998e-109Initial program 99.9%
Taylor expanded in t around 0 92.9%
if -1.04999999999999998e-109 < y < 9.5000000000000007e-137Initial program 98.8%
Taylor expanded in y around 0 84.3%
if 9.5000000000000007e-137 < y Initial program 99.3%
Taylor expanded in z around 0 85.6%
associate-/l/85.7%
Simplified85.7%
Final simplification87.6%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= t -1.56e-145)
(+ 1.0 (* x (/ (/ -1.0 t) z)))
(if (<= t 1.7e-97)
(- 1.0 (/ x (* y (- y z))))
(+ 1.0 (/ (/ x t) (- y z))))))assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.56e-145) {
tmp = 1.0 + (x * ((-1.0 / t) / z));
} else if (t <= 1.7e-97) {
tmp = 1.0 - (x / (y * (y - z)));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
NOTE: 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.56d-145)) then
tmp = 1.0d0 + (x * (((-1.0d0) / t) / z))
else if (t <= 1.7d-97) then
tmp = 1.0d0 - (x / (y * (y - z)))
else
tmp = 1.0d0 + ((x / t) / (y - z))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.56e-145) {
tmp = 1.0 + (x * ((-1.0 / t) / z));
} else if (t <= 1.7e-97) {
tmp = 1.0 - (x / (y * (y - z)));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if t <= -1.56e-145: tmp = 1.0 + (x * ((-1.0 / t) / z)) elif t <= 1.7e-97: tmp = 1.0 - (x / (y * (y - z))) else: tmp = 1.0 + ((x / t) / (y - z)) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (t <= -1.56e-145) tmp = Float64(1.0 + Float64(x * Float64(Float64(-1.0 / t) / z))); elseif (t <= 1.7e-97) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - z)))); else tmp = Float64(1.0 + Float64(Float64(x / t) / Float64(y - z))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (t <= -1.56e-145)
tmp = 1.0 + (x * ((-1.0 / t) / z));
elseif (t <= 1.7e-97)
tmp = 1.0 - (x / (y * (y - z)));
else
tmp = 1.0 + ((x / t) / (y - z));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[LessEqual[t, -1.56e-145], N[(1.0 + N[(x * N[(N[(-1.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.7e-97], N[(1.0 - N[(x / N[(y * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.56 \cdot 10^{-145}:\\
\;\;\;\;1 + x \cdot \frac{\frac{-1}{t}}{z}\\
\mathbf{elif}\;t \leq 1.7 \cdot 10^{-97}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if t < -1.56000000000000001e-145Initial program 99.3%
clear-num99.3%
associate-/r/99.3%
*-commutative99.3%
associate-/r*99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 67.1%
associate-/r*67.1%
Simplified67.1%
if -1.56000000000000001e-145 < t < 1.6999999999999999e-97Initial program 98.7%
Taylor expanded in t around 0 93.4%
if 1.6999999999999999e-97 < t Initial program 99.9%
Taylor expanded in t around inf 95.8%
mul-1-neg95.8%
distribute-frac-neg95.8%
associate-/r*94.7%
Simplified94.7%
Final simplification84.7%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= y -1.65e+19) (not (<= y 1.85e-17))) (- 1.0 (/ x (* y t))) (- 1.0 (/ x (* t z)))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.65e+19) || !(y <= 1.85e-17)) {
tmp = 1.0 - (x / (y * t));
} else {
tmp = 1.0 - (x / (t * z));
}
return tmp;
}
NOTE: 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.65d+19)) .or. (.not. (y <= 1.85d-17))) then
tmp = 1.0d0 - (x / (y * t))
else
tmp = 1.0d0 - (x / (t * z))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.65e+19) || !(y <= 1.85e-17)) {
tmp = 1.0 - (x / (y * t));
} else {
tmp = 1.0 - (x / (t * z));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if (y <= -1.65e+19) or not (y <= 1.85e-17): tmp = 1.0 - (x / (y * t)) else: tmp = 1.0 - (x / (t * z)) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if ((y <= -1.65e+19) || !(y <= 1.85e-17)) tmp = Float64(1.0 - Float64(x / Float64(y * t))); else tmp = Float64(1.0 - Float64(x / Float64(t * z))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((y <= -1.65e+19) || ~((y <= 1.85e-17)))
tmp = 1.0 - (x / (y * t));
else
tmp = 1.0 - (x / (t * z));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.65e+19], N[Not[LessEqual[y, 1.85e-17]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{+19} \lor \neg \left(y \leq 1.85 \cdot 10^{-17}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\end{array}
\end{array}
if y < -1.65e19 or 1.8499999999999999e-17 < y Initial program 99.6%
Taylor expanded in z around 0 95.2%
associate-/l/95.2%
Simplified95.2%
Taylor expanded in y around 0 70.9%
associate-*r/70.9%
neg-mul-170.9%
*-commutative70.9%
Simplified70.9%
expm1-log1p-u69.5%
expm1-udef69.5%
add-sqr-sqrt44.3%
sqrt-unprod63.1%
sqr-neg63.1%
sqrt-unprod25.1%
add-sqr-sqrt69.3%
Applied egg-rr69.3%
expm1-def69.3%
expm1-log1p70.1%
Simplified70.1%
if -1.65e19 < y < 1.8499999999999999e-17Initial program 99.2%
Taylor expanded in y around 0 74.6%
Final simplification72.2%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= y -1.3e-74) (not (<= y 1.95e-44))) (- 1.0 (/ x (* y y))) (- 1.0 (/ x (* t z)))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.3e-74) || !(y <= 1.95e-44)) {
tmp = 1.0 - (x / (y * y));
} else {
tmp = 1.0 - (x / (t * z));
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-1.3d-74)) .or. (.not. (y <= 1.95d-44))) then
tmp = 1.0d0 - (x / (y * y))
else
tmp = 1.0d0 - (x / (t * z))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.3e-74) || !(y <= 1.95e-44)) {
tmp = 1.0 - (x / (y * y));
} else {
tmp = 1.0 - (x / (t * z));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if (y <= -1.3e-74) or not (y <= 1.95e-44): tmp = 1.0 - (x / (y * y)) else: tmp = 1.0 - (x / (t * z)) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if ((y <= -1.3e-74) || !(y <= 1.95e-44)) tmp = Float64(1.0 - Float64(x / Float64(y * y))); else tmp = Float64(1.0 - Float64(x / Float64(t * z))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((y <= -1.3e-74) || ~((y <= 1.95e-44)))
tmp = 1.0 - (x / (y * y));
else
tmp = 1.0 - (x / (t * z));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.3e-74], N[Not[LessEqual[y, 1.95e-44]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{-74} \lor \neg \left(y \leq 1.95 \cdot 10^{-44}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\end{array}
\end{array}
if y < -1.3e-74 or 1.9500000000000001e-44 < y Initial program 99.6%
Taylor expanded in y around inf 88.7%
unpow288.7%
Simplified88.7%
if -1.3e-74 < y < 1.9500000000000001e-44Initial program 99.1%
Taylor expanded in y around 0 78.8%
Final simplification84.8%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= y -6.4e-75) (not (<= y 4.6e-45))) (- 1.0 (/ (/ x y) y)) (- 1.0 (/ x (* t z)))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.4e-75) || !(y <= 4.6e-45)) {
tmp = 1.0 - ((x / y) / y);
} else {
tmp = 1.0 - (x / (t * z));
}
return tmp;
}
NOTE: 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 <= (-6.4d-75)) .or. (.not. (y <= 4.6d-45))) then
tmp = 1.0d0 - ((x / y) / y)
else
tmp = 1.0d0 - (x / (t * z))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.4e-75) || !(y <= 4.6e-45)) {
tmp = 1.0 - ((x / y) / y);
} else {
tmp = 1.0 - (x / (t * z));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if (y <= -6.4e-75) or not (y <= 4.6e-45): tmp = 1.0 - ((x / y) / y) else: tmp = 1.0 - (x / (t * z)) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if ((y <= -6.4e-75) || !(y <= 4.6e-45)) tmp = Float64(1.0 - Float64(Float64(x / y) / y)); else tmp = Float64(1.0 - Float64(x / Float64(t * z))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((y <= -6.4e-75) || ~((y <= 4.6e-45)))
tmp = 1.0 - ((x / y) / y);
else
tmp = 1.0 - (x / (t * z));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_] := If[Or[LessEqual[y, -6.4e-75], N[Not[LessEqual[y, 4.6e-45]], $MachinePrecision]], N[(1.0 - N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.4 \cdot 10^{-75} \lor \neg \left(y \leq 4.6 \cdot 10^{-45}\right):\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\end{array}
\end{array}
if y < -6.39999999999999953e-75 or 4.59999999999999983e-45 < y Initial program 99.6%
Taylor expanded in y around inf 88.7%
unpow288.7%
associate-/r*88.7%
Simplified88.7%
if -6.39999999999999953e-75 < y < 4.59999999999999983e-45Initial program 99.1%
Taylor expanded in y around 0 78.8%
Final simplification84.8%
NOTE: 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(z < t);
double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - t) * (y - z)));
}
NOTE: 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 z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - t) * (y - z)));
}
[z, t] = sort([z, t]) def code(x, y, z, t): return 1.0 - (x / ((y - t) * (y - z)))
z, t = sort([z, t]) function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(Float64(y - t) * Float64(y - z)))) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - (x / ((y - t) * (y - z)));
end
NOTE: 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}
[z, t] = \mathsf{sort}([z, t])\\
\\
1 - \frac{x}{\left(y - t\right) \cdot \left(y - z\right)}
\end{array}
Initial program 99.4%
Final simplification99.4%
NOTE: 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(z < t);
double code(double x, double y, double z, double t) {
return 1.0 - (x / (y * t));
}
NOTE: 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 z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 - (x / (y * t));
}
[z, t] = sort([z, t]) def code(x, y, z, t): return 1.0 - (x / (y * t))
z, t = sort([z, t]) function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(y * t))) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - (x / (y * t));
end
NOTE: 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}
[z, t] = \mathsf{sort}([z, t])\\
\\
1 - \frac{x}{y \cdot t}
\end{array}
Initial program 99.4%
Taylor expanded in z around 0 72.4%
associate-/l/72.0%
Simplified72.0%
Taylor expanded in y around 0 57.0%
associate-*r/57.0%
neg-mul-157.0%
*-commutative57.0%
Simplified57.0%
expm1-log1p-u50.8%
expm1-udef50.8%
add-sqr-sqrt30.0%
sqrt-unprod46.3%
sqr-neg46.3%
sqrt-unprod17.9%
add-sqr-sqrt47.1%
Applied egg-rr47.1%
expm1-def47.1%
expm1-log1p49.2%
Simplified49.2%
Final simplification49.2%
herbie shell --seed 2023257
(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)))))