
(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.2%
clear-num99.2%
associate-/r/99.2%
*-commutative99.2%
associate-/r*99.2%
Applied egg-rr99.2%
Final simplification99.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 -2.7e-63) (not (<= y 9e-48))) (- 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 <= -2.7e-63) || !(y <= 9e-48)) {
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 <= (-2.7d-63)) .or. (.not. (y <= 9d-48))) 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 <= -2.7e-63) || !(y <= 9e-48)) {
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 <= -2.7e-63) or not (y <= 9e-48): 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 <= -2.7e-63) || !(y <= 9e-48)) 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 <= -2.7e-63) || ~((y <= 9e-48)))
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, -2.7e-63], N[Not[LessEqual[y, 9e-48]], $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 -2.7 \cdot 10^{-63} \lor \neg \left(y \leq 9 \cdot 10^{-48}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\end{array}
\end{array}
if y < -2.7000000000000002e-63 or 8.99999999999999977e-48 < y Initial program 99.9%
Taylor expanded in t around 0 94.2%
if -2.7000000000000002e-63 < y < 8.99999999999999977e-48Initial program 98.0%
Taylor expanded in y around 0 79.9%
Final simplification88.3%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -1.95e-64) (- 1.0 (/ x (* y (- y z)))) (if (<= y 3.9e-48) (- 1.0 (/ x (* t z))) (- 1.0 (/ (/ x y) (- y z))))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.95e-64) {
tmp = 1.0 - (x / (y * (y - z)));
} else if (y <= 3.9e-48) {
tmp = 1.0 - (x / (t * z));
} else {
tmp = 1.0 - ((x / y) / (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 (y <= (-1.95d-64)) then
tmp = 1.0d0 - (x / (y * (y - z)))
else if (y <= 3.9d-48) then
tmp = 1.0d0 - (x / (t * z))
else
tmp = 1.0d0 - ((x / y) / (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 (y <= -1.95e-64) {
tmp = 1.0 - (x / (y * (y - z)));
} else if (y <= 3.9e-48) {
tmp = 1.0 - (x / (t * z));
} else {
tmp = 1.0 - ((x / y) / (y - z));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if y <= -1.95e-64: tmp = 1.0 - (x / (y * (y - z))) elif y <= 3.9e-48: tmp = 1.0 - (x / (t * z)) else: tmp = 1.0 - ((x / y) / (y - z)) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -1.95e-64) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - z)))); elseif (y <= 3.9e-48) tmp = Float64(1.0 - Float64(x / Float64(t * z))); else tmp = Float64(1.0 - Float64(Float64(x / y) / 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 (y <= -1.95e-64)
tmp = 1.0 - (x / (y * (y - z)));
elseif (y <= 3.9e-48)
tmp = 1.0 - (x / (t * z));
else
tmp = 1.0 - ((x / y) / (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[y, -1.95e-64], N[(1.0 - N[(x / N[(y * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.9e-48], N[(1.0 - N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / y), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.95 \cdot 10^{-64}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\
\mathbf{elif}\;y \leq 3.9 \cdot 10^{-48}:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y - z}\\
\end{array}
\end{array}
if y < -1.9499999999999998e-64Initial program 99.9%
Taylor expanded in t around 0 92.4%
if -1.9499999999999998e-64 < y < 3.9e-48Initial program 98.0%
Taylor expanded in y around 0 79.9%
if 3.9e-48 < y Initial program 100.0%
Taylor expanded in t around 0 96.1%
associate-/r*96.1%
Simplified96.1%
Final simplification88.3%
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-180)
(- 1.0 (/ (/ x z) t))
(if (<= t 2.15e-114)
(- 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-180) {
tmp = 1.0 - ((x / z) / t);
} else if (t <= 2.15e-114) {
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-180)) then
tmp = 1.0d0 - ((x / z) / t)
else if (t <= 2.15d-114) 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-180) {
tmp = 1.0 - ((x / z) / t);
} else if (t <= 2.15e-114) {
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-180: tmp = 1.0 - ((x / z) / t) elif t <= 2.15e-114: 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-180) tmp = Float64(1.0 - Float64(Float64(x / z) / t)); elseif (t <= 2.15e-114) tmp = Float64(1.0 - Float64(Float64(x / y) / Float64(y - z))); else tmp = Float64(1.0 + Float64(x / Float64(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-180)
tmp = 1.0 - ((x / z) / t);
elseif (t <= 2.15e-114)
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-180], N[(1.0 - N[(N[(x / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.15e-114], N[(1.0 - N[(N[(x / y), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x / N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.56 \cdot 10^{-180}:\\
\;\;\;\;1 - \frac{\frac{x}{z}}{t}\\
\mathbf{elif}\;t \leq 2.15 \cdot 10^{-114}:\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y - z}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{t \cdot \left(y - z\right)}\\
\end{array}
\end{array}
if t < -1.56e-180Initial program 99.9%
Taylor expanded in y around 0 78.1%
clear-num78.0%
associate-/r/78.1%
*-commutative78.1%
associate-/r*78.1%
Applied egg-rr78.1%
associate-*l/76.4%
associate-*l/76.4%
*-un-lft-identity76.4%
Applied egg-rr76.4%
if -1.56e-180 < t < 2.15e-114Initial program 96.7%
Taylor expanded in t around 0 91.6%
associate-/r*93.1%
Simplified93.1%
if 2.15e-114 < t Initial program 99.9%
Taylor expanded in t around inf 96.1%
associate-*r/96.1%
neg-mul-196.1%
Simplified96.1%
Final simplification86.5%
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-180)
(- 1.0 (/ (/ x z) t))
(if (<= t 1.6e-113)
(- 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-180) {
tmp = 1.0 - ((x / z) / t);
} else if (t <= 1.6e-113) {
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-180)) then
tmp = 1.0d0 - ((x / z) / t)
else if (t <= 1.6d-113) 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-180) {
tmp = 1.0 - ((x / z) / t);
} else if (t <= 1.6e-113) {
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-180: tmp = 1.0 - ((x / z) / t) elif t <= 1.6e-113: 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-180) tmp = Float64(1.0 - Float64(Float64(x / z) / t)); elseif (t <= 1.6e-113) tmp = Float64(1.0 - Float64(Float64(x / 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-180)
tmp = 1.0 - ((x / z) / t);
elseif (t <= 1.6e-113)
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-180], N[(1.0 - N[(N[(x / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.6e-113], N[(1.0 - N[(N[(x / y), $MachinePrecision] / N[(y - z), $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^{-180}:\\
\;\;\;\;1 - \frac{\frac{x}{z}}{t}\\
\mathbf{elif}\;t \leq 1.6 \cdot 10^{-113}:\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y - z}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if t < -1.56e-180Initial program 99.9%
Taylor expanded in y around 0 78.1%
clear-num78.0%
associate-/r/78.1%
*-commutative78.1%
associate-/r*78.1%
Applied egg-rr78.1%
associate-*l/76.4%
associate-*l/76.4%
*-un-lft-identity76.4%
Applied egg-rr76.4%
if -1.56e-180 < t < 1.6000000000000001e-113Initial program 96.7%
Taylor expanded in t around 0 91.6%
associate-/r*93.1%
Simplified93.1%
if 1.6000000000000001e-113 < t Initial program 99.9%
Taylor expanded in t around inf 96.1%
mul-1-neg96.1%
distribute-frac-neg96.1%
associate-/r*96.2%
Simplified96.2%
Final simplification86.5%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= t -1.3e-180)
(+ 1.0 (/ (/ x z) (- y t)))
(if (<= t 1.65e-113)
(- 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.3e-180) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (t <= 1.65e-113) {
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.3d-180)) then
tmp = 1.0d0 + ((x / z) / (y - t))
else if (t <= 1.65d-113) 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.3e-180) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (t <= 1.65e-113) {
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.3e-180: tmp = 1.0 + ((x / z) / (y - t)) elif t <= 1.65e-113: 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.3e-180) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); elseif (t <= 1.65e-113) tmp = Float64(1.0 - Float64(Float64(x / 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.3e-180)
tmp = 1.0 + ((x / z) / (y - t));
elseif (t <= 1.65e-113)
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.3e-180], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.65e-113], N[(1.0 - N[(N[(x / y), $MachinePrecision] / N[(y - z), $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.3 \cdot 10^{-180}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{elif}\;t \leq 1.65 \cdot 10^{-113}:\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y - z}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if t < -1.2999999999999999e-180Initial program 99.9%
associate-/r*98.3%
div-inv98.2%
Applied egg-rr98.2%
Taylor expanded in x around 0 99.9%
associate-/l/98.3%
Simplified98.3%
Taylor expanded in y around 0 82.8%
neg-mul-182.8%
distribute-neg-frac82.8%
Simplified82.8%
if -1.2999999999999999e-180 < t < 1.6500000000000001e-113Initial program 96.7%
Taylor expanded in t around 0 91.6%
associate-/r*93.1%
Simplified93.1%
if 1.6500000000000001e-113 < t Initial program 99.9%
Taylor expanded in t around inf 96.1%
mul-1-neg96.1%
distribute-frac-neg96.1%
associate-/r*96.2%
Simplified96.2%
Final simplification89.4%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (or (<= y -5e+71) (not (<= y 2.15e+18))) (- 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 <= -5e+71) || !(y <= 2.15e+18)) {
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 <= (-5d+71)) .or. (.not. (y <= 2.15d+18))) 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 <= -5e+71) || !(y <= 2.15e+18)) {
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 <= -5e+71) or not (y <= 2.15e+18): 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 <= -5e+71) || !(y <= 2.15e+18)) 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 <= -5e+71) || ~((y <= 2.15e+18)))
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, -5e+71], N[Not[LessEqual[y, 2.15e+18]], $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 -5 \cdot 10^{+71} \lor \neg \left(y \leq 2.15 \cdot 10^{+18}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\end{array}
\end{array}
if y < -4.99999999999999972e71 or 2.15e18 < y Initial program 100.0%
Taylor expanded in t around inf 81.8%
associate-*r/81.8%
neg-mul-181.8%
Simplified81.8%
Taylor expanded in y around inf 80.6%
associate-*r/80.6%
neg-mul-180.6%
Simplified80.6%
expm1-log1p-u80.2%
expm1-udef80.2%
add-sqr-sqrt39.9%
sqrt-unprod70.0%
sqr-neg70.0%
sqrt-unprod40.1%
add-sqr-sqrt80.1%
Applied egg-rr80.1%
expm1-def80.1%
expm1-log1p80.5%
Simplified80.5%
if -4.99999999999999972e71 < y < 2.15e18Initial program 98.7%
Taylor expanded in y around 0 76.0%
Final simplification77.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 -4.5e-62) (not (<= y 1550000000000.0))) (- 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 <= -4.5e-62) || !(y <= 1550000000000.0)) {
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 <= (-4.5d-62)) .or. (.not. (y <= 1550000000000.0d0))) 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 <= -4.5e-62) || !(y <= 1550000000000.0)) {
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 <= -4.5e-62) or not (y <= 1550000000000.0): 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 <= -4.5e-62) || !(y <= 1550000000000.0)) 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 <= -4.5e-62) || ~((y <= 1550000000000.0)))
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, -4.5e-62], N[Not[LessEqual[y, 1550000000000.0]], $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 -4.5 \cdot 10^{-62} \lor \neg \left(y \leq 1550000000000\right):\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\end{array}
\end{array}
if y < -4.50000000000000018e-62 or 1.55e12 < y Initial program 100.0%
Taylor expanded in y around inf 89.2%
unpow289.2%
Simplified89.2%
if -4.50000000000000018e-62 < y < 1.55e12Initial program 98.3%
Taylor expanded in y around 0 78.5%
Final simplification84.1%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= y -5.8e-62) (- 1.0 (/ x (* y y))) (if (<= y 670000000000.0) (- 1.0 (/ x (* t z))) (- 1.0 (/ (/ x y) y)))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5.8e-62) {
tmp = 1.0 - (x / (y * y));
} else if (y <= 670000000000.0) {
tmp = 1.0 - (x / (t * z));
} else {
tmp = 1.0 - ((x / y) / y);
}
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 <= (-5.8d-62)) then
tmp = 1.0d0 - (x / (y * y))
else if (y <= 670000000000.0d0) then
tmp = 1.0d0 - (x / (t * z))
else
tmp = 1.0d0 - ((x / y) / y)
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 <= -5.8e-62) {
tmp = 1.0 - (x / (y * y));
} else if (y <= 670000000000.0) {
tmp = 1.0 - (x / (t * z));
} else {
tmp = 1.0 - ((x / y) / y);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if y <= -5.8e-62: tmp = 1.0 - (x / (y * y)) elif y <= 670000000000.0: tmp = 1.0 - (x / (t * z)) else: tmp = 1.0 - ((x / y) / y) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (y <= -5.8e-62) tmp = Float64(1.0 - Float64(x / Float64(y * y))); elseif (y <= 670000000000.0) tmp = Float64(1.0 - Float64(x / Float64(t * z))); else tmp = Float64(1.0 - Float64(Float64(x / y) / y)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (y <= -5.8e-62)
tmp = 1.0 - (x / (y * y));
elseif (y <= 670000000000.0)
tmp = 1.0 - (x / (t * z));
else
tmp = 1.0 - ((x / y) / y);
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, -5.8e-62], N[(1.0 - N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 670000000000.0], N[(1.0 - N[(x / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.8 \cdot 10^{-62}:\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\mathbf{elif}\;y \leq 670000000000:\\
\;\;\;\;1 - \frac{x}{t \cdot z}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y}\\
\end{array}
\end{array}
if y < -5.79999999999999971e-62Initial program 99.9%
Taylor expanded in y around inf 85.0%
unpow285.0%
Simplified85.0%
if -5.79999999999999971e-62 < y < 6.7e11Initial program 98.3%
Taylor expanded in y around 0 78.5%
if 6.7e11 < y Initial program 100.0%
Taylor expanded in y around inf 94.8%
unpow294.8%
associate-/r*94.8%
Simplified94.8%
Final simplification84.1%
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.2%
Final simplification99.2%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- 1.0 (/ x (* t z))))
assert(z < t);
double code(double x, double y, double z, double t) {
return 1.0 - (x / (t * 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 / (t * z))
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 - (x / (t * z));
}
[z, t] = sort([z, t]) def code(x, y, z, t): return 1.0 - (x / (t * z))
z, t = sort([z, t]) function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(t * z))) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - (x / (t * 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[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
1 - \frac{x}{t \cdot z}
\end{array}
Initial program 99.2%
Taylor expanded in y around 0 69.1%
Final simplification69.1%
herbie shell --seed 2023194
(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)))))