
(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 12 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 (if (<= z -1.6e-10) (* x (/ (+ y t) z)) (if (<= z 13.0) (* x (- (/ y z) (+ t (* z t)))) (* (+ y t) (/ x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.6e-10) {
tmp = x * ((y + t) / z);
} else if (z <= 13.0) {
tmp = x * ((y / z) - (t + (z * t)));
} else {
tmp = (y + t) * (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 <= (-1.6d-10)) then
tmp = x * ((y + t) / z)
else if (z <= 13.0d0) then
tmp = x * ((y / z) - (t + (z * t)))
else
tmp = (y + t) * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.6e-10) {
tmp = x * ((y + t) / z);
} else if (z <= 13.0) {
tmp = x * ((y / z) - (t + (z * t)));
} else {
tmp = (y + t) * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.6e-10: tmp = x * ((y + t) / z) elif z <= 13.0: tmp = x * ((y / z) - (t + (z * t))) else: tmp = (y + t) * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.6e-10) tmp = Float64(x * Float64(Float64(y + t) / z)); elseif (z <= 13.0) tmp = Float64(x * Float64(Float64(y / z) - Float64(t + Float64(z * t)))); else tmp = Float64(Float64(y + t) * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.6e-10) tmp = x * ((y + t) / z); elseif (z <= 13.0) tmp = x * ((y / z) - (t + (z * t))); else tmp = (y + t) * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.6e-10], N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 13.0], N[(x * N[(N[(y / z), $MachinePrecision] - N[(t + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y + t), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{-10}:\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\mathbf{elif}\;z \leq 13:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - \left(t + z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y + t\right) \cdot \frac{x}{z}\\
\end{array}
\end{array}
if z < -1.5999999999999999e-10Initial program 99.6%
Taylor expanded in z around inf 89.5%
*-commutative89.5%
remove-double-neg89.5%
cancel-sign-sub-inv89.5%
metadata-eval89.5%
*-lft-identity89.5%
distribute-neg-out89.5%
neg-mul-189.5%
sub-neg89.5%
distribute-lft-neg-in89.5%
*-commutative89.5%
distribute-neg-frac89.5%
associate-/l*99.5%
distribute-rgt-neg-in99.5%
distribute-neg-frac99.5%
Simplified99.5%
if -1.5999999999999999e-10 < z < 13Initial program 93.8%
Taylor expanded in z around 0 93.2%
if 13 < z Initial program 94.6%
Taylor expanded in z around inf 81.0%
*-commutative81.0%
associate-/l*96.9%
cancel-sign-sub-inv96.9%
metadata-eval96.9%
*-lft-identity96.9%
+-commutative96.9%
Simplified96.9%
Final simplification96.2%
(FPCore (x y z t)
:precision binary64
(if (<= y -4400000.0)
(* x (/ y z))
(if (<= y 9.8e-182)
(* t (/ x (+ z -1.0)))
(if (<= y 2.7e+118) (* x (- (/ y z) t)) (/ (* x y) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4400000.0) {
tmp = x * (y / z);
} else if (y <= 9.8e-182) {
tmp = t * (x / (z + -1.0));
} else if (y <= 2.7e+118) {
tmp = x * ((y / z) - t);
} else {
tmp = (x * 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 (y <= (-4400000.0d0)) then
tmp = x * (y / z)
else if (y <= 9.8d-182) then
tmp = t * (x / (z + (-1.0d0)))
else if (y <= 2.7d+118) then
tmp = x * ((y / z) - t)
else
tmp = (x * y) / z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4400000.0) {
tmp = x * (y / z);
} else if (y <= 9.8e-182) {
tmp = t * (x / (z + -1.0));
} else if (y <= 2.7e+118) {
tmp = x * ((y / z) - t);
} else {
tmp = (x * y) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -4400000.0: tmp = x * (y / z) elif y <= 9.8e-182: tmp = t * (x / (z + -1.0)) elif y <= 2.7e+118: tmp = x * ((y / z) - t) else: tmp = (x * y) / z return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -4400000.0) tmp = Float64(x * Float64(y / z)); elseif (y <= 9.8e-182) tmp = Float64(t * Float64(x / Float64(z + -1.0))); elseif (y <= 2.7e+118) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(Float64(x * y) / z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -4400000.0) tmp = x * (y / z); elseif (y <= 9.8e-182) tmp = t * (x / (z + -1.0)); elseif (y <= 2.7e+118) tmp = x * ((y / z) - t); else tmp = (x * y) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -4400000.0], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.8e-182], N[(t * N[(x / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.7e+118], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4400000:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;y \leq 9.8 \cdot 10^{-182}:\\
\;\;\;\;t \cdot \frac{x}{z + -1}\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{+118}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\end{array}
\end{array}
if y < -4.4e6Initial program 94.6%
Taylor expanded in y around inf 82.0%
associate-*r/85.7%
Simplified85.7%
if -4.4e6 < y < 9.8000000000000006e-182Initial program 96.9%
Taylor expanded in y around 0 74.9%
mul-1-neg74.9%
associate-/l*78.7%
distribute-rgt-neg-in78.7%
distribute-neg-frac278.7%
neg-sub078.7%
associate--r-78.7%
metadata-eval78.7%
Simplified78.7%
if 9.8000000000000006e-182 < y < 2.7e118Initial program 98.4%
Taylor expanded in z around 0 72.2%
mul-1-neg72.2%
unsub-neg72.2%
div-sub72.2%
associate-/l*72.3%
*-inverses72.3%
*-rgt-identity72.3%
Simplified72.3%
if 2.7e118 < y Initial program 91.4%
Taylor expanded in y around inf 95.4%
associate-*r/91.2%
Simplified91.2%
associate-*r/95.4%
clear-num95.3%
Applied egg-rr95.3%
associate-/r/95.3%
Simplified95.3%
associate-*l/95.4%
*-un-lft-identity95.4%
*-commutative95.4%
Applied egg-rr95.4%
Final simplification81.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.6e-10) (not (<= z 13.0))) (* x (/ (+ y t) z)) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.6e-10) || !(z <= 13.0)) {
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.6d-10)) .or. (.not. (z <= 13.0d0))) 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.6e-10) || !(z <= 13.0)) {
tmp = x * ((y + t) / z);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.6e-10) or not (z <= 13.0): 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.6e-10) || !(z <= 13.0)) 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.6e-10) || ~((z <= 13.0))) 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.6e-10], N[Not[LessEqual[z, 13.0]], $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.6 \cdot 10^{-10} \lor \neg \left(z \leq 13\right):\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -1.5999999999999999e-10Initial program 99.6%
Taylor expanded in z around inf 89.5%
*-commutative89.5%
remove-double-neg89.5%
cancel-sign-sub-inv89.5%
metadata-eval89.5%
*-lft-identity89.5%
distribute-neg-out89.5%
neg-mul-189.5%
sub-neg89.5%
distribute-lft-neg-in89.5%
*-commutative89.5%
distribute-neg-frac89.5%
associate-/l*99.5%
distribute-rgt-neg-in99.5%
distribute-neg-frac99.5%
Simplified99.5%
if -1.5999999999999999e-10 < z < 13Initial program 93.8%
Taylor expanded in z around 0 92.5%
mul-1-neg92.5%
unsub-neg92.5%
div-sub92.5%
associate-/l*92.6%
*-inverses92.6%
*-rgt-identity92.6%
Simplified92.6%
if 13 < z Initial program 94.6%
clear-num93.6%
associate-/r/94.6%
Applied egg-rr94.6%
Taylor expanded in z around inf 81.0%
associate-/l*94.6%
cancel-sign-sub-inv94.6%
metadata-eval94.6%
*-lft-identity94.6%
Simplified94.6%
Final simplification95.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.75e+40) (not (<= t 4500000.0))) (* x (/ t (+ z -1.0))) (* x (/ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.75e+40) || !(t <= 4500000.0)) {
tmp = x * (t / (z + -1.0));
} else {
tmp = x * (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.75d+40)) .or. (.not. (t <= 4500000.0d0))) then
tmp = x * (t / (z + (-1.0d0)))
else
tmp = x * (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.75e+40) || !(t <= 4500000.0)) {
tmp = x * (t / (z + -1.0));
} else {
tmp = x * (y / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.75e+40) or not (t <= 4500000.0): tmp = x * (t / (z + -1.0)) else: tmp = x * (y / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.75e+40) || !(t <= 4500000.0)) tmp = Float64(x * Float64(t / Float64(z + -1.0))); else tmp = Float64(x * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.75e+40) || ~((t <= 4500000.0))) tmp = x * (t / (z + -1.0)); else tmp = x * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.75e+40], N[Not[LessEqual[t, 4500000.0]], $MachinePrecision]], N[(x * N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.75 \cdot 10^{+40} \lor \neg \left(t \leq 4500000\right):\\
\;\;\;\;x \cdot \frac{t}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\end{array}
\end{array}
if t < -1.75e40 or 4.5e6 < t Initial program 95.8%
Taylor expanded in y around 0 73.3%
mul-1-neg73.3%
distribute-neg-frac273.3%
neg-sub073.3%
associate--r-73.3%
metadata-eval73.3%
Simplified73.3%
if -1.75e40 < t < 4.5e6Initial program 95.9%
Taylor expanded in y around inf 82.3%
associate-*r/85.2%
Simplified85.2%
Final simplification79.7%
(FPCore (x y z t) :precision binary64 (if (<= z -1.6e-10) (* x (/ (+ y t) z)) (if (<= z 13.0) (* x (- (/ y z) t)) (* (+ y t) (/ x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.6e-10) {
tmp = x * ((y + t) / z);
} else if (z <= 13.0) {
tmp = x * ((y / z) - t);
} else {
tmp = (y + t) * (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 <= (-1.6d-10)) then
tmp = x * ((y + t) / z)
else if (z <= 13.0d0) then
tmp = x * ((y / z) - t)
else
tmp = (y + t) * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.6e-10) {
tmp = x * ((y + t) / z);
} else if (z <= 13.0) {
tmp = x * ((y / z) - t);
} else {
tmp = (y + t) * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.6e-10: tmp = x * ((y + t) / z) elif z <= 13.0: tmp = x * ((y / z) - t) else: tmp = (y + t) * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.6e-10) tmp = Float64(x * Float64(Float64(y + t) / z)); elseif (z <= 13.0) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(Float64(y + t) * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.6e-10) tmp = x * ((y + t) / z); elseif (z <= 13.0) tmp = x * ((y / z) - t); else tmp = (y + t) * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.6e-10], N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 13.0], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[(y + t), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{-10}:\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\mathbf{elif}\;z \leq 13:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y + t\right) \cdot \frac{x}{z}\\
\end{array}
\end{array}
if z < -1.5999999999999999e-10Initial program 99.6%
Taylor expanded in z around inf 89.5%
*-commutative89.5%
remove-double-neg89.5%
cancel-sign-sub-inv89.5%
metadata-eval89.5%
*-lft-identity89.5%
distribute-neg-out89.5%
neg-mul-189.5%
sub-neg89.5%
distribute-lft-neg-in89.5%
*-commutative89.5%
distribute-neg-frac89.5%
associate-/l*99.5%
distribute-rgt-neg-in99.5%
distribute-neg-frac99.5%
Simplified99.5%
if -1.5999999999999999e-10 < z < 13Initial program 93.8%
Taylor expanded in z around 0 92.5%
mul-1-neg92.5%
unsub-neg92.5%
div-sub92.5%
associate-/l*92.6%
*-inverses92.6%
*-rgt-identity92.6%
Simplified92.6%
if 13 < z Initial program 94.6%
Taylor expanded in z around inf 81.0%
*-commutative81.0%
associate-/l*96.9%
cancel-sign-sub-inv96.9%
metadata-eval96.9%
*-lft-identity96.9%
+-commutative96.9%
Simplified96.9%
Final simplification95.9%
(FPCore (x y z t) :precision binary64 (if (<= y -28000000000000.0) (* x (/ y z)) (if (<= y 8.2e-141) (* t (/ x (+ z -1.0))) (* y (/ x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -28000000000000.0) {
tmp = x * (y / z);
} else if (y <= 8.2e-141) {
tmp = t * (x / (z + -1.0));
} 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 (y <= (-28000000000000.0d0)) then
tmp = x * (y / z)
else if (y <= 8.2d-141) then
tmp = t * (x / (z + (-1.0d0)))
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 (y <= -28000000000000.0) {
tmp = x * (y / z);
} else if (y <= 8.2e-141) {
tmp = t * (x / (z + -1.0));
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -28000000000000.0: tmp = x * (y / z) elif y <= 8.2e-141: tmp = t * (x / (z + -1.0)) else: tmp = y * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -28000000000000.0) tmp = Float64(x * Float64(y / z)); elseif (y <= 8.2e-141) tmp = Float64(t * Float64(x / Float64(z + -1.0))); else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -28000000000000.0) tmp = x * (y / z); elseif (y <= 8.2e-141) tmp = t * (x / (z + -1.0)); else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -28000000000000.0], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.2e-141], N[(t * N[(x / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -28000000000000:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{-141}:\\
\;\;\;\;t \cdot \frac{x}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if y < -2.8e13Initial program 94.6%
Taylor expanded in y around inf 82.0%
associate-*r/85.7%
Simplified85.7%
if -2.8e13 < y < 8.20000000000000005e-141Initial program 97.2%
Taylor expanded in y around 0 73.8%
mul-1-neg73.8%
associate-/l*76.2%
distribute-rgt-neg-in76.2%
distribute-neg-frac276.2%
neg-sub076.2%
associate--r-76.2%
metadata-eval76.2%
Simplified76.2%
if 8.20000000000000005e-141 < y Initial program 95.3%
Taylor expanded in y around inf 76.2%
associate-*r/75.7%
Simplified75.7%
clear-num75.7%
un-div-inv75.7%
Applied egg-rr75.7%
associate-/r/76.6%
Simplified76.6%
Final simplification78.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.8e+46) (not (<= t 1.8e+139))) (* x (/ t z)) (* x (/ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.8e+46) || !(t <= 1.8e+139)) {
tmp = x * (t / z);
} else {
tmp = x * (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 <= (-3.8d+46)) .or. (.not. (t <= 1.8d+139))) then
tmp = x * (t / z)
else
tmp = x * (y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.8e+46) || !(t <= 1.8e+139)) {
tmp = x * (t / z);
} else {
tmp = x * (y / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3.8e+46) or not (t <= 1.8e+139): tmp = x * (t / z) else: tmp = x * (y / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3.8e+46) || !(t <= 1.8e+139)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(x * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -3.8e+46) || ~((t <= 1.8e+139))) tmp = x * (t / z); else tmp = x * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3.8e+46], N[Not[LessEqual[t, 1.8e+139]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.8 \cdot 10^{+46} \lor \neg \left(t \leq 1.8 \cdot 10^{+139}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\end{array}
\end{array}
if t < -3.7999999999999999e46 or 1.79999999999999993e139 < t Initial program 94.6%
Taylor expanded in y around 0 75.4%
mul-1-neg75.4%
distribute-neg-frac275.4%
neg-sub075.4%
associate--r-75.4%
metadata-eval75.4%
Simplified75.4%
Taylor expanded in z around inf 55.5%
if -3.7999999999999999e46 < t < 1.79999999999999993e139Initial program 96.6%
Taylor expanded in y around inf 77.1%
associate-*r/80.7%
Simplified80.7%
Final simplification71.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.6e-10) (not (<= z 13.0))) (* t (/ x z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.6e-10) || !(z <= 13.0)) {
tmp = t * (x / z);
} else {
tmp = x * -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.6d-10)) .or. (.not. (z <= 13.0d0))) then
tmp = t * (x / z)
else
tmp = x * -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.6e-10) || !(z <= 13.0)) {
tmp = t * (x / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.6e-10) or not (z <= 13.0): tmp = t * (x / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.6e-10) || !(z <= 13.0)) tmp = Float64(t * Float64(x / z)); else tmp = Float64(x * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.6e-10) || ~((z <= 13.0))) tmp = t * (x / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.6e-10], N[Not[LessEqual[z, 13.0]], $MachinePrecision]], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{-10} \lor \neg \left(z \leq 13\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -1.5999999999999999e-10 or 13 < z Initial program 97.4%
Taylor expanded in y around 0 57.1%
mul-1-neg57.1%
distribute-neg-frac257.1%
neg-sub057.1%
associate--r-57.1%
metadata-eval57.1%
Simplified57.1%
Taylor expanded in z around inf 49.9%
associate-/l*52.6%
Simplified52.6%
if -1.5999999999999999e-10 < z < 13Initial program 93.8%
Taylor expanded in y around 0 37.9%
mul-1-neg37.9%
distribute-neg-frac237.9%
neg-sub037.9%
associate--r-37.9%
metadata-eval37.9%
Simplified37.9%
Taylor expanded in z around 0 36.7%
*-commutative36.7%
neg-mul-136.7%
distribute-rgt-neg-in36.7%
Simplified36.7%
Final simplification45.9%
(FPCore (x y z t) :precision binary64 (if (<= z -1.6e-10) (* x (/ t z)) (if (<= z 13.0) (* x (- t)) (* t (/ x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.6e-10) {
tmp = x * (t / z);
} else if (z <= 13.0) {
tmp = x * -t;
} else {
tmp = t * (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 <= (-1.6d-10)) then
tmp = x * (t / z)
else if (z <= 13.0d0) then
tmp = x * -t
else
tmp = t * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.6e-10) {
tmp = x * (t / z);
} else if (z <= 13.0) {
tmp = x * -t;
} else {
tmp = t * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.6e-10: tmp = x * (t / z) elif z <= 13.0: tmp = x * -t else: tmp = t * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.6e-10) tmp = Float64(x * Float64(t / z)); elseif (z <= 13.0) tmp = Float64(x * Float64(-t)); else tmp = Float64(t * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.6e-10) tmp = x * (t / z); elseif (z <= 13.0) tmp = x * -t; else tmp = t * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.6e-10], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 13.0], N[(x * (-t)), $MachinePrecision], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{-10}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{elif}\;z \leq 13:\\
\;\;\;\;x \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\end{array}
\end{array}
if z < -1.5999999999999999e-10Initial program 99.6%
Taylor expanded in y around 0 66.4%
mul-1-neg66.4%
distribute-neg-frac266.4%
neg-sub066.4%
associate--r-66.4%
metadata-eval66.4%
Simplified66.4%
Taylor expanded in z around inf 66.2%
if -1.5999999999999999e-10 < z < 13Initial program 93.8%
Taylor expanded in y around 0 37.9%
mul-1-neg37.9%
distribute-neg-frac237.9%
neg-sub037.9%
associate--r-37.9%
metadata-eval37.9%
Simplified37.9%
Taylor expanded in z around 0 36.7%
*-commutative36.7%
neg-mul-136.7%
distribute-rgt-neg-in36.7%
Simplified36.7%
if 13 < z Initial program 94.6%
Taylor expanded in y around 0 45.2%
mul-1-neg45.2%
distribute-neg-frac245.2%
neg-sub045.2%
associate--r-45.2%
metadata-eval45.2%
Simplified45.2%
Taylor expanded in z around inf 36.0%
associate-/l*48.9%
Simplified48.9%
(FPCore (x y z t) :precision binary64 (* x (+ (/ y z) (* t (/ 1.0 (+ z -1.0))))))
double code(double x, double y, double z, double t) {
return x * ((y / z) + (t * (1.0 / (z + -1.0))));
}
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 + (-1.0d0)))))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) + (t * (1.0 / (z + -1.0))));
}
def code(x, y, z, t): return x * ((y / z) + (t * (1.0 / (z + -1.0))))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) + Float64(t * Float64(1.0 / Float64(z + -1.0))))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) + (t * (1.0 / (z + -1.0)))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] + N[(t * N[(1.0 / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\frac{y}{z} + t \cdot \frac{1}{z + -1}\right)
\end{array}
Initial program 95.9%
clear-num95.6%
associate-/r/95.9%
Applied egg-rr95.9%
Final simplification95.9%
(FPCore (x y z t) :precision binary64 (* x (+ (/ y z) (/ t (+ z -1.0)))))
double code(double x, double y, double z, double t) {
return x * ((y / z) + (t / (z + -1.0)));
}
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 / (z + (-1.0d0))))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) + (t / (z + -1.0)));
}
def code(x, y, z, t): return x * ((y / z) + (t / (z + -1.0)))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) + Float64(t / Float64(z + -1.0)))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) + (t / (z + -1.0))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] + N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\frac{y}{z} + \frac{t}{z + -1}\right)
\end{array}
Initial program 95.9%
Final simplification95.9%
(FPCore (x y z t) :precision binary64 (* x (- t)))
double code(double x, double y, double z, double t) {
return x * -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 = x * -t
end function
public static double code(double x, double y, double z, double t) {
return x * -t;
}
def code(x, y, z, t): return x * -t
function code(x, y, z, t) return Float64(x * Float64(-t)) end
function tmp = code(x, y, z, t) tmp = x * -t; end
code[x_, y_, z_, t_] := N[(x * (-t)), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(-t\right)
\end{array}
Initial program 95.9%
Taylor expanded in y around 0 49.0%
mul-1-neg49.0%
distribute-neg-frac249.0%
neg-sub049.0%
associate--r-49.0%
metadata-eval49.0%
Simplified49.0%
Taylor expanded in z around 0 24.3%
*-commutative24.3%
neg-mul-124.3%
distribute-rgt-neg-in24.3%
Simplified24.3%
(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 2024103
(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)))))