
(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.6%
Final simplification99.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- 1.0 (/ (/ x y) y))))
(if (<= y -1.75e-68)
t_1
(if (<= y 9e-111)
(- 1.0 (/ x (* z t)))
(if (<= y 0.00132) (+ 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 <= -1.75e-68) {
tmp = t_1;
} else if (y <= 9e-111) {
tmp = 1.0 - (x / (z * t));
} else if (y <= 0.00132) {
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 <= (-1.75d-68)) then
tmp = t_1
else if (y <= 9d-111) then
tmp = 1.0d0 - (x / (z * t))
else if (y <= 0.00132d0) 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 <= -1.75e-68) {
tmp = t_1;
} else if (y <= 9e-111) {
tmp = 1.0 - (x / (z * t));
} else if (y <= 0.00132) {
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 <= -1.75e-68: tmp = t_1 elif y <= 9e-111: tmp = 1.0 - (x / (z * t)) elif y <= 0.00132: 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 <= -1.75e-68) tmp = t_1; elseif (y <= 9e-111) tmp = Float64(1.0 - Float64(x / Float64(z * t))); elseif (y <= 0.00132) 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 <= -1.75e-68) tmp = t_1; elseif (y <= 9e-111) tmp = 1.0 - (x / (z * t)); elseif (y <= 0.00132) 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, -1.75e-68], t$95$1, If[LessEqual[y, 9e-111], N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.00132], 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 -1.75 \cdot 10^{-68}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 9 \cdot 10^{-111}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\mathbf{elif}\;y \leq 0.00132:\\
\;\;\;\;1 + \frac{x}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.75000000000000006e-68 or 0.00132 < y Initial program 100.0%
Taylor expanded in z around 0 94.3%
*-commutative94.3%
associate-/r*94.3%
Simplified94.3%
Taylor expanded in y around inf 88.6%
if -1.75000000000000006e-68 < y < 8.99999999999999987e-111Initial program 98.8%
Taylor expanded in y around 0 83.8%
if 8.99999999999999987e-111 < y < 0.00132Initial program 99.9%
Taylor expanded in t around 0 83.0%
Taylor expanded in y around 0 59.9%
associate-*r/59.9%
neg-mul-159.9%
*-commutative59.9%
Simplified59.9%
Final simplification83.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.1e-22) (not (<= y 1.8e+99))) (- 1.0 (/ (/ x y) y)) (- 1.0 (/ x (* t (- z y))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.1e-22) || !(y <= 1.8e+99)) {
tmp = 1.0 - ((x / y) / y);
} else {
tmp = 1.0 - (x / (t * (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 ((y <= (-2.1d-22)) .or. (.not. (y <= 1.8d+99))) then
tmp = 1.0d0 - ((x / y) / y)
else
tmp = 1.0d0 - (x / (t * (z - y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.1e-22) || !(y <= 1.8e+99)) {
tmp = 1.0 - ((x / y) / y);
} else {
tmp = 1.0 - (x / (t * (z - y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.1e-22) or not (y <= 1.8e+99): tmp = 1.0 - ((x / y) / y) else: tmp = 1.0 - (x / (t * (z - y))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.1e-22) || !(y <= 1.8e+99)) tmp = Float64(1.0 - Float64(Float64(x / y) / y)); else tmp = Float64(1.0 - Float64(x / Float64(t * Float64(z - y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.1e-22) || ~((y <= 1.8e+99))) tmp = 1.0 - ((x / y) / y); else tmp = 1.0 - (x / (t * (z - y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.1e-22], N[Not[LessEqual[y, 1.8e+99]], $MachinePrecision]], N[(1.0 - N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.1 \cdot 10^{-22} \lor \neg \left(y \leq 1.8 \cdot 10^{+99}\right):\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\
\end{array}
\end{array}
if y < -2.10000000000000008e-22 or 1.8000000000000001e99 < y Initial program 100.0%
Taylor expanded in z around 0 96.7%
*-commutative96.7%
associate-/r*96.7%
Simplified96.7%
Taylor expanded in y around inf 93.8%
if -2.10000000000000008e-22 < y < 1.8000000000000001e99Initial program 99.2%
Taylor expanded in y around 0 92.3%
distribute-lft-out92.3%
mul-1-neg92.3%
distribute-rgt-neg-in92.3%
unsub-neg92.3%
Simplified92.3%
Taylor expanded in t around inf 83.8%
Final simplification88.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.5e-24) (not (<= y 9.5e-129))) (+ 1.0 (/ x (* y (- t y)))) (- 1.0 (/ x (* t (- z y))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.5e-24) || !(y <= 9.5e-129)) {
tmp = 1.0 + (x / (y * (t - y)));
} else {
tmp = 1.0 - (x / (t * (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 ((y <= (-3.5d-24)) .or. (.not. (y <= 9.5d-129))) then
tmp = 1.0d0 + (x / (y * (t - y)))
else
tmp = 1.0d0 - (x / (t * (z - y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.5e-24) || !(y <= 9.5e-129)) {
tmp = 1.0 + (x / (y * (t - y)));
} else {
tmp = 1.0 - (x / (t * (z - y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.5e-24) or not (y <= 9.5e-129): tmp = 1.0 + (x / (y * (t - y))) else: tmp = 1.0 - (x / (t * (z - y))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.5e-24) || !(y <= 9.5e-129)) tmp = Float64(1.0 + Float64(x / Float64(y * Float64(t - y)))); else tmp = Float64(1.0 - Float64(x / Float64(t * Float64(z - y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3.5e-24) || ~((y <= 9.5e-129))) tmp = 1.0 + (x / (y * (t - y))); else tmp = 1.0 - (x / (t * (z - y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.5e-24], N[Not[LessEqual[y, 9.5e-129]], $MachinePrecision]], N[(1.0 + N[(x / N[(y * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{-24} \lor \neg \left(y \leq 9.5 \cdot 10^{-129}\right):\\
\;\;\;\;1 + \frac{x}{y \cdot \left(t - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\
\end{array}
\end{array}
if y < -3.4999999999999996e-24 or 9.5000000000000006e-129 < y Initial program 100.0%
Taylor expanded in z around 0 89.7%
if -3.4999999999999996e-24 < y < 9.5000000000000006e-129Initial program 98.8%
Taylor expanded in y around 0 96.6%
distribute-lft-out96.6%
mul-1-neg96.6%
distribute-rgt-neg-in96.6%
unsub-neg96.6%
Simplified96.6%
Taylor expanded in t around inf 91.3%
Final simplification90.3%
(FPCore (x y z t)
:precision binary64
(if (<= y -1e-25)
(- 1.0 (/ x (* y (- y z))))
(if (<= y 4.1e-128)
(- 1.0 (/ x (* t (- z y))))
(+ 1.0 (/ x (* y (- t y)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1e-25) {
tmp = 1.0 - (x / (y * (y - z)));
} else if (y <= 4.1e-128) {
tmp = 1.0 - (x / (t * (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 (y <= (-1d-25)) then
tmp = 1.0d0 - (x / (y * (y - z)))
else if (y <= 4.1d-128) then
tmp = 1.0d0 - (x / (t * (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 (y <= -1e-25) {
tmp = 1.0 - (x / (y * (y - z)));
} else if (y <= 4.1e-128) {
tmp = 1.0 - (x / (t * (z - y)));
} else {
tmp = 1.0 + (x / (y * (t - y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1e-25: tmp = 1.0 - (x / (y * (y - z))) elif y <= 4.1e-128: tmp = 1.0 - (x / (t * (z - y))) else: tmp = 1.0 + (x / (y * (t - y))) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1e-25) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - z)))); elseif (y <= 4.1e-128) tmp = Float64(1.0 - Float64(x / Float64(t * Float64(z - y)))); else tmp = Float64(1.0 + Float64(x / Float64(y * Float64(t - y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1e-25) tmp = 1.0 - (x / (y * (y - z))); elseif (y <= 4.1e-128) tmp = 1.0 - (x / (t * (z - y))); else tmp = 1.0 + (x / (y * (t - y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1e-25], N[(1.0 - N[(x / N[(y * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.1e-128], N[(1.0 - N[(x / N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x / N[(y * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{-25}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{-128}:\\
\;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x}{y \cdot \left(t - y\right)}\\
\end{array}
\end{array}
if y < -1.00000000000000004e-25Initial program 100.0%
Taylor expanded in t around 0 97.5%
if -1.00000000000000004e-25 < y < 4.1e-128Initial program 98.8%
Taylor expanded in y around 0 96.6%
distribute-lft-out96.6%
mul-1-neg96.6%
distribute-rgt-neg-in96.6%
unsub-neg96.6%
Simplified96.6%
Taylor expanded in t around inf 92.3%
if 4.1e-128 < y Initial program 99.9%
Taylor expanded in z around 0 85.4%
Final simplification91.4%
(FPCore (x y z t)
:precision binary64
(if (<= y -6.5e-58)
(- 1.0 (/ x (* y (- y z))))
(if (<= y 4.1e-128)
(- 1.0 (/ x (* t (- z y))))
(+ 1.0 (/ (/ x (- t y)) y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -6.5e-58) {
tmp = 1.0 - (x / (y * (y - z)));
} else if (y <= 4.1e-128) {
tmp = 1.0 - (x / (t * (z - y)));
} else {
tmp = 1.0 + ((x / (t - y)) / 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 (y <= (-6.5d-58)) then
tmp = 1.0d0 - (x / (y * (y - z)))
else if (y <= 4.1d-128) then
tmp = 1.0d0 - (x / (t * (z - y)))
else
tmp = 1.0d0 + ((x / (t - y)) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -6.5e-58) {
tmp = 1.0 - (x / (y * (y - z)));
} else if (y <= 4.1e-128) {
tmp = 1.0 - (x / (t * (z - y)));
} else {
tmp = 1.0 + ((x / (t - y)) / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -6.5e-58: tmp = 1.0 - (x / (y * (y - z))) elif y <= 4.1e-128: tmp = 1.0 - (x / (t * (z - y))) else: tmp = 1.0 + ((x / (t - y)) / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -6.5e-58) tmp = Float64(1.0 - Float64(x / Float64(y * Float64(y - z)))); elseif (y <= 4.1e-128) tmp = Float64(1.0 - Float64(x / Float64(t * Float64(z - y)))); else tmp = Float64(1.0 + Float64(Float64(x / Float64(t - y)) / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -6.5e-58) tmp = 1.0 - (x / (y * (y - z))); elseif (y <= 4.1e-128) tmp = 1.0 - (x / (t * (z - y))); else tmp = 1.0 + ((x / (t - y)) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -6.5e-58], N[(1.0 - N[(x / N[(y * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.1e-128], N[(1.0 - N[(x / N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x / N[(t - y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{-58}:\\
\;\;\;\;1 - \frac{x}{y \cdot \left(y - z\right)}\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{-128}:\\
\;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\frac{x}{t - y}}{y}\\
\end{array}
\end{array}
if y < -6.49999999999999964e-58Initial program 100.0%
Taylor expanded in t around 0 97.5%
if -6.49999999999999964e-58 < y < 4.1e-128Initial program 98.8%
Taylor expanded in y around 0 96.6%
distribute-lft-out96.6%
mul-1-neg96.6%
distribute-rgt-neg-in96.6%
unsub-neg96.6%
Simplified96.6%
Taylor expanded in t around inf 92.3%
if 4.1e-128 < y Initial program 99.9%
Taylor expanded in z around 0 85.4%
*-commutative85.4%
associate-/r*85.4%
Simplified85.4%
Final simplification91.4%
(FPCore (x y z t)
:precision binary64
(if (<= z -5.3e-61)
(+ 1.0 (/ (/ x z) (- y t)))
(if (<= z 1.95e-181)
(+ 1.0 (/ (/ x (- t y)) y))
(- 1.0 (/ x (* t (- z y)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.3e-61) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 1.95e-181) {
tmp = 1.0 + ((x / (t - y)) / y);
} else {
tmp = 1.0 - (x / (t * (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 (z <= (-5.3d-61)) then
tmp = 1.0d0 + ((x / z) / (y - t))
else if (z <= 1.95d-181) then
tmp = 1.0d0 + ((x / (t - y)) / y)
else
tmp = 1.0d0 - (x / (t * (z - y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.3e-61) {
tmp = 1.0 + ((x / z) / (y - t));
} else if (z <= 1.95e-181) {
tmp = 1.0 + ((x / (t - y)) / y);
} else {
tmp = 1.0 - (x / (t * (z - y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.3e-61: tmp = 1.0 + ((x / z) / (y - t)) elif z <= 1.95e-181: tmp = 1.0 + ((x / (t - y)) / y) else: tmp = 1.0 - (x / (t * (z - y))) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.3e-61) tmp = Float64(1.0 + Float64(Float64(x / z) / Float64(y - t))); elseif (z <= 1.95e-181) tmp = Float64(1.0 + Float64(Float64(x / Float64(t - y)) / y)); else tmp = Float64(1.0 - Float64(x / Float64(t * Float64(z - y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5.3e-61) tmp = 1.0 + ((x / z) / (y - t)); elseif (z <= 1.95e-181) tmp = 1.0 + ((x / (t - y)) / y); else tmp = 1.0 - (x / (t * (z - y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.3e-61], N[(1.0 + N[(N[(x / z), $MachinePrecision] / N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.95e-181], N[(1.0 + N[(N[(x / N[(t - y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.3 \cdot 10^{-61}:\\
\;\;\;\;1 + \frac{\frac{x}{z}}{y - t}\\
\mathbf{elif}\;z \leq 1.95 \cdot 10^{-181}:\\
\;\;\;\;1 + \frac{\frac{x}{t - y}}{y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\
\end{array}
\end{array}
if z < -5.3e-61Initial program 100.0%
clear-num99.9%
inv-pow99.9%
associate-/l*98.5%
Applied egg-rr98.5%
Taylor expanded in z around inf 98.2%
mul-1-neg98.2%
associate-/r*98.1%
distribute-neg-frac298.1%
Simplified98.1%
if -5.3e-61 < z < 1.95e-181Initial program 98.7%
Taylor expanded in z around 0 87.9%
*-commutative87.9%
associate-/r*88.0%
Simplified88.0%
if 1.95e-181 < z Initial program 99.9%
Taylor expanded in y around 0 84.8%
distribute-lft-out84.8%
mul-1-neg84.8%
distribute-rgt-neg-in84.8%
unsub-neg84.8%
Simplified84.8%
Taylor expanded in t around inf 73.2%
Final simplification84.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.2e+68) (not (<= y 2.65e-67))) (- 1.0 (/ x (* y t))) (- 1.0 (/ x (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.2e+68) || !(y <= 2.65e-67)) {
tmp = 1.0 - (x / (y * t));
} 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 <= (-1.2d+68)) .or. (.not. (y <= 2.65d-67))) then
tmp = 1.0d0 - (x / (y * t))
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 <= -1.2e+68) || !(y <= 2.65e-67)) {
tmp = 1.0 - (x / (y * t));
} else {
tmp = 1.0 - (x / (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.2e+68) or not (y <= 2.65e-67): tmp = 1.0 - (x / (y * t)) else: tmp = 1.0 - (x / (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.2e+68) || !(y <= 2.65e-67)) tmp = Float64(1.0 - Float64(x / Float64(y * t))); 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 <= -1.2e+68) || ~((y <= 2.65e-67))) tmp = 1.0 - (x / (y * t)); else tmp = 1.0 - (x / (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.2e+68], N[Not[LessEqual[y, 2.65e-67]], $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}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{+68} \lor \neg \left(y \leq 2.65 \cdot 10^{-67}\right):\\
\;\;\;\;1 - \frac{x}{y \cdot t}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\end{array}
\end{array}
if y < -1.20000000000000004e68 or 2.64999999999999986e-67 < y Initial program 100.0%
Taylor expanded in t around inf 69.2%
associate-*r/69.2%
neg-mul-169.2%
Simplified69.2%
Taylor expanded in y around inf 65.8%
div-inv65.8%
add-sqr-sqrt34.1%
sqrt-unprod54.7%
sqr-neg54.7%
sqrt-unprod30.4%
add-sqr-sqrt63.7%
*-commutative63.7%
associate-/r*63.7%
Applied egg-rr63.7%
associate-*r/63.7%
associate-*r/63.7%
*-rgt-identity63.7%
associate-/r*63.7%
Simplified63.7%
if -1.20000000000000004e68 < y < 2.64999999999999986e-67Initial program 99.1%
Taylor expanded in y around 0 73.5%
Final simplification68.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -9.8e-70) (not (<= y 1.22e-64))) (- 1.0 (/ (/ x y) y)) (- 1.0 (/ x (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -9.8e-70) || !(y <= 1.22e-64)) {
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 <= (-9.8d-70)) .or. (.not. (y <= 1.22d-64))) 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 <= -9.8e-70) || !(y <= 1.22e-64)) {
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 <= -9.8e-70) or not (y <= 1.22e-64): 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 <= -9.8e-70) || !(y <= 1.22e-64)) 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 <= -9.8e-70) || ~((y <= 1.22e-64))) 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, -9.8e-70], N[Not[LessEqual[y, 1.22e-64]], $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 -9.8 \cdot 10^{-70} \lor \neg \left(y \leq 1.22 \cdot 10^{-64}\right):\\
\;\;\;\;1 - \frac{\frac{x}{y}}{y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{z \cdot t}\\
\end{array}
\end{array}
if y < -9.8000000000000001e-70 or 1.22000000000000003e-64 < y Initial program 100.0%
Taylor expanded in z around 0 93.1%
*-commutative93.1%
associate-/r*93.1%
Simplified93.1%
Taylor expanded in y around inf 84.7%
if -9.8000000000000001e-70 < y < 1.22000000000000003e-64Initial program 99.0%
Taylor expanded in y around 0 78.7%
Final simplification82.3%
(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.6%
Taylor expanded in y around 0 59.4%
Final simplification59.4%
herbie shell --seed 2024039
(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)))))