
(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 12 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 (* (/ x (- y z)) (/ -1.0 (- y t)))))
assert(z < t);
double code(double x, double y, double z, double t) {
return 1.0 + ((x / (y - z)) * (-1.0 / (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 - z)) * ((-1.0d0) / (y - t)))
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 + ((x / (y - z)) * (-1.0 / (y - t)));
}
[z, t] = sort([z, t]) def code(x, y, z, t): return 1.0 + ((x / (y - z)) * (-1.0 / (y - t)))
z, t = sort([z, t]) function code(x, y, z, t) return Float64(1.0 + Float64(Float64(x / Float64(y - z)) * Float64(-1.0 / Float64(y - t)))) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 + ((x / (y - z)) * (-1.0 / (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[(N[(x / N[(y - z), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
1 + \frac{x}{y - z} \cdot \frac{-1}{y - t}
\end{array}
Initial program 99.6%
associate-/r*99.5%
div-inv99.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 (or (<= y -6.2e-98) (not (<= y 3.3e-42))) (- 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 <= -6.2e-98) || !(y <= 3.3e-42)) {
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 <= (-6.2d-98)) .or. (.not. (y <= 3.3d-42))) 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 <= -6.2e-98) || !(y <= 3.3e-42)) {
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 <= -6.2e-98) or not (y <= 3.3e-42): 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 <= -6.2e-98) || !(y <= 3.3e-42)) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - z)))); else tmp = Float64(1.0 - Float64(Float64(x / 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.2e-98) || ~((y <= 3.3e-42)))
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, -6.2e-98], N[Not[LessEqual[y, 3.3e-42]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.2 \cdot 10^{-98} \lor \neg \left(y \leq 3.3 \cdot 10^{-42}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z}\\
\end{array}
\end{array}
if y < -6.2e-98 or 3.3000000000000002e-42 < y Initial program 100.0%
Taylor expanded in t around 0 94.6%
if -6.2e-98 < y < 3.3000000000000002e-42Initial program 98.9%
Taylor expanded in y around 0 83.0%
associate-/r*84.0%
Simplified84.0%
Final simplification90.5%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (if (<= z -2.8e-70) (+ 1.0 (/ x (* z (- y t)))) (if (<= z 2.15e-10) (- 1.0 (/ x (* y (- y t)))) (- 1.0 (/ x (* z t))))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.8e-70) {
tmp = 1.0 + (x / (z * (y - t)));
} else if (z <= 2.15e-10) {
tmp = 1.0 - (x / (y * (y - t)));
} else {
tmp = 1.0 - (x / (z * 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 (z <= (-2.8d-70)) then
tmp = 1.0d0 + (x / (z * (y - t)))
else if (z <= 2.15d-10) then
tmp = 1.0d0 - (x / (y * (y - t)))
else
tmp = 1.0d0 - (x / (z * 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 (z <= -2.8e-70) {
tmp = 1.0 + (x / (z * (y - t)));
} else if (z <= 2.15e-10) {
tmp = 1.0 - (x / (y * (y - t)));
} else {
tmp = 1.0 - (x / (z * t));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if z <= -2.8e-70: tmp = 1.0 + (x / (z * (y - t))) elif z <= 2.15e-10: tmp = 1.0 - (x / (y * (y - t))) else: tmp = 1.0 - (x / (z * t)) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if (z <= -2.8e-70) tmp = Float64(1.0 + Float64(x / Float64(z * Float64(y - t)))); elseif (z <= 2.15e-10) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - t)))); else tmp = Float64(1.0 - Float64(x / Float64(z * t))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if (z <= -2.8e-70)
tmp = 1.0 + (x / (z * (y - t)));
elseif (z <= 2.15e-10)
tmp = 1.0 - (x / (y * (y - t)));
else
tmp = 1.0 - (x / (z * 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[z, -2.8e-70], N[(1.0 + N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.15e-10], N[(1.0 - N[(x / N[(y * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{-70}:\\
\;\;\;\;1 + \frac{x}{z \cdot \left(y - t\right)}\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{-10}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\end{array}
\end{array}
if z < -2.7999999999999999e-70Initial program 99.9%
Taylor expanded in z around inf 97.7%
associate-*r/97.7%
neg-mul-197.7%
Simplified97.7%
if -2.7999999999999999e-70 < z < 2.15000000000000007e-10Initial program 99.0%
Taylor expanded in z around 0 90.3%
if 2.15000000000000007e-10 < z Initial program 100.0%
Taylor expanded in y around 0 79.1%
Final simplification90.2%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= z -2.9e-69)
(+ 1.0 (/ x (* z (- y t))))
(if (<= z 6.2e-156)
(- 1.0 (/ x (* y (- y t))))
(+ 1.0 (/ (/ x t) (- y z))))))assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.9e-69) {
tmp = 1.0 + (x / (z * (y - t)));
} else if (z <= 6.2e-156) {
tmp = 1.0 - (x / (y * (y - t)));
} 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 (z <= (-2.9d-69)) then
tmp = 1.0d0 + (x / (z * (y - t)))
else if (z <= 6.2d-156) then
tmp = 1.0d0 - (x / (y * (y - t)))
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 (z <= -2.9e-69) {
tmp = 1.0 + (x / (z * (y - t)));
} else if (z <= 6.2e-156) {
tmp = 1.0 - (x / (y * (y - t)));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if z <= -2.9e-69: tmp = 1.0 + (x / (z * (y - t))) elif z <= 6.2e-156: tmp = 1.0 - (x / (y * (y - t))) 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 (z <= -2.9e-69) tmp = Float64(1.0 + Float64(x / Float64(z * Float64(y - t)))); elseif (z <= 6.2e-156) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - t)))); 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 (z <= -2.9e-69)
tmp = 1.0 + (x / (z * (y - t)));
elseif (z <= 6.2e-156)
tmp = 1.0 - (x / (y * (y - t)));
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[z, -2.9e-69], N[(1.0 + N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.2e-156], N[(1.0 - N[(x / N[(y * N[(y - t), $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}\;z \leq -2.9 \cdot 10^{-69}:\\
\;\;\;\;1 + \frac{x}{z \cdot \left(y - t\right)}\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-156}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if z < -2.8999999999999998e-69Initial program 99.9%
Taylor expanded in z around inf 97.7%
associate-*r/97.7%
neg-mul-197.7%
Simplified97.7%
if -2.8999999999999998e-69 < z < 6.1999999999999996e-156Initial program 98.8%
Taylor expanded in z around 0 93.0%
if 6.1999999999999996e-156 < z Initial program 99.9%
Taylor expanded in t around inf 79.0%
mul-1-neg79.0%
distribute-frac-neg79.0%
associate-/r*78.9%
Simplified78.9%
Final simplification89.8%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
:precision binary64
(if (<= z -3.3e-70)
(+ 1.0 (/ (/ x z) (- y t)))
(if (<= z 1.2e-152)
(- 1.0 (/ x (* y (- y t))))
(+ 1.0 (/ (/ x t) (- y z))))))assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.3e-70) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 1.2e-152) {
tmp = 1.0 - (x / (y * (y - t)));
} 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 (z <= (-3.3d-70)) then
tmp = 1.0d0 + ((x / z) / (y - t))
else if (z <= 1.2d-152) then
tmp = 1.0d0 - (x / (y * (y - t)))
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 (z <= -3.3e-70) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 1.2e-152) {
tmp = 1.0 - (x / (y * (y - t)));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if z <= -3.3e-70: tmp = 1.0 + ((x / z) / (y - t)) elif z <= 1.2e-152: tmp = 1.0 - (x / (y * (y - t))) 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 (z <= -3.3e-70) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); elseif (z <= 1.2e-152) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - t)))); 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 (z <= -3.3e-70)
tmp = 1.0 + ((x / z) / (y - t));
elseif (z <= 1.2e-152)
tmp = 1.0 - (x / (y * (y - t)));
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[z, -3.3e-70], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.2e-152], N[(1.0 - N[(x / N[(y * N[(y - t), $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}\;z \leq -3.3 \cdot 10^{-70}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{-152}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if z < -3.30000000000000016e-70Initial program 99.9%
associate-/r*99.9%
div-inv99.9%
Applied egg-rr99.9%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in z around inf 97.7%
associate-*r/97.7%
*-commutative97.7%
associate-/r*97.7%
neg-mul-197.7%
Simplified97.7%
if -3.30000000000000016e-70 < z < 1.2e-152Initial program 98.8%
Taylor expanded in z around 0 93.0%
if 1.2e-152 < z Initial program 99.9%
Taylor expanded in t around inf 79.0%
mul-1-neg79.0%
distribute-frac-neg79.0%
associate-/r*78.9%
Simplified78.9%
Final simplification89.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 -1600.0) (not (<= y 880.0))) (- 1.0 (/ x (* y t))) (- 1.0 (/ x (* z t)))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1600.0) || !(y <= 880.0)) {
tmp = 1.0 - (x / (y * t));
} else {
tmp = 1.0 - (x / (z * 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 <= (-1600.0d0)) .or. (.not. (y <= 880.0d0))) then
tmp = 1.0d0 - (x / (y * t))
else
tmp = 1.0d0 - (x / (z * 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 <= -1600.0) || !(y <= 880.0)) {
tmp = 1.0 - (x / (y * t));
} else {
tmp = 1.0 - (x / (z * t));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if (y <= -1600.0) or not (y <= 880.0): tmp = 1.0 - (x / (y * t)) else: tmp = 1.0 - (x / (z * t)) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if ((y <= -1600.0) || !(y <= 880.0)) tmp = Float64(1.0 - Float64(x / Float64(y * t))); else tmp = Float64(1.0 - Float64(x / Float64(z * t))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t)
tmp = 0.0;
if ((y <= -1600.0) || ~((y <= 880.0)))
tmp = 1.0 - (x / (y * t));
else
tmp = 1.0 - (x / (z * 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[Or[LessEqual[y, -1600.0], N[Not[LessEqual[y, 880.0]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1600 \lor \neg \left(y \leq 880\right):\\
\;\;\;\;1 - \frac{x}{y \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\end{array}
\end{array}
if y < -1600 or 880 < y Initial program 100.0%
Taylor expanded in t around inf 75.1%
mul-1-neg75.1%
distribute-frac-neg75.1%
associate-/r*75.0%
Simplified75.0%
Taylor expanded in y around inf 73.6%
associate-*r/73.6%
neg-mul-173.6%
Simplified73.6%
expm1-log1p-u72.2%
expm1-udef72.2%
add-sqr-sqrt28.4%
sqrt-unprod62.9%
sqr-neg62.9%
sqrt-unprod43.8%
add-sqr-sqrt72.3%
Applied egg-rr72.3%
expm1-def72.3%
expm1-log1p72.8%
Simplified72.8%
if -1600 < y < 880Initial program 99.1%
Taylor expanded in y around 0 76.7%
Final simplification74.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 -2.8e+46) (not (<= y 6.6e-40))) (- 1.0 (/ x (* y y))) (- 1.0 (/ x (* z t)))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.8e+46) || !(y <= 6.6e-40)) {
tmp = 1.0 - (x / (y * y));
} else {
tmp = 1.0 - (x / (z * 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.8d+46)) .or. (.not. (y <= 6.6d-40))) then
tmp = 1.0d0 - (x / (y * y))
else
tmp = 1.0d0 - (x / (z * 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.8e+46) || !(y <= 6.6e-40)) {
tmp = 1.0 - (x / (y * y));
} else {
tmp = 1.0 - (x / (z * t));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if (y <= -2.8e+46) or not (y <= 6.6e-40): tmp = 1.0 - (x / (y * y)) else: tmp = 1.0 - (x / (z * t)) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if ((y <= -2.8e+46) || !(y <= 6.6e-40)) tmp = Float64(1.0 - Float64(x / Float64(y * y))); else tmp = Float64(1.0 - Float64(x / Float64(z * 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.8e+46) || ~((y <= 6.6e-40)))
tmp = 1.0 - (x / (y * y));
else
tmp = 1.0 - (x / (z * 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[Or[LessEqual[y, -2.8e+46], N[Not[LessEqual[y, 6.6e-40]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.8 \cdot 10^{+46} \lor \neg \left(y \leq 6.6 \cdot 10^{-40}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\end{array}
\end{array}
if y < -2.80000000000000018e46 or 6.59999999999999986e-40 < y Initial program 100.0%
Taylor expanded in y around inf 93.2%
unpow293.2%
Simplified93.2%
if -2.80000000000000018e46 < y < 6.59999999999999986e-40Initial program 99.1%
Taylor expanded in y around 0 78.5%
Final simplification86.0%
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.8e+46) (not (<= y 4.4e-36))) (- 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 <= -2.8e+46) || !(y <= 4.4e-36)) {
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 <= (-2.8d+46)) .or. (.not. (y <= 4.4d-36))) 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 <= -2.8e+46) || !(y <= 4.4e-36)) {
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 <= -2.8e+46) or not (y <= 4.4e-36): 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 <= -2.8e+46) || !(y <= 4.4e-36)) tmp = Float64(1.0 - Float64(x / Float64(y * y))); else tmp = Float64(1.0 - Float64(Float64(x / 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.8e+46) || ~((y <= 4.4e-36)))
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, -2.8e+46], N[Not[LessEqual[y, 4.4e-36]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.8 \cdot 10^{+46} \lor \neg \left(y \leq 4.4 \cdot 10^{-36}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z}\\
\end{array}
\end{array}
if y < -2.80000000000000018e46 or 4.3999999999999999e-36 < y Initial program 100.0%
Taylor expanded in y around inf 93.2%
unpow293.2%
Simplified93.2%
if -2.80000000000000018e46 < y < 4.3999999999999999e-36Initial program 99.1%
Taylor expanded in y around 0 78.5%
associate-/r*79.2%
Simplified79.2%
Final simplification86.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 -2.8e+46) (not (<= y 8.2e-37))) (- 1.0 (/ x (* y y))) (- 1.0 (/ (/ x z) t))))
assert(z < t);
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.8e+46) || !(y <= 8.2e-37)) {
tmp = 1.0 - (x / (y * y));
} else {
tmp = 1.0 - ((x / z) / 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.8d+46)) .or. (.not. (y <= 8.2d-37))) then
tmp = 1.0d0 - (x / (y * y))
else
tmp = 1.0d0 - ((x / z) / 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.8e+46) || !(y <= 8.2e-37)) {
tmp = 1.0 - (x / (y * y));
} else {
tmp = 1.0 - ((x / z) / t);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t): tmp = 0 if (y <= -2.8e+46) or not (y <= 8.2e-37): tmp = 1.0 - (x / (y * y)) else: tmp = 1.0 - ((x / z) / t) return tmp
z, t = sort([z, t]) function code(x, y, z, t) tmp = 0.0 if ((y <= -2.8e+46) || !(y <= 8.2e-37)) tmp = Float64(1.0 - Float64(x / Float64(y * y))); else tmp = Float64(1.0 - Float64(Float64(x / z) / 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.8e+46) || ~((y <= 8.2e-37)))
tmp = 1.0 - (x / (y * y));
else
tmp = 1.0 - ((x / z) / 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[Or[LessEqual[y, -2.8e+46], N[Not[LessEqual[y, 8.2e-37]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.8 \cdot 10^{+46} \lor \neg \left(y \leq 8.2 \cdot 10^{-37}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{z}}{t}\\
\end{array}
\end{array}
if y < -2.80000000000000018e46 or 8.1999999999999996e-37 < y Initial program 100.0%
Taylor expanded in y around inf 93.2%
unpow293.2%
Simplified93.2%
if -2.80000000000000018e46 < y < 8.1999999999999996e-37Initial program 99.1%
associate-/r*99.2%
div-inv99.2%
Applied egg-rr99.2%
un-div-inv99.2%
Applied egg-rr99.2%
Taylor expanded in y around 0 78.5%
associate-/l/79.3%
Simplified79.3%
Final simplification86.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 z) (- y t)))))
assert(z < t);
double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (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 - z) * (y - t)))
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 - (x / ((y - z) * (y - t)));
}
[z, t] = sort([z, t]) def code(x, y, z, t): return 1.0 - (x / ((y - z) * (y - t)))
z, t = sort([z, t]) function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t)))) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - (x / ((y - z) * (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[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}
\end{array}
Initial program 99.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 (- 1.0 (/ (/ x (- y z)) (- y t))))
assert(z < t);
double code(double x, double y, double z, double t) {
return 1.0 - ((x / (y - z)) / (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 - z)) / (y - t))
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 - ((x / (y - z)) / (y - t));
}
[z, t] = sort([z, t]) def code(x, y, z, t): return 1.0 - ((x / (y - z)) / (y - t))
z, t = sort([z, t]) function code(x, y, z, t) return Float64(1.0 - Float64(Float64(x / Float64(y - z)) / Float64(y - t))) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - ((x / (y - z)) / (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[(N[(x / N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
1 - \frac{\frac{x}{y - z}}{y - t}
\end{array}
Initial program 99.6%
associate-/r*99.5%
div-inv99.6%
Applied egg-rr99.6%
un-div-inv99.5%
Applied egg-rr99.5%
Final simplification99.5%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t) :precision binary64 (- 1.0 (/ x (* z t))))
assert(z < t);
double code(double x, double y, double z, double t) {
return 1.0 - (x / (z * 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 / (z * t))
end function
assert z < t;
public static double code(double x, double y, double z, double t) {
return 1.0 - (x / (z * t));
}
[z, t] = sort([z, t]) def code(x, y, z, t): return 1.0 - (x / (z * t))
z, t = sort([z, t]) function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(z * t))) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t)
tmp = 1.0 - (x / (z * 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[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
1 - \frac{x}{z \cdot t}
\end{array}
Initial program 99.6%
Taylor expanded in y around 0 64.5%
Final simplification64.5%
herbie shell --seed 2023238
(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)))))