
(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 10 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) (- t y)))))
double code(double x, double y, double z, double t) {
return 1.0 + (x / ((y - z) * (t - y)));
}
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) * (t - y)))
end function
public static double code(double x, double y, double z, double t) {
return 1.0 + (x / ((y - z) * (t - y)));
}
def code(x, y, z, t): return 1.0 + (x / ((y - z) * (t - y)))
function code(x, y, z, t) return Float64(1.0 + Float64(x / Float64(Float64(y - z) * Float64(t - y)))) end
function tmp = code(x, y, z, t) tmp = 1.0 + (x / ((y - z) * (t - y))); end
code[x_, y_, z_, t_] := N[(1.0 + N[(x / N[(N[(y - z), $MachinePrecision] * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{x}{\left(y - z\right) \cdot \left(t - y\right)}
\end{array}
Initial program 99.5%
Final simplification99.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ 1.0 (/ x (* (- y z) t)))))
(if (<= t -1.15e-168)
t_1
(if (<= t 2.8e-253)
(+ 1.0 (/ x (* y z)))
(if (<= t 3.5e-163) (- 1.0 (/ (/ x y) y)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = 1.0 + (x / ((y - z) * t));
double tmp;
if (t <= -1.15e-168) {
tmp = t_1;
} else if (t <= 2.8e-253) {
tmp = 1.0 + (x / (y * z));
} else if (t <= 3.5e-163) {
tmp = 1.0 - ((x / y) / y);
} 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 - z) * t))
if (t <= (-1.15d-168)) then
tmp = t_1
else if (t <= 2.8d-253) then
tmp = 1.0d0 + (x / (y * z))
else if (t <= 3.5d-163) then
tmp = 1.0d0 - ((x / y) / y)
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 - z) * t));
double tmp;
if (t <= -1.15e-168) {
tmp = t_1;
} else if (t <= 2.8e-253) {
tmp = 1.0 + (x / (y * z));
} else if (t <= 3.5e-163) {
tmp = 1.0 - ((x / y) / y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 1.0 + (x / ((y - z) * t)) tmp = 0 if t <= -1.15e-168: tmp = t_1 elif t <= 2.8e-253: tmp = 1.0 + (x / (y * z)) elif t <= 3.5e-163: tmp = 1.0 - ((x / y) / y) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(1.0 + Float64(x / Float64(Float64(y - z) * t))) tmp = 0.0 if (t <= -1.15e-168) tmp = t_1; elseif (t <= 2.8e-253) tmp = Float64(1.0 + Float64(x / Float64(y * z))); elseif (t <= 3.5e-163) tmp = Float64(1.0 - Float64(Float64(x / y) / y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 1.0 + (x / ((y - z) * t)); tmp = 0.0; if (t <= -1.15e-168) tmp = t_1; elseif (t <= 2.8e-253) tmp = 1.0 + (x / (y * z)); elseif (t <= 3.5e-163) tmp = 1.0 - ((x / y) / y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 + N[(x / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.15e-168], t$95$1, If[LessEqual[t, 2.8e-253], N[(1.0 + N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.5e-163], N[(1.0 - N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 + \frac{x}{\left(y - z\right) \cdot t}\\
\mathbf{if}\;t \leq -1.15 \cdot 10^{-168}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{-253}:\\
\;\;\;\;1 + \frac{x}{y \cdot z}\\
\mathbf{elif}\;t \leq 3.5 \cdot 10^{-163}:\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.14999999999999993e-168 or 3.50000000000000027e-163 < t Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
distribute-lft-in96.2%
Applied egg-rr96.2%
Taylor expanded in t around inf 94.5%
mul-1-neg94.5%
unsub-neg94.5%
Simplified94.5%
if -1.14999999999999993e-168 < t < 2.80000000000000006e-253Initial program 99.9%
Taylor expanded in t around 0 96.2%
Taylor expanded in y around 0 73.2%
associate-*r/73.2%
mul-1-neg73.2%
*-commutative73.2%
Simplified73.2%
if 2.80000000000000006e-253 < t < 3.50000000000000027e-163Initial program 94.7%
Taylor expanded in t around 0 94.7%
div-inv94.7%
*-commutative94.7%
associate-/r*94.7%
Applied egg-rr94.7%
associate-*r/97.3%
associate-*r/97.3%
associate-*l/97.3%
*-rgt-identity97.3%
Simplified97.3%
Taylor expanded in y around inf 89.1%
Final simplification90.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- 1.0 (/ (/ x y) y))))
(if (<= y -2.2e+22)
t_1
(if (<= y 3.05e-40)
(- 1.0 (/ x (* z t)))
(if (<= y 7.2e+20) (+ 1.0 (/ x (* y 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 <= -2.2e+22) {
tmp = t_1;
} else if (y <= 3.05e-40) {
tmp = 1.0 - (x / (z * t));
} else if (y <= 7.2e+20) {
tmp = 1.0 + (x / (y * 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 <= (-2.2d+22)) then
tmp = t_1
else if (y <= 3.05d-40) then
tmp = 1.0d0 - (x / (z * t))
else if (y <= 7.2d+20) then
tmp = 1.0d0 + (x / (y * 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 <= -2.2e+22) {
tmp = t_1;
} else if (y <= 3.05e-40) {
tmp = 1.0 - (x / (z * t));
} else if (y <= 7.2e+20) {
tmp = 1.0 + (x / (y * z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 1.0 - ((x / y) / y) tmp = 0 if y <= -2.2e+22: tmp = t_1 elif y <= 3.05e-40: tmp = 1.0 - (x / (z * t)) elif y <= 7.2e+20: tmp = 1.0 + (x / (y * 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 <= -2.2e+22) tmp = t_1; elseif (y <= 3.05e-40) tmp = Float64(1.0 - Float64(x / Float64(z * t))); elseif (y <= 7.2e+20) tmp = Float64(1.0 + Float64(x / Float64(y * 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 <= -2.2e+22) tmp = t_1; elseif (y <= 3.05e-40) tmp = 1.0 - (x / (z * t)); elseif (y <= 7.2e+20) tmp = 1.0 + (x / (y * 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, -2.2e+22], t$95$1, If[LessEqual[y, 3.05e-40], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.2e+20], N[(1.0 + N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - \frac{\frac{x}{y}}{y}\\
\mathbf{if}\;y \leq -2.2 \cdot 10^{+22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3.05 \cdot 10^{-40}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{+20}:\\
\;\;\;\;1 + \frac{x}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.2e22 or 7.2e20 < y Initial program 100.0%
Taylor expanded in t around 0 98.1%
div-inv98.1%
*-commutative98.1%
associate-/r*98.1%
Applied egg-rr98.1%
associate-*r/98.1%
associate-*r/98.1%
associate-*l/98.1%
*-rgt-identity98.1%
Simplified98.1%
Taylor expanded in y around inf 93.4%
if -2.2e22 < y < 3.0500000000000002e-40Initial program 99.2%
Taylor expanded in y around 0 75.2%
if 3.0500000000000002e-40 < y < 7.2e20Initial program 99.8%
Taylor expanded in t around 0 76.4%
Taylor expanded in y around 0 66.1%
associate-*r/66.1%
mul-1-neg66.1%
*-commutative66.1%
Simplified66.1%
Final simplification81.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- 1.0 (/ (/ x y) y))))
(if (<= y -2.8e+24)
t_1
(if (<= y 6.8e-41)
(- 1.0 (/ x (* z t)))
(if (<= y 7.2e+20) (+ 1.0 (/ (/ x y) 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 <= -2.8e+24) {
tmp = t_1;
} else if (y <= 6.8e-41) {
tmp = 1.0 - (x / (z * t));
} else if (y <= 7.2e+20) {
tmp = 1.0 + ((x / y) / 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 <= (-2.8d+24)) then
tmp = t_1
else if (y <= 6.8d-41) then
tmp = 1.0d0 - (x / (z * t))
else if (y <= 7.2d+20) then
tmp = 1.0d0 + ((x / y) / 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 <= -2.8e+24) {
tmp = t_1;
} else if (y <= 6.8e-41) {
tmp = 1.0 - (x / (z * t));
} else if (y <= 7.2e+20) {
tmp = 1.0 + ((x / y) / z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 1.0 - ((x / y) / y) tmp = 0 if y <= -2.8e+24: tmp = t_1 elif y <= 6.8e-41: tmp = 1.0 - (x / (z * t)) elif y <= 7.2e+20: tmp = 1.0 + ((x / y) / 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 <= -2.8e+24) tmp = t_1; elseif (y <= 6.8e-41) tmp = Float64(1.0 - Float64(x / Float64(z * t))); elseif (y <= 7.2e+20) tmp = Float64(1.0 + Float64(Float64(x / y) / 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 <= -2.8e+24) tmp = t_1; elseif (y <= 6.8e-41) tmp = 1.0 - (x / (z * t)); elseif (y <= 7.2e+20) tmp = 1.0 + ((x / y) / 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, -2.8e+24], t$95$1, If[LessEqual[y, 6.8e-41], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.2e+20], N[(1.0 + N[(N[(x / y), $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 -2.8 \cdot 10^{+24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{-41}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{+20}:\\
\;\;\;\;1 + \frac{\frac{x}{y}}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.8000000000000002e24 or 7.2e20 < y Initial program 100.0%
Taylor expanded in t around 0 98.1%
div-inv98.1%
*-commutative98.1%
associate-/r*98.1%
Applied egg-rr98.1%
associate-*r/98.1%
associate-*r/98.1%
associate-*l/98.1%
*-rgt-identity98.1%
Simplified98.1%
Taylor expanded in y around inf 93.4%
if -2.8000000000000002e24 < y < 6.7999999999999997e-41Initial program 99.2%
Taylor expanded in y around 0 75.2%
if 6.7999999999999997e-41 < y < 7.2e20Initial program 99.8%
Taylor expanded in z around inf 78.3%
associate-*r/78.3%
neg-mul-178.3%
*-commutative78.3%
Simplified78.3%
neg-mul-178.3%
*-commutative78.3%
times-frac78.4%
Applied egg-rr78.4%
associate-*l/78.3%
associate-*r/78.3%
mul-1-neg78.3%
Simplified78.3%
Taylor expanded in y around inf 66.1%
associate-*r/66.1%
mul-1-neg66.1%
Simplified66.1%
Final simplification81.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -5e-59) (not (<= t 6e-94))) (+ 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 <= -5e-59) || !(t <= 6e-94)) {
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 <= (-5d-59)) .or. (.not. (t <= 6d-94))) 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 <= -5e-59) || !(t <= 6e-94)) {
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 <= -5e-59) or not (t <= 6e-94): 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 <= -5e-59) || !(t <= 6e-94)) tmp = Float64(1.0 + Float64(x / Float64(Float64(y - z) * t))); else tmp = Float64(1.0 + Float64(x / Float64(y * Float64(z - y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -5e-59) || ~((t <= 6e-94))) 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, -5e-59], N[Not[LessEqual[t, 6e-94]], $MachinePrecision]], N[(1.0 + N[(x / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x / N[(y * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-59} \lor \neg \left(t \leq 6 \cdot 10^{-94}\right):\\
\;\;\;\;1 + \frac{x}{\left(y - z\right) \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{y \cdot \left(z - y\right)}\\
\end{array}
\end{array}
if t < -5.0000000000000001e-59 or 6.0000000000000003e-94 < t Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
distribute-lft-in95.6%
Applied egg-rr95.6%
Taylor expanded in t around inf 98.1%
mul-1-neg98.1%
unsub-neg98.1%
Simplified98.1%
if -5.0000000000000001e-59 < t < 6.0000000000000003e-94Initial program 98.9%
Taylor expanded in t around 0 84.7%
Final simplification93.2%
(FPCore (x y z t) :precision binary64 (if (<= t -1.22e-183) (+ 1.0 (/ x (* z (- y t)))) (if (<= t 1e-91) (+ 1.0 (/ x (* y (- z y)))) (+ 1.0 (/ x (* (- y z) t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.22e-183) {
tmp = 1.0 + (x / (z * (y - t)));
} else if (t <= 1e-91) {
tmp = 1.0 + (x / (y * (z - y)));
} else {
tmp = 1.0 + (x / ((y - 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 (t <= (-1.22d-183)) then
tmp = 1.0d0 + (x / (z * (y - t)))
else if (t <= 1d-91) then
tmp = 1.0d0 + (x / (y * (z - y)))
else
tmp = 1.0d0 + (x / ((y - z) * t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.22e-183) {
tmp = 1.0 + (x / (z * (y - t)));
} else if (t <= 1e-91) {
tmp = 1.0 + (x / (y * (z - y)));
} else {
tmp = 1.0 + (x / ((y - z) * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.22e-183: tmp = 1.0 + (x / (z * (y - t))) elif t <= 1e-91: tmp = 1.0 + (x / (y * (z - y))) else: tmp = 1.0 + (x / ((y - z) * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.22e-183) tmp = Float64(1.0 + Float64(x / Float64(z * Float64(y - t)))); elseif (t <= 1e-91) tmp = Float64(1.0 + Float64(x / Float64(y * Float64(z - y)))); else tmp = Float64(1.0 + Float64(x / Float64(Float64(y - z) * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.22e-183) tmp = 1.0 + (x / (z * (y - t))); elseif (t <= 1e-91) tmp = 1.0 + (x / (y * (z - y))); else tmp = 1.0 + (x / ((y - z) * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.22e-183], N[(1.0 + N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1e-91], N[(1.0 + N[(x / N[(y * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.22 \cdot 10^{-183}:\\
\;\;\;\;1 + \frac{x}{z \cdot \left(y - t\right)}\\
\mathbf{elif}\;t \leq 10^{-91}:\\
\;\;\;\;1 + \frac{x}{y \cdot \left(z - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{\left(y - z\right) \cdot t}\\
\end{array}
\end{array}
if t < -1.21999999999999992e-183Initial program 99.9%
clear-num99.9%
associate-/r/99.9%
Applied egg-rr99.9%
Taylor expanded in z around inf 83.9%
mul-1-neg83.9%
associate-/r*82.9%
distribute-neg-frac282.9%
Simplified82.9%
Taylor expanded in x around 0 83.9%
if -1.21999999999999992e-183 < t < 1.00000000000000002e-91Initial program 98.6%
Taylor expanded in t around 0 91.4%
if 1.00000000000000002e-91 < t Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
distribute-lft-in93.5%
Applied egg-rr93.5%
Taylor expanded in t around inf 98.5%
mul-1-neg98.5%
unsub-neg98.5%
Simplified98.5%
Final simplification90.5%
(FPCore (x y z t)
:precision binary64
(if (<= t -1.32e-176)
(+ 1.0 (/ x (* z (- y t))))
(if (<= t 7.2e-93)
(+ 1.0 (/ x (* y (- z y))))
(+ 1.0 (/ (/ x t) (- y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.32e-176) {
tmp = 1.0 + (x / (z * (y - t)));
} else if (t <= 7.2e-93) {
tmp = 1.0 + (x / (y * (z - y)));
} else {
tmp = 1.0 + ((x / t) / (y - 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 (t <= (-1.32d-176)) then
tmp = 1.0d0 + (x / (z * (y - t)))
else if (t <= 7.2d-93) then
tmp = 1.0d0 + (x / (y * (z - y)))
else
tmp = 1.0d0 + ((x / t) / (y - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.32e-176) {
tmp = 1.0 + (x / (z * (y - t)));
} else if (t <= 7.2e-93) {
tmp = 1.0 + (x / (y * (z - y)));
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.32e-176: tmp = 1.0 + (x / (z * (y - t))) elif t <= 7.2e-93: tmp = 1.0 + (x / (y * (z - y))) else: tmp = 1.0 + ((x / t) / (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.32e-176) tmp = Float64(1.0 + Float64(x / Float64(z * Float64(y - t)))); elseif (t <= 7.2e-93) tmp = Float64(1.0 + Float64(x / Float64(y * Float64(z - y)))); else tmp = Float64(1.0 + Float64(Float64(x / t) / Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.32e-176) tmp = 1.0 + (x / (z * (y - t))); elseif (t <= 7.2e-93) tmp = 1.0 + (x / (y * (z - y))); else tmp = 1.0 + ((x / t) / (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.32e-176], N[(1.0 + N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.2e-93], N[(1.0 + N[(x / N[(y * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.32 \cdot 10^{-176}:\\
\;\;\;\;1 + \frac{x}{z \cdot \left(y - t\right)}\\
\mathbf{elif}\;t \leq 7.2 \cdot 10^{-93}:\\
\;\;\;\;1 + \frac{x}{y \cdot \left(z - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if t < -1.32e-176Initial program 99.9%
clear-num99.9%
associate-/r/99.9%
Applied egg-rr99.9%
Taylor expanded in z around inf 83.6%
mul-1-neg83.6%
associate-/r*82.6%
distribute-neg-frac282.6%
Simplified82.6%
Taylor expanded in x around 0 83.6%
if -1.32e-176 < t < 7.2000000000000003e-93Initial program 98.6%
Taylor expanded in t around 0 91.7%
if 7.2000000000000003e-93 < t Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
distribute-lft-in93.5%
Applied egg-rr93.5%
Taylor expanded in t around inf 98.5%
associate-/r*98.5%
mul-1-neg98.5%
unsub-neg98.5%
Simplified98.5%
Final simplification90.5%
(FPCore (x y z t) :precision binary64 (if (<= t -8.2e-179) (+ 1.0 (/ x (* z (- y t)))) (if (<= t 5e-90) (+ 1.0 (/ (/ x (- z y)) y)) (+ 1.0 (/ (/ x t) (- y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -8.2e-179) {
tmp = 1.0 + (x / (z * (y - t)));
} else if (t <= 5e-90) {
tmp = 1.0 + ((x / (z - y)) / y);
} else {
tmp = 1.0 + ((x / t) / (y - 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 (t <= (-8.2d-179)) then
tmp = 1.0d0 + (x / (z * (y - t)))
else if (t <= 5d-90) then
tmp = 1.0d0 + ((x / (z - y)) / y)
else
tmp = 1.0d0 + ((x / t) / (y - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -8.2e-179) {
tmp = 1.0 + (x / (z * (y - t)));
} else if (t <= 5e-90) {
tmp = 1.0 + ((x / (z - y)) / y);
} else {
tmp = 1.0 + ((x / t) / (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -8.2e-179: tmp = 1.0 + (x / (z * (y - t))) elif t <= 5e-90: tmp = 1.0 + ((x / (z - y)) / y) else: tmp = 1.0 + ((x / t) / (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -8.2e-179) tmp = Float64(1.0 + Float64(x / Float64(z * Float64(y - t)))); elseif (t <= 5e-90) tmp = Float64(1.0 + Float64(Float64(x / Float64(z - y)) / y)); else tmp = Float64(1.0 + Float64(Float64(x / t) / Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -8.2e-179) tmp = 1.0 + (x / (z * (y - t))); elseif (t <= 5e-90) tmp = 1.0 + ((x / (z - y)) / y); else tmp = 1.0 + ((x / t) / (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -8.2e-179], N[(1.0 + N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5e-90], N[(1.0 + N[(N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.2 \cdot 10^{-179}:\\
\;\;\;\;1 + \frac{x}{z \cdot \left(y - t\right)}\\
\mathbf{elif}\;t \leq 5 \cdot 10^{-90}:\\
\;\;\;\;1 + \frac{\frac{x}{z - y}}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\
\end{array}
\end{array}
if t < -8.2e-179Initial program 99.9%
clear-num99.9%
associate-/r/99.9%
Applied egg-rr99.9%
Taylor expanded in z around inf 83.6%
mul-1-neg83.6%
associate-/r*82.6%
distribute-neg-frac282.6%
Simplified82.6%
Taylor expanded in x around 0 83.6%
if -8.2e-179 < t < 5.00000000000000019e-90Initial program 98.6%
Taylor expanded in t around 0 91.7%
div-inv91.5%
*-commutative91.5%
associate-/r*91.6%
Applied egg-rr91.6%
associate-*r/92.3%
associate-*r/92.3%
associate-*l/92.3%
*-rgt-identity92.3%
Simplified92.3%
if 5.00000000000000019e-90 < t Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
distribute-lft-in93.5%
Applied egg-rr93.5%
Taylor expanded in t around inf 98.5%
associate-/r*98.5%
mul-1-neg98.5%
unsub-neg98.5%
Simplified98.5%
Final simplification90.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.5e+26) (not (<= y 0.032))) (- 1.0 (/ (/ x y) y)) (- 1.0 (/ x (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.5e+26) || !(y <= 0.032)) {
tmp = 1.0 - ((x / y) / y);
} 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 <= (-3.5d+26)) .or. (.not. (y <= 0.032d0))) then
tmp = 1.0d0 - ((x / y) / y)
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 <= -3.5e+26) || !(y <= 0.032)) {
tmp = 1.0 - ((x / y) / y);
} else {
tmp = 1.0 - (x / (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.5e+26) or not (y <= 0.032): tmp = 1.0 - ((x / y) / y) else: tmp = 1.0 - (x / (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.5e+26) || !(y <= 0.032)) tmp = Float64(1.0 - Float64(Float64(x / y) / y)); 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 <= -3.5e+26) || ~((y <= 0.032))) tmp = 1.0 - ((x / y) / y); else tmp = 1.0 - (x / (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.5e+26], N[Not[LessEqual[y, 0.032]], $MachinePrecision]], N[(1.0 - N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{+26} \lor \neg \left(y \leq 0.032\right):\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\end{array}
\end{array}
if y < -3.4999999999999999e26 or 0.032000000000000001 < y Initial program 100.0%
Taylor expanded in t around 0 98.0%
div-inv98.0%
*-commutative98.0%
associate-/r*98.0%
Applied egg-rr98.0%
associate-*r/98.1%
associate-*r/98.1%
associate-*l/98.1%
*-rgt-identity98.1%
Simplified98.1%
Taylor expanded in y around inf 91.2%
if -3.4999999999999999e26 < y < 0.032000000000000001Initial program 99.2%
Taylor expanded in y around 0 73.0%
Final simplification80.7%
(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 99.5%
Taylor expanded in y around 0 64.4%
Final simplification64.4%
herbie shell --seed 2024053
(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)))))