
(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
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 = x * ((y / z) - (t / (1.0d0 - z)))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
def code(x, y, z, t): return x * ((y / z) - (t / (1.0 - z)))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) - (t / (1.0 - z))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
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 = x * ((y / z) - (t / (1.0d0 - z)))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
def code(x, y, z, t): return x * ((y / z) - (t / (1.0 - z)))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) - (t / (1.0 - z))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\end{array}
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (/ y z) (/ t (+ z -1.0)))) (t_2 (* t_1 x)))
(if (<= t_1 (- INFINITY))
(/ (* y x) z)
(if (<= t_1 -4e-133)
t_2
(if (<= t_1 1e-323)
(* y (+ (/ (* t x) (* y (+ z -1.0))) (/ x z)))
(if (<= t_1 1e+302) t_2 (* (* y x) (/ 1.0 z))))))))
double code(double x, double y, double z, double t) {
double t_1 = (y / z) + (t / (z + -1.0));
double t_2 = t_1 * x;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (y * x) / z;
} else if (t_1 <= -4e-133) {
tmp = t_2;
} else if (t_1 <= 1e-323) {
tmp = y * (((t * x) / (y * (z + -1.0))) + (x / z));
} else if (t_1 <= 1e+302) {
tmp = t_2;
} else {
tmp = (y * x) * (1.0 / z);
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (y / z) + (t / (z + -1.0));
double t_2 = t_1 * x;
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (y * x) / z;
} else if (t_1 <= -4e-133) {
tmp = t_2;
} else if (t_1 <= 1e-323) {
tmp = y * (((t * x) / (y * (z + -1.0))) + (x / z));
} else if (t_1 <= 1e+302) {
tmp = t_2;
} else {
tmp = (y * x) * (1.0 / z);
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / z) + (t / (z + -1.0)) t_2 = t_1 * x tmp = 0 if t_1 <= -math.inf: tmp = (y * x) / z elif t_1 <= -4e-133: tmp = t_2 elif t_1 <= 1e-323: tmp = y * (((t * x) / (y * (z + -1.0))) + (x / z)) elif t_1 <= 1e+302: tmp = t_2 else: tmp = (y * x) * (1.0 / z) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y / z) + Float64(t / Float64(z + -1.0))) t_2 = Float64(t_1 * x) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(y * x) / z); elseif (t_1 <= -4e-133) tmp = t_2; elseif (t_1 <= 1e-323) tmp = Float64(y * Float64(Float64(Float64(t * x) / Float64(y * Float64(z + -1.0))) + Float64(x / z))); elseif (t_1 <= 1e+302) tmp = t_2; else tmp = Float64(Float64(y * x) * Float64(1.0 / z)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y / z) + (t / (z + -1.0)); t_2 = t_1 * x; tmp = 0.0; if (t_1 <= -Inf) tmp = (y * x) / z; elseif (t_1 <= -4e-133) tmp = t_2; elseif (t_1 <= 1e-323) tmp = y * (((t * x) / (y * (z + -1.0))) + (x / z)); elseif (t_1 <= 1e+302) tmp = t_2; else tmp = (y * x) * (1.0 / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / z), $MachinePrecision] + N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * x), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t$95$1, -4e-133], t$95$2, If[LessEqual[t$95$1, 1e-323], N[(y * N[(N[(N[(t * x), $MachinePrecision] / N[(y * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+302], t$95$2, N[(N[(y * x), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} + \frac{t}{z + -1}\\
t_2 := t\_1 \cdot x\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\mathbf{elif}\;t\_1 \leq -4 \cdot 10^{-133}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10^{-323}:\\
\;\;\;\;y \cdot \left(\frac{t \cdot x}{y \cdot \left(z + -1\right)} + \frac{x}{z}\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+302}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot x\right) \cdot \frac{1}{z}\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -inf.0Initial program 74.4%
Taylor expanded in y around inf 100.0%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -4.0000000000000003e-133 or 9.88131e-324 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 1.0000000000000001e302Initial program 99.8%
if -4.0000000000000003e-133 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 9.88131e-324Initial program 82.1%
Taylor expanded in y around inf 99.7%
mul-1-neg99.7%
distribute-neg-frac299.7%
distribute-rgt-neg-in99.7%
neg-sub099.7%
associate--r-99.7%
metadata-eval99.7%
Simplified99.7%
if 1.0000000000000001e302 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 65.1%
Taylor expanded in z around inf 90.1%
clear-num90.1%
associate-/r/90.3%
cancel-sign-sub-inv90.3%
metadata-eval90.3%
*-un-lft-identity90.3%
Applied egg-rr90.3%
Taylor expanded in y around inf 99.9%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (/ y z) (/ t (+ z -1.0)))) (t_2 (* t_1 x)))
(if (<= t_1 (- INFINITY))
(/ (* y x) z)
(if (<= t_1 -2e-252)
t_2
(if (<= t_1 1e-323)
(/ (* x (+ y t)) z)
(if (<= t_1 1e+302) t_2 (* (* y x) (/ 1.0 z))))))))
double code(double x, double y, double z, double t) {
double t_1 = (y / z) + (t / (z + -1.0));
double t_2 = t_1 * x;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (y * x) / z;
} else if (t_1 <= -2e-252) {
tmp = t_2;
} else if (t_1 <= 1e-323) {
tmp = (x * (y + t)) / z;
} else if (t_1 <= 1e+302) {
tmp = t_2;
} else {
tmp = (y * x) * (1.0 / z);
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (y / z) + (t / (z + -1.0));
double t_2 = t_1 * x;
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (y * x) / z;
} else if (t_1 <= -2e-252) {
tmp = t_2;
} else if (t_1 <= 1e-323) {
tmp = (x * (y + t)) / z;
} else if (t_1 <= 1e+302) {
tmp = t_2;
} else {
tmp = (y * x) * (1.0 / z);
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / z) + (t / (z + -1.0)) t_2 = t_1 * x tmp = 0 if t_1 <= -math.inf: tmp = (y * x) / z elif t_1 <= -2e-252: tmp = t_2 elif t_1 <= 1e-323: tmp = (x * (y + t)) / z elif t_1 <= 1e+302: tmp = t_2 else: tmp = (y * x) * (1.0 / z) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y / z) + Float64(t / Float64(z + -1.0))) t_2 = Float64(t_1 * x) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(y * x) / z); elseif (t_1 <= -2e-252) tmp = t_2; elseif (t_1 <= 1e-323) tmp = Float64(Float64(x * Float64(y + t)) / z); elseif (t_1 <= 1e+302) tmp = t_2; else tmp = Float64(Float64(y * x) * Float64(1.0 / z)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y / z) + (t / (z + -1.0)); t_2 = t_1 * x; tmp = 0.0; if (t_1 <= -Inf) tmp = (y * x) / z; elseif (t_1 <= -2e-252) tmp = t_2; elseif (t_1 <= 1e-323) tmp = (x * (y + t)) / z; elseif (t_1 <= 1e+302) tmp = t_2; else tmp = (y * x) * (1.0 / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / z), $MachinePrecision] + N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * x), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t$95$1, -2e-252], t$95$2, If[LessEqual[t$95$1, 1e-323], N[(N[(x * N[(y + t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t$95$1, 1e+302], t$95$2, N[(N[(y * x), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} + \frac{t}{z + -1}\\
t_2 := t\_1 \cdot x\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-252}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10^{-323}:\\
\;\;\;\;\frac{x \cdot \left(y + t\right)}{z}\\
\mathbf{elif}\;t\_1 \leq 10^{+302}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot x\right) \cdot \frac{1}{z}\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -inf.0Initial program 74.4%
Taylor expanded in y around inf 100.0%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -1.99999999999999989e-252 or 9.88131e-324 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 1.0000000000000001e302Initial program 99.8%
if -1.99999999999999989e-252 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 9.88131e-324Initial program 68.9%
Taylor expanded in z around inf 99.7%
Taylor expanded in y around 0 99.7%
*-commutative99.7%
+-commutative99.7%
distribute-lft-in99.7%
Simplified99.7%
if 1.0000000000000001e302 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 65.1%
Taylor expanded in z around inf 90.1%
clear-num90.1%
associate-/r/90.3%
cancel-sign-sub-inv90.3%
metadata-eval90.3%
*-un-lft-identity90.3%
Applied egg-rr90.3%
Taylor expanded in y around inf 99.9%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(if (<= z -3.5e+89)
(* x (/ t z))
(if (<= z 61000000.0)
(* x (- (/ y z) t))
(if (or (<= z 6.5e+28) (not (<= z 1.1e+75)))
(* x (/ t (+ z -1.0)))
(* (/ y z) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.5e+89) {
tmp = x * (t / z);
} else if (z <= 61000000.0) {
tmp = x * ((y / z) - t);
} else if ((z <= 6.5e+28) || !(z <= 1.1e+75)) {
tmp = x * (t / (z + -1.0));
} else {
tmp = (y / z) * x;
}
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 <= (-3.5d+89)) then
tmp = x * (t / z)
else if (z <= 61000000.0d0) then
tmp = x * ((y / z) - t)
else if ((z <= 6.5d+28) .or. (.not. (z <= 1.1d+75))) then
tmp = x * (t / (z + (-1.0d0)))
else
tmp = (y / z) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.5e+89) {
tmp = x * (t / z);
} else if (z <= 61000000.0) {
tmp = x * ((y / z) - t);
} else if ((z <= 6.5e+28) || !(z <= 1.1e+75)) {
tmp = x * (t / (z + -1.0));
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3.5e+89: tmp = x * (t / z) elif z <= 61000000.0: tmp = x * ((y / z) - t) elif (z <= 6.5e+28) or not (z <= 1.1e+75): tmp = x * (t / (z + -1.0)) else: tmp = (y / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3.5e+89) tmp = Float64(x * Float64(t / z)); elseif (z <= 61000000.0) tmp = Float64(x * Float64(Float64(y / z) - t)); elseif ((z <= 6.5e+28) || !(z <= 1.1e+75)) tmp = Float64(x * Float64(t / Float64(z + -1.0))); else tmp = Float64(Float64(y / z) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3.5e+89) tmp = x * (t / z); elseif (z <= 61000000.0) tmp = x * ((y / z) - t); elseif ((z <= 6.5e+28) || ~((z <= 1.1e+75))) tmp = x * (t / (z + -1.0)); else tmp = (y / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.5e+89], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 61000000.0], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 6.5e+28], N[Not[LessEqual[z, 1.1e+75]], $MachinePrecision]], N[(x * N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+89}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{elif}\;z \leq 61000000:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{+28} \lor \neg \left(z \leq 1.1 \cdot 10^{+75}\right):\\
\;\;\;\;x \cdot \frac{t}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if z < -3.5000000000000001e89Initial program 92.2%
Taylor expanded in z around inf 77.7%
*-commutative77.7%
remove-double-neg77.7%
cancel-sign-sub-inv77.7%
metadata-eval77.7%
*-lft-identity77.7%
distribute-neg-out77.7%
neg-mul-177.7%
sub-neg77.7%
distribute-lft-neg-in77.7%
*-commutative77.7%
distribute-neg-frac77.7%
associate-/l*92.2%
distribute-rgt-neg-in92.2%
distribute-neg-frac92.2%
Simplified92.2%
Taylor expanded in t around inf 58.0%
*-commutative58.0%
associate-/l*67.9%
Simplified67.9%
if -3.5000000000000001e89 < z < 6.1e7Initial program 91.8%
Taylor expanded in z around 0 88.7%
if 6.1e7 < z < 6.5000000000000001e28 or 1.10000000000000006e75 < z Initial program 97.3%
Taylor expanded in y around 0 56.4%
mul-1-neg56.4%
*-commutative56.4%
associate-/l*68.8%
distribute-rgt-neg-out68.8%
distribute-neg-frac268.8%
neg-sub068.8%
associate--r-68.8%
metadata-eval68.8%
Simplified68.8%
if 6.5000000000000001e28 < z < 1.10000000000000006e75Initial program 100.0%
Taylor expanded in y around inf 75.9%
associate-*r/83.7%
Simplified83.7%
Final simplification80.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.8e+24) (not (<= z 2.5e-9))) (* x (/ (+ y t) z)) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.8e+24) || !(z <= 2.5e-9)) {
tmp = x * ((y + t) / z);
} else {
tmp = 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 ((z <= (-1.8d+24)) .or. (.not. (z <= 2.5d-9))) then
tmp = x * ((y + t) / z)
else
tmp = 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 ((z <= -1.8e+24) || !(z <= 2.5e-9)) {
tmp = x * ((y + t) / z);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.8e+24) or not (z <= 2.5e-9): tmp = x * ((y + t) / z) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.8e+24) || !(z <= 2.5e-9)) tmp = Float64(x * Float64(Float64(y + t) / z)); else tmp = Float64(x * Float64(Float64(y / z) - t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.8e+24) || ~((z <= 2.5e-9))) tmp = x * ((y + t) / z); else tmp = x * ((y / z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.8e+24], N[Not[LessEqual[z, 2.5e-9]], $MachinePrecision]], N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+24} \lor \neg \left(z \leq 2.5 \cdot 10^{-9}\right):\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -1.79999999999999992e24 or 2.5000000000000001e-9 < z Initial program 96.0%
Taylor expanded in z around inf 79.9%
*-commutative79.9%
remove-double-neg79.9%
cancel-sign-sub-inv79.9%
metadata-eval79.9%
*-lft-identity79.9%
distribute-neg-out79.9%
neg-mul-179.9%
sub-neg79.9%
distribute-lft-neg-in79.9%
*-commutative79.9%
distribute-neg-frac79.9%
associate-/l*96.0%
distribute-rgt-neg-in96.0%
distribute-neg-frac96.0%
Simplified96.0%
if -1.79999999999999992e24 < z < 2.5000000000000001e-9Initial program 90.8%
Taylor expanded in z around 0 90.4%
Final simplification93.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -8.5e+90) (not (<= z 9e+75))) (* x (/ t z)) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8.5e+90) || !(z <= 9e+75)) {
tmp = x * (t / z);
} else {
tmp = 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 ((z <= (-8.5d+90)) .or. (.not. (z <= 9d+75))) then
tmp = x * (t / z)
else
tmp = 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 ((z <= -8.5e+90) || !(z <= 9e+75)) {
tmp = x * (t / z);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -8.5e+90) or not (z <= 9e+75): tmp = x * (t / z) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -8.5e+90) || !(z <= 9e+75)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(x * Float64(Float64(y / z) - t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -8.5e+90) || ~((z <= 9e+75))) tmp = x * (t / z); else tmp = x * ((y / z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -8.5e+90], N[Not[LessEqual[z, 9e+75]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{+90} \lor \neg \left(z \leq 9 \cdot 10^{+75}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -8.5000000000000002e90 or 9.0000000000000007e75 < z Initial program 94.7%
Taylor expanded in z around inf 75.6%
*-commutative75.6%
remove-double-neg75.6%
cancel-sign-sub-inv75.6%
metadata-eval75.6%
*-lft-identity75.6%
distribute-neg-out75.6%
neg-mul-175.6%
sub-neg75.6%
distribute-lft-neg-in75.6%
*-commutative75.6%
distribute-neg-frac75.6%
associate-/l*94.7%
distribute-rgt-neg-in94.7%
distribute-neg-frac94.7%
Simplified94.7%
Taylor expanded in t around inf 57.3%
*-commutative57.3%
associate-/l*67.4%
Simplified67.4%
if -8.5000000000000002e90 < z < 9.0000000000000007e75Initial program 92.8%
Taylor expanded in z around 0 84.8%
Final simplification78.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.4e+90) (not (<= z 7.6e+75))) (* x (/ t z)) (* y (/ x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.4e+90) || !(z <= 7.6e+75)) {
tmp = x * (t / z);
} else {
tmp = y * (x / 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 ((z <= (-4.4d+90)) .or. (.not. (z <= 7.6d+75))) then
tmp = x * (t / z)
else
tmp = y * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.4e+90) || !(z <= 7.6e+75)) {
tmp = x * (t / z);
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.4e+90) or not (z <= 7.6e+75): tmp = x * (t / z) else: tmp = y * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.4e+90) || !(z <= 7.6e+75)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.4e+90) || ~((z <= 7.6e+75))) tmp = x * (t / z); else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.4e+90], N[Not[LessEqual[z, 7.6e+75]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{+90} \lor \neg \left(z \leq 7.6 \cdot 10^{+75}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if z < -4.39999999999999981e90 or 7.6000000000000005e75 < z Initial program 94.7%
Taylor expanded in z around inf 75.6%
*-commutative75.6%
remove-double-neg75.6%
cancel-sign-sub-inv75.6%
metadata-eval75.6%
*-lft-identity75.6%
distribute-neg-out75.6%
neg-mul-175.6%
sub-neg75.6%
distribute-lft-neg-in75.6%
*-commutative75.6%
distribute-neg-frac75.6%
associate-/l*94.7%
distribute-rgt-neg-in94.7%
distribute-neg-frac94.7%
Simplified94.7%
Taylor expanded in t around inf 57.3%
*-commutative57.3%
associate-/l*67.4%
Simplified67.4%
if -4.39999999999999981e90 < z < 7.6000000000000005e75Initial program 92.8%
Taylor expanded in y around inf 63.6%
associate-*r/62.8%
Simplified62.8%
clear-num62.7%
un-div-inv63.9%
Applied egg-rr63.9%
associate-/r/71.1%
Applied egg-rr71.1%
Final simplification69.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.76e+77) (not (<= t 2.6e+100))) (* x (/ t z)) (* (/ y z) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.76e+77) || !(t <= 2.6e+100)) {
tmp = x * (t / z);
} else {
tmp = (y / z) * x;
}
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.76d+77)) .or. (.not. (t <= 2.6d+100))) then
tmp = x * (t / z)
else
tmp = (y / z) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.76e+77) || !(t <= 2.6e+100)) {
tmp = x * (t / z);
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.76e+77) or not (t <= 2.6e+100): tmp = x * (t / z) else: tmp = (y / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.76e+77) || !(t <= 2.6e+100)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(Float64(y / z) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.76e+77) || ~((t <= 2.6e+100))) tmp = x * (t / z); else tmp = (y / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.76e+77], N[Not[LessEqual[t, 2.6e+100]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.76 \cdot 10^{+77} \lor \neg \left(t \leq 2.6 \cdot 10^{+100}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if t < -1.76e77 or 2.6000000000000002e100 < t Initial program 96.7%
Taylor expanded in z around inf 54.0%
*-commutative54.0%
remove-double-neg54.0%
cancel-sign-sub-inv54.0%
metadata-eval54.0%
*-lft-identity54.0%
distribute-neg-out54.0%
neg-mul-154.0%
sub-neg54.0%
distribute-lft-neg-in54.0%
*-commutative54.0%
distribute-neg-frac54.0%
associate-/l*70.8%
distribute-rgt-neg-in70.8%
distribute-neg-frac70.8%
Simplified70.8%
Taylor expanded in t around inf 45.8%
*-commutative45.8%
associate-/l*56.6%
Simplified56.6%
if -1.76e77 < t < 2.6000000000000002e100Initial program 91.6%
Taylor expanded in y around inf 69.4%
associate-*r/73.4%
Simplified73.4%
Final simplification67.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.3e-12) (not (<= z 1.0))) (* x (/ t z)) (* t (- x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.3e-12) || !(z <= 1.0)) {
tmp = x * (t / z);
} else {
tmp = t * -x;
}
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 <= (-3.3d-12)) .or. (.not. (z <= 1.0d0))) then
tmp = x * (t / z)
else
tmp = t * -x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.3e-12) || !(z <= 1.0)) {
tmp = x * (t / z);
} else {
tmp = t * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.3e-12) or not (z <= 1.0): tmp = x * (t / z) else: tmp = t * -x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.3e-12) || !(z <= 1.0)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(t * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.3e-12) || ~((z <= 1.0))) tmp = x * (t / z); else tmp = t * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.3e-12], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(t * (-x)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{-12} \lor \neg \left(z \leq 1\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(-x\right)\\
\end{array}
\end{array}
if z < -3.3000000000000001e-12 or 1 < z Initial program 96.2%
Taylor expanded in z around inf 80.5%
*-commutative80.5%
remove-double-neg80.5%
cancel-sign-sub-inv80.5%
metadata-eval80.5%
*-lft-identity80.5%
distribute-neg-out80.5%
neg-mul-180.5%
sub-neg80.5%
distribute-lft-neg-in80.5%
*-commutative80.5%
distribute-neg-frac80.5%
associate-/l*96.0%
distribute-rgt-neg-in96.0%
distribute-neg-frac96.0%
Simplified96.0%
Taylor expanded in t around inf 50.7%
*-commutative50.7%
associate-/l*58.5%
Simplified58.5%
if -3.3000000000000001e-12 < z < 1Initial program 90.4%
Taylor expanded in z around 0 90.0%
Taylor expanded in y around 0 32.2%
associate-*r*32.2%
mul-1-neg32.2%
Simplified32.2%
Final simplification46.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.3e-12) (not (<= z 1.0))) (* t (/ x z)) (* t (- x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.3e-12) || !(z <= 1.0)) {
tmp = t * (x / z);
} else {
tmp = t * -x;
}
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 <= (-3.3d-12)) .or. (.not. (z <= 1.0d0))) then
tmp = t * (x / z)
else
tmp = t * -x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.3e-12) || !(z <= 1.0)) {
tmp = t * (x / z);
} else {
tmp = t * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.3e-12) or not (z <= 1.0): tmp = t * (x / z) else: tmp = t * -x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.3e-12) || !(z <= 1.0)) tmp = Float64(t * Float64(x / z)); else tmp = Float64(t * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.3e-12) || ~((z <= 1.0))) tmp = t * (x / z); else tmp = t * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.3e-12], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(t * (-x)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{-12} \lor \neg \left(z \leq 1\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(-x\right)\\
\end{array}
\end{array}
if z < -3.3000000000000001e-12 or 1 < z Initial program 96.2%
Taylor expanded in z around inf 80.5%
*-commutative80.5%
remove-double-neg80.5%
cancel-sign-sub-inv80.5%
metadata-eval80.5%
*-lft-identity80.5%
distribute-neg-out80.5%
neg-mul-180.5%
sub-neg80.5%
distribute-lft-neg-in80.5%
*-commutative80.5%
distribute-neg-frac80.5%
associate-/l*96.0%
distribute-rgt-neg-in96.0%
distribute-neg-frac96.0%
Simplified96.0%
Taylor expanded in t around inf 50.7%
associate-/l*52.6%
Simplified52.6%
if -3.3000000000000001e-12 < z < 1Initial program 90.4%
Taylor expanded in z around 0 90.0%
Taylor expanded in y around 0 32.2%
associate-*r*32.2%
mul-1-neg32.2%
Simplified32.2%
Final simplification43.2%
(FPCore (x y z t) :precision binary64 (* t (- x)))
double code(double x, double y, double z, double t) {
return t * -x;
}
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 = t * -x
end function
public static double code(double x, double y, double z, double t) {
return t * -x;
}
def code(x, y, z, t): return t * -x
function code(x, y, z, t) return Float64(t * Float64(-x)) end
function tmp = code(x, y, z, t) tmp = t * -x; end
code[x_, y_, z_, t_] := N[(t * (-x)), $MachinePrecision]
\begin{array}{l}
\\
t \cdot \left(-x\right)
\end{array}
Initial program 93.5%
Taylor expanded in z around 0 62.6%
Taylor expanded in y around 0 22.0%
associate-*r*22.0%
mul-1-neg22.0%
Simplified22.0%
Final simplification22.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z))))))
(t_2 (* x (- (/ y z) (/ t (- 1.0 z))))))
(if (< t_2 -7.623226303312042e-196)
t_1
(if (< t_2 1.4133944927702302e-211)
(+ (/ (* y x) z) (- (/ (* t x) (- 1.0 z))))
t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
double t_2 = x * ((y / z) - (t / (1.0 - z)));
double tmp;
if (t_2 < -7.623226303312042e-196) {
tmp = t_1;
} else if (t_2 < 1.4133944927702302e-211) {
tmp = ((y * x) / z) + -((t * x) / (1.0 - 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) :: t_2
real(8) :: tmp
t_1 = x * ((y / z) - (t * (1.0d0 / (1.0d0 - z))))
t_2 = x * ((y / z) - (t / (1.0d0 - z)))
if (t_2 < (-7.623226303312042d-196)) then
tmp = t_1
else if (t_2 < 1.4133944927702302d-211) then
tmp = ((y * x) / z) + -((t * x) / (1.0d0 - 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 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
double t_2 = x * ((y / z) - (t / (1.0 - z)));
double tmp;
if (t_2 < -7.623226303312042e-196) {
tmp = t_1;
} else if (t_2 < 1.4133944927702302e-211) {
tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z)))) t_2 = x * ((y / z) - (t / (1.0 - z))) tmp = 0 if t_2 < -7.623226303312042e-196: tmp = t_1 elif t_2 < 1.4133944927702302e-211: tmp = ((y * x) / z) + -((t * x) / (1.0 - z)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(y / z) - Float64(t * Float64(1.0 / Float64(1.0 - z))))) t_2 = Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) tmp = 0.0 if (t_2 < -7.623226303312042e-196) tmp = t_1; elseif (t_2 < 1.4133944927702302e-211) tmp = Float64(Float64(Float64(y * x) / z) + Float64(-Float64(Float64(t * x) / Float64(1.0 - z)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z)))); t_2 = x * ((y / z) - (t / (1.0 - z))); tmp = 0.0; if (t_2 < -7.623226303312042e-196) tmp = t_1; elseif (t_2 < 1.4133944927702302e-211) tmp = ((y * x) / z) + -((t * x) / (1.0 - z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t * N[(1.0 / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -7.623226303312042e-196], t$95$1, If[Less[t$95$2, 1.4133944927702302e-211], N[(N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision] + (-N[(N[(t * x), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1 - z}\right)\\
t_2 := x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\
\mathbf{if}\;t\_2 < -7.623226303312042 \cdot 10^{-196}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 < 1.4133944927702302 \cdot 10^{-211}:\\
\;\;\;\;\frac{y \cdot x}{z} + \left(-\frac{t \cdot x}{1 - z}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024100
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
:precision binary64
:alt
(if (< (* x (- (/ y z) (/ t (- 1.0 z)))) -7.623226303312042e-196) (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z))))) (if (< (* x (- (/ y z) (/ t (- 1.0 z)))) 1.4133944927702302e-211) (+ (/ (* y x) z) (- (/ (* t x) (- 1.0 z)))) (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z)))))))
(* x (- (/ y z) (/ t (- 1.0 z)))))