
(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 13 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}
(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}
Initial program 98.9%
Final simplification98.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- 1.0 (/ (/ x y) y))))
(if (<= y -3.4e+39)
t_1
(if (<= y -8e-58)
(- 1.0 (/ (/ x z) t))
(if (<= y -6.8e-175)
(+ 1.0 (/ x (* y t)))
(if (<= y 1.46e-39) (- 1.0 (/ (/ x t) z)) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = 1.0 - ((x / y) / y);
double tmp;
if (y <= -3.4e+39) {
tmp = t_1;
} else if (y <= -8e-58) {
tmp = 1.0 - ((x / z) / t);
} else if (y <= -6.8e-175) {
tmp = 1.0 + (x / (y * t));
} else if (y <= 1.46e-39) {
tmp = 1.0 - ((x / t) / z);
} else {
tmp = t_1;
}
return tmp;
}
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) :: t_1
real(8) :: tmp
t_1 = 1.0d0 - ((x / y) / y)
if (y <= (-3.4d+39)) then
tmp = t_1
else if (y <= (-8d-58)) then
tmp = 1.0d0 - ((x / z) / t)
else if (y <= (-6.8d-175)) then
tmp = 1.0d0 + (x / (y * t))
else if (y <= 1.46d-39) then
tmp = 1.0d0 - ((x / t) / z)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 1.0 - ((x / y) / y);
double tmp;
if (y <= -3.4e+39) {
tmp = t_1;
} else if (y <= -8e-58) {
tmp = 1.0 - ((x / z) / t);
} else if (y <= -6.8e-175) {
tmp = 1.0 + (x / (y * t));
} else if (y <= 1.46e-39) {
tmp = 1.0 - ((x / t) / z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 1.0 - ((x / y) / y) tmp = 0 if y <= -3.4e+39: tmp = t_1 elif y <= -8e-58: tmp = 1.0 - ((x / z) / t) elif y <= -6.8e-175: tmp = 1.0 + (x / (y * t)) elif y <= 1.46e-39: tmp = 1.0 - ((x / t) / z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(1.0 - Float64(Float64(x / y) / y)) tmp = 0.0 if (y <= -3.4e+39) tmp = t_1; elseif (y <= -8e-58) tmp = Float64(1.0 - Float64(Float64(x / z) / t)); elseif (y <= -6.8e-175) tmp = Float64(1.0 + Float64(x / Float64(y * t))); elseif (y <= 1.46e-39) tmp = Float64(1.0 - Float64(Float64(x / t) / z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 1.0 - ((x / y) / y); tmp = 0.0; if (y <= -3.4e+39) tmp = t_1; elseif (y <= -8e-58) tmp = 1.0 - ((x / z) / t); elseif (y <= -6.8e-175) tmp = 1.0 + (x / (y * t)); elseif (y <= 1.46e-39) tmp = 1.0 - ((x / t) / z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 - N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.4e+39], t$95$1, If[LessEqual[y, -8e-58], N[(1.0 - N[(N[(x / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -6.8e-175], N[(1.0 + N[(x / N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.46e-39], N[(1.0 - N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - \frac{\frac{x}{y}}{y}\\
\mathbf{if}\;y \leq -3.4 \cdot 10^{+39}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -8 \cdot 10^{-58}:\\
\;\;\;\;1 - \frac{\frac{x}{z}}{t}\\
\mathbf{elif}\;y \leq -6.8 \cdot 10^{-175}:\\
\;\;\;\;1 + \frac{x}{y \cdot t}\\
\mathbf{elif}\;y \leq 1.46 \cdot 10^{-39}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -3.3999999999999999e39 or 1.46000000000000001e-39 < y Initial program 100.0%
Taylor expanded in t around 0 94.0%
*-commutative94.0%
associate-/r*94.0%
Simplified94.0%
Taylor expanded in y around inf 92.5%
if -3.3999999999999999e39 < y < -8.0000000000000002e-58Initial program 99.9%
Taylor expanded in y around 0 75.3%
associate-/r*75.0%
div-inv75.0%
Applied egg-rr75.0%
associate-*l/75.3%
div-inv75.3%
Applied egg-rr75.3%
if -8.0000000000000002e-58 < y < -6.8e-175Initial program 99.9%
Taylor expanded in z around 0 57.1%
Taylor expanded in y around 0 45.2%
associate-*r/45.2%
neg-mul-145.2%
*-commutative45.2%
Simplified45.2%
if -6.8e-175 < y < 1.46000000000000001e-39Initial program 96.1%
Taylor expanded in y around 0 73.2%
associate-/r*73.3%
div-inv73.3%
Applied egg-rr73.3%
un-div-inv73.3%
Applied egg-rr73.3%
Final simplification80.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.2e-154) (not (<= t 2.6e-46))) (+ 1.0 (/ x (* (- y z) t))) (- 1.0 (/ (/ x (- y z)) y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.2e-154) || !(t <= 2.6e-46)) {
tmp = 1.0 + (x / ((y - z) * t));
} else {
tmp = 1.0 - ((x / (y - z)) / y);
}
return tmp;
}
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.2d-154)) .or. (.not. (t <= 2.6d-46))) then
tmp = 1.0d0 + (x / ((y - z) * t))
else
tmp = 1.0d0 - ((x / (y - z)) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.2e-154) || !(t <= 2.6e-46)) {
tmp = 1.0 + (x / ((y - z) * t));
} else {
tmp = 1.0 - ((x / (y - z)) / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.2e-154) or not (t <= 2.6e-46): tmp = 1.0 + (x / ((y - z) * t)) else: tmp = 1.0 - ((x / (y - z)) / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.2e-154) || !(t <= 2.6e-46)) tmp = Float64(1.0 + Float64(x / Float64(Float64(y - z) * t))); else tmp = Float64(1.0 - Float64(Float64(x / Float64(y - z)) / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.2e-154) || ~((t <= 2.6e-46))) tmp = 1.0 + (x / ((y - z) * t)); else tmp = 1.0 - ((x / (y - z)) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.2e-154], N[Not[LessEqual[t, 2.6e-46]], $MachinePrecision]], N[(1.0 + N[(x / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / N[(y - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.2 \cdot 10^{-154} \lor \neg \left(t \leq 2.6 \cdot 10^{-46}\right):\\
\;\;\;\;1 + \frac{x}{\left(y - z\right) \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{y - z}}{y}\\
\end{array}
\end{array}
if t < -1.19999999999999993e-154 or 2.6000000000000002e-46 < t Initial program 99.9%
Taylor expanded in t around inf 94.3%
associate-*r/94.3%
neg-mul-194.3%
Simplified94.3%
if -1.19999999999999993e-154 < t < 2.6000000000000002e-46Initial program 96.9%
Taylor expanded in t around 0 94.6%
*-commutative94.6%
associate-/r*96.4%
Simplified96.4%
Final simplification95.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.4e+59) (not (<= y 8e-66))) (- 1.0 (/ x (* y z))) (- 1.0 (/ x (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.4e+59) || !(y <= 8e-66)) {
tmp = 1.0 - (x / (y * z));
} else {
tmp = 1.0 - (x / (z * t));
}
return tmp;
}
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.4d+59)) .or. (.not. (y <= 8d-66))) then
tmp = 1.0d0 - (x / (y * z))
else
tmp = 1.0d0 - (x / (z * t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.4e+59) || !(y <= 8e-66)) {
tmp = 1.0 - (x / (y * z));
} else {
tmp = 1.0 - (x / (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.4e+59) or not (y <= 8e-66): tmp = 1.0 - (x / (y * z)) else: tmp = 1.0 - (x / (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.4e+59) || !(y <= 8e-66)) tmp = Float64(1.0 - Float64(x / Float64(y * z))); else tmp = Float64(1.0 - Float64(x / Float64(z * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.4e+59) || ~((y <= 8e-66))) tmp = 1.0 - (x / (y * z)); else tmp = 1.0 - (x / (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.4e+59], N[Not[LessEqual[y, 8e-66]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.4 \cdot 10^{+59} \lor \neg \left(y \leq 8 \cdot 10^{-66}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\end{array}
\end{array}
if y < -2.4000000000000002e59 or 7.9999999999999998e-66 < y Initial program 100.0%
Taylor expanded in t around 0 93.4%
*-commutative93.4%
associate-/r*93.4%
Simplified93.4%
Taylor expanded in y around 0 74.9%
associate-*r/74.9%
neg-mul-174.9%
Simplified74.9%
expm1-log1p-u73.6%
expm1-udef73.6%
associate-/l/73.6%
add-sqr-sqrt32.2%
sqrt-unprod65.6%
sqr-neg65.6%
sqrt-unprod41.3%
add-sqr-sqrt72.8%
Applied egg-rr72.8%
expm1-def72.8%
expm1-log1p73.6%
Simplified73.6%
if -2.4000000000000002e59 < y < 7.9999999999999998e-66Initial program 97.5%
Taylor expanded in y around 0 70.0%
Final simplification72.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.7e+59) (not (<= y 1.3e-65))) (- 1.0 (/ x (* y z))) (- 1.0 (/ (/ x t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.7e+59) || !(y <= 1.3e-65)) {
tmp = 1.0 - (x / (y * z));
} else {
tmp = 1.0 - ((x / t) / z);
}
return tmp;
}
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.7d+59)) .or. (.not. (y <= 1.3d-65))) then
tmp = 1.0d0 - (x / (y * z))
else
tmp = 1.0d0 - ((x / t) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.7e+59) || !(y <= 1.3e-65)) {
tmp = 1.0 - (x / (y * z));
} else {
tmp = 1.0 - ((x / t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.7e+59) or not (y <= 1.3e-65): tmp = 1.0 - (x / (y * z)) else: tmp = 1.0 - ((x / t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.7e+59) || !(y <= 1.3e-65)) tmp = Float64(1.0 - Float64(x / Float64(y * z))); else tmp = Float64(1.0 - Float64(Float64(x / t) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.7e+59) || ~((y <= 1.3e-65))) tmp = 1.0 - (x / (y * z)); else tmp = 1.0 - ((x / t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.7e+59], N[Not[LessEqual[y, 1.3e-65]], $MachinePrecision]], N[(1.0 - N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.7 \cdot 10^{+59} \lor \neg \left(y \leq 1.3 \cdot 10^{-65}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z}\\
\end{array}
\end{array}
if y < -1.70000000000000003e59 or 1.30000000000000005e-65 < y Initial program 100.0%
Taylor expanded in t around 0 93.4%
*-commutative93.4%
associate-/r*93.4%
Simplified93.4%
Taylor expanded in y around 0 74.9%
associate-*r/74.9%
neg-mul-174.9%
Simplified74.9%
expm1-log1p-u73.6%
expm1-udef73.6%
associate-/l/73.6%
add-sqr-sqrt32.2%
sqrt-unprod65.6%
sqr-neg65.6%
sqrt-unprod41.3%
add-sqr-sqrt72.8%
Applied egg-rr72.8%
expm1-def72.8%
expm1-log1p73.6%
Simplified73.6%
if -1.70000000000000003e59 < y < 1.30000000000000005e-65Initial program 97.5%
Taylor expanded in y around 0 70.0%
associate-/r*69.3%
div-inv69.3%
Applied egg-rr69.3%
un-div-inv69.3%
Applied egg-rr69.3%
Final simplification71.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.4e+39) (not (<= y 5.3e-39))) (- 1.0 (/ (/ x y) y)) (- 1.0 (/ (/ x t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.4e+39) || !(y <= 5.3e-39)) {
tmp = 1.0 - ((x / y) / y);
} else {
tmp = 1.0 - ((x / t) / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-3.4d+39)) .or. (.not. (y <= 5.3d-39))) then
tmp = 1.0d0 - ((x / y) / y)
else
tmp = 1.0d0 - ((x / t) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.4e+39) || !(y <= 5.3e-39)) {
tmp = 1.0 - ((x / y) / y);
} else {
tmp = 1.0 - ((x / t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.4e+39) or not (y <= 5.3e-39): tmp = 1.0 - ((x / y) / y) else: tmp = 1.0 - ((x / t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.4e+39) || !(y <= 5.3e-39)) tmp = Float64(1.0 - Float64(Float64(x / y) / y)); else tmp = Float64(1.0 - Float64(Float64(x / t) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3.4e+39) || ~((y <= 5.3e-39))) tmp = 1.0 - ((x / y) / y); else tmp = 1.0 - ((x / t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.4e+39], N[Not[LessEqual[y, 5.3e-39]], $MachinePrecision]], N[(1.0 - N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{+39} \lor \neg \left(y \leq 5.3 \cdot 10^{-39}\right):\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{t}}{z}\\
\end{array}
\end{array}
if y < -3.3999999999999999e39 or 5.30000000000000003e-39 < y Initial program 100.0%
Taylor expanded in t around 0 94.0%
*-commutative94.0%
associate-/r*94.0%
Simplified94.0%
Taylor expanded in y around inf 92.5%
if -3.3999999999999999e39 < y < 5.30000000000000003e-39Initial program 97.5%
Taylor expanded in y around 0 68.1%
associate-/r*67.3%
div-inv67.3%
Applied egg-rr67.3%
un-div-inv67.3%
Applied egg-rr67.3%
Final simplification80.8%
(FPCore (x y z t) :precision binary64 (if (<= z -7.5e-36) (+ 1.0 (/ x (* y z))) (if (<= z 4.3e-288) (- 1.0 (/ (/ x y) y)) (+ 1.0 (/ x (* y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.5e-36) {
tmp = 1.0 + (x / (y * z));
} else if (z <= 4.3e-288) {
tmp = 1.0 - ((x / y) / y);
} else {
tmp = 1.0 + (x / (y * t));
}
return tmp;
}
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-36)) then
tmp = 1.0d0 + (x / (y * z))
else if (z <= 4.3d-288) then
tmp = 1.0d0 - ((x / y) / y)
else
tmp = 1.0d0 + (x / (y * t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.5e-36) {
tmp = 1.0 + (x / (y * z));
} else if (z <= 4.3e-288) {
tmp = 1.0 - ((x / y) / y);
} else {
tmp = 1.0 + (x / (y * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7.5e-36: tmp = 1.0 + (x / (y * z)) elif z <= 4.3e-288: tmp = 1.0 - ((x / y) / y) else: tmp = 1.0 + (x / (y * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7.5e-36) tmp = Float64(1.0 + Float64(x / Float64(y * z))); elseif (z <= 4.3e-288) tmp = Float64(1.0 - Float64(Float64(x / y) / y)); else tmp = Float64(1.0 + Float64(x / Float64(y * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -7.5e-36) tmp = 1.0 + (x / (y * z)); elseif (z <= 4.3e-288) tmp = 1.0 - ((x / y) / y); else tmp = 1.0 + (x / (y * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7.5e-36], N[(1.0 + N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.3e-288], N[(1.0 - N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x / N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{-36}:\\
\;\;\;\;1 + \frac{x}{y \cdot z}\\
\mathbf{elif}\;z \leq 4.3 \cdot 10^{-288}:\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{y \cdot t}\\
\end{array}
\end{array}
if z < -7.49999999999999972e-36Initial program 100.0%
Taylor expanded in t around 0 87.8%
Taylor expanded in y around 0 83.7%
associate-*r/83.7%
neg-mul-183.7%
*-commutative83.7%
Simplified83.7%
if -7.49999999999999972e-36 < z < 4.29999999999999976e-288Initial program 97.5%
Taylor expanded in t around 0 66.6%
*-commutative66.6%
associate-/r*67.5%
Simplified67.5%
Taylor expanded in y around inf 66.0%
if 4.29999999999999976e-288 < z Initial program 99.1%
Taylor expanded in z around 0 76.3%
Taylor expanded in y around 0 62.5%
associate-*r/62.5%
neg-mul-162.5%
*-commutative62.5%
Simplified62.5%
Final simplification69.4%
(FPCore (x y z t) :precision binary64 (if (<= z -1.9e-35) (+ 1.0 (/ (/ x z) y)) (if (<= z 1.55e-291) (- 1.0 (/ (/ x y) y)) (+ 1.0 (/ x (* y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.9e-35) {
tmp = 1.0 + ((x / z) / y);
} else if (z <= 1.55e-291) {
tmp = 1.0 - ((x / y) / y);
} else {
tmp = 1.0 + (x / (y * t));
}
return tmp;
}
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 <= (-1.9d-35)) then
tmp = 1.0d0 + ((x / z) / y)
else if (z <= 1.55d-291) then
tmp = 1.0d0 - ((x / y) / y)
else
tmp = 1.0d0 + (x / (y * t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.9e-35) {
tmp = 1.0 + ((x / z) / y);
} else if (z <= 1.55e-291) {
tmp = 1.0 - ((x / y) / y);
} else {
tmp = 1.0 + (x / (y * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.9e-35: tmp = 1.0 + ((x / z) / y) elif z <= 1.55e-291: tmp = 1.0 - ((x / y) / y) else: tmp = 1.0 + (x / (y * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.9e-35) tmp = Float64(1.0 + Float64(Float64(x / z) / y)); elseif (z <= 1.55e-291) tmp = Float64(1.0 - Float64(Float64(x / y) / y)); else tmp = Float64(1.0 + Float64(x / Float64(y * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.9e-35) tmp = 1.0 + ((x / z) / y); elseif (z <= 1.55e-291) tmp = 1.0 - ((x / y) / y); else tmp = 1.0 + (x / (y * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.9e-35], N[(1.0 + N[(N[(x / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.55e-291], N[(1.0 - N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x / N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{-35}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y}\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{-291}:\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{y \cdot t}\\
\end{array}
\end{array}
if z < -1.9000000000000001e-35Initial program 100.0%
Taylor expanded in t around 0 87.8%
*-commutative87.8%
associate-/r*87.9%
Simplified87.9%
Taylor expanded in y around 0 83.7%
associate-*r/83.7%
neg-mul-183.7%
Simplified83.7%
if -1.9000000000000001e-35 < z < 1.55000000000000006e-291Initial program 97.4%
Taylor expanded in t around 0 67.4%
*-commutative67.4%
associate-/r*68.3%
Simplified68.3%
Taylor expanded in y around inf 66.8%
if 1.55000000000000006e-291 < z Initial program 99.1%
Taylor expanded in z around 0 77.2%
Taylor expanded in y around 0 63.8%
associate-*r/63.8%
neg-mul-163.8%
*-commutative63.8%
Simplified63.8%
Final simplification70.2%
(FPCore (x y z t) :precision binary64 (if (<= z -2600000000.0) (+ 1.0 (/ (/ x z) y)) (- 1.0 (/ x (* y (- y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2600000000.0) {
tmp = 1.0 + ((x / z) / y);
} else {
tmp = 1.0 - (x / (y * (y - t)));
}
return tmp;
}
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 <= (-2600000000.0d0)) then
tmp = 1.0d0 + ((x / z) / y)
else
tmp = 1.0d0 - (x / (y * (y - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2600000000.0) {
tmp = 1.0 + ((x / z) / y);
} else {
tmp = 1.0 - (x / (y * (y - t)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2600000000.0: tmp = 1.0 + ((x / z) / y) else: tmp = 1.0 - (x / (y * (y - t))) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2600000000.0) tmp = Float64(1.0 + Float64(Float64(x / z) / y)); else tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - t)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2600000000.0) tmp = 1.0 + ((x / z) / y); else tmp = 1.0 - (x / (y * (y - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2600000000.0], N[(1.0 + N[(N[(x / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(y * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2600000000:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\
\end{array}
\end{array}
if z < -2.6e9Initial program 100.0%
Taylor expanded in t around 0 87.8%
*-commutative87.8%
associate-/r*87.8%
Simplified87.8%
Taylor expanded in y around 0 85.9%
associate-*r/85.9%
neg-mul-185.9%
Simplified85.9%
if -2.6e9 < z Initial program 98.5%
Taylor expanded in z around 0 79.9%
Final simplification81.4%
(FPCore (x y z t) :precision binary64 (if (<= z -2.5e-54) (- 1.0 (/ x (* y (- y z)))) (- 1.0 (/ x (* y (- y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.5e-54) {
tmp = 1.0 - (x / (y * (y - z)));
} else {
tmp = 1.0 - (x / (y * (y - t)));
}
return tmp;
}
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.5d-54)) then
tmp = 1.0d0 - (x / (y * (y - z)))
else
tmp = 1.0d0 - (x / (y * (y - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.5e-54) {
tmp = 1.0 - (x / (y * (y - z)));
} else {
tmp = 1.0 - (x / (y * (y - t)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.5e-54: tmp = 1.0 - (x / (y * (y - z))) else: tmp = 1.0 - (x / (y * (y - t))) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.5e-54) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - z)))); else tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - t)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.5e-54) tmp = 1.0 - (x / (y * (y - z))); else tmp = 1.0 - (x / (y * (y - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.5e-54], N[(1.0 - N[(x / N[(y * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(y * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{-54}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\
\end{array}
\end{array}
if z < -2.50000000000000008e-54Initial program 100.0%
Taylor expanded in t around 0 86.2%
if -2.50000000000000008e-54 < z Initial program 98.4%
Taylor expanded in z around 0 80.9%
Final simplification82.4%
(FPCore (x y z t) :precision binary64 (if (<= z -1.25e-55) (- 1.0 (/ x (* y (- y z)))) (- 1.0 (/ (/ x (- y t)) y))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.25e-55) {
tmp = 1.0 - (x / (y * (y - z)));
} else {
tmp = 1.0 - ((x / (y - t)) / y);
}
return tmp;
}
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 <= (-1.25d-55)) then
tmp = 1.0d0 - (x / (y * (y - z)))
else
tmp = 1.0d0 - ((x / (y - t)) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.25e-55) {
tmp = 1.0 - (x / (y * (y - z)));
} else {
tmp = 1.0 - ((x / (y - t)) / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.25e-55: tmp = 1.0 - (x / (y * (y - z))) else: tmp = 1.0 - ((x / (y - t)) / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.25e-55) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - z)))); else tmp = Float64(1.0 - Float64(Float64(x / Float64(y - t)) / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.25e-55) tmp = 1.0 - (x / (y * (y - z))); else tmp = 1.0 - ((x / (y - t)) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.25e-55], N[(1.0 - N[(x / N[(y * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / N[(y - t), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{-55}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{y - t}}{y}\\
\end{array}
\end{array}
if z < -1.25e-55Initial program 100.0%
Taylor expanded in t around 0 86.2%
if -1.25e-55 < z Initial program 98.4%
Taylor expanded in z around 0 80.9%
*-commutative80.9%
associate-/r*81.1%
Simplified81.1%
Final simplification82.6%
(FPCore (x y z t) :precision binary64 (if (<= z -1.36e-55) (- 1.0 (/ (/ x (- y z)) y)) (- 1.0 (/ (/ x (- y t)) y))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.36e-55) {
tmp = 1.0 - ((x / (y - z)) / y);
} else {
tmp = 1.0 - ((x / (y - t)) / y);
}
return tmp;
}
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 <= (-1.36d-55)) then
tmp = 1.0d0 - ((x / (y - z)) / y)
else
tmp = 1.0d0 - ((x / (y - t)) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.36e-55) {
tmp = 1.0 - ((x / (y - z)) / y);
} else {
tmp = 1.0 - ((x / (y - t)) / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.36e-55: tmp = 1.0 - ((x / (y - z)) / y) else: tmp = 1.0 - ((x / (y - t)) / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.36e-55) tmp = Float64(1.0 - Float64(Float64(x / Float64(y - z)) / y)); else tmp = Float64(1.0 - Float64(Float64(x / Float64(y - t)) / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.36e-55) tmp = 1.0 - ((x / (y - z)) / y); else tmp = 1.0 - ((x / (y - t)) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.36e-55], N[(1.0 - N[(N[(x / N[(y - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(x / N[(y - t), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.36 \cdot 10^{-55}:\\
\;\;\;\;1 - \frac{\frac{x}{y - z}}{y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{x}{y - t}}{y}\\
\end{array}
\end{array}
if z < -1.35999999999999993e-55Initial program 100.0%
Taylor expanded in t around 0 86.2%
*-commutative86.2%
associate-/r*86.2%
Simplified86.2%
if -1.35999999999999993e-55 < z Initial program 98.4%
Taylor expanded in z around 0 80.9%
*-commutative80.9%
associate-/r*81.1%
Simplified81.1%
Final simplification82.6%
(FPCore (x y z t) :precision binary64 (- 1.0 (/ x (* z t))))
double code(double x, double y, double z, double t) {
return 1.0 - (x / (z * 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 / (z * t))
end function
public static double code(double x, double y, double z, double t) {
return 1.0 - (x / (z * t));
}
def code(x, y, z, t): return 1.0 - (x / (z * t))
function code(x, y, z, t) return Float64(1.0 - Float64(x / Float64(z * t))) end
function tmp = code(x, y, z, t) tmp = 1.0 - (x / (z * t)); end
code[x_, y_, z_, t_] := N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \frac{x}{z \cdot t}
\end{array}
Initial program 98.9%
Taylor expanded in y around 0 58.7%
Final simplification58.7%
herbie shell --seed 2023311
(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)))))