
(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 -2e-172)
t_2
(if (<= t_1 1e-323)
(/ (* x (+ y t)) z)
(if (<= t_1 1e+299) t_2 (/ 1.0 (/ z (* y x))))))))
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 <= -2e-172) {
tmp = t_2;
} else if (t_1 <= 1e-323) {
tmp = (x * (y + t)) / z;
} else if (t_1 <= 1e+299) {
tmp = t_2;
} else {
tmp = 1.0 / (z / (y * 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (y / z) + (t / (z + (-1.0d0)))
t_2 = t_1 * x
if (t_1 <= (-2d-172)) then
tmp = t_2
else if (t_1 <= 1d-323) then
tmp = (x * (y + t)) / z
else if (t_1 <= 1d+299) then
tmp = t_2
else
tmp = 1.0d0 / (z / (y * x))
end if
code = tmp
end function
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 <= -2e-172) {
tmp = t_2;
} else if (t_1 <= 1e-323) {
tmp = (x * (y + t)) / z;
} else if (t_1 <= 1e+299) {
tmp = t_2;
} else {
tmp = 1.0 / (z / (y * x));
}
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 <= -2e-172: tmp = t_2 elif t_1 <= 1e-323: tmp = (x * (y + t)) / z elif t_1 <= 1e+299: tmp = t_2 else: tmp = 1.0 / (z / (y * x)) 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 <= -2e-172) tmp = t_2; elseif (t_1 <= 1e-323) tmp = Float64(Float64(x * Float64(y + t)) / z); elseif (t_1 <= 1e+299) tmp = t_2; else tmp = Float64(1.0 / Float64(z / Float64(y * x))); 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 <= -2e-172) tmp = t_2; elseif (t_1 <= 1e-323) tmp = (x * (y + t)) / z; elseif (t_1 <= 1e+299) tmp = t_2; else tmp = 1.0 / (z / (y * x)); 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, -2e-172], 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+299], t$95$2, N[(1.0 / N[(z / N[(y * x), $MachinePrecision]), $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 -2 \cdot 10^{-172}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10^{-323}:\\
\;\;\;\;\frac{x \cdot \left(y + t\right)}{z}\\
\mathbf{elif}\;t\_1 \leq 10^{+299}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{z}{y \cdot x}}\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -2.0000000000000001e-172 or 9.88131e-324 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 1.0000000000000001e299Initial program 98.5%
if -2.0000000000000001e-172 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 9.88131e-324Initial program 61.5%
Taylor expanded in z around inf 99.9%
*-commutative99.9%
sub-neg99.9%
remove-double-neg99.9%
neg-mul-199.9%
distribute-neg-in99.9%
neg-mul-199.9%
sub-neg99.9%
distribute-lft-neg-in99.9%
*-commutative99.9%
distribute-neg-frac99.9%
associate-/l*61.5%
distribute-rgt-neg-in61.5%
distribute-neg-frac61.5%
Simplified61.5%
Taylor expanded in t around 0 61.5%
+-commutative61.5%
Simplified61.5%
div-inv61.5%
div-inv61.5%
distribute-rgt-out61.5%
associate-/r/55.6%
div-inv55.6%
associate-/r/95.9%
associate-*l/99.9%
Applied egg-rr99.9%
if 1.0000000000000001e299 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 62.4%
Taylor expanded in y around inf 99.8%
associate-*r/62.4%
Simplified62.4%
associate-*r/99.8%
clear-num99.9%
Applied egg-rr99.9%
Final simplification98.7%
(FPCore (x y z t)
:precision binary64
(if (<= z -2.85e+79)
(* (/ y z) x)
(if (<= z 1.08e+41)
(* x (- (/ y z) t))
(if (<= z 6.6e+104) (* x (/ t z)) (/ (* y x) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.85e+79) {
tmp = (y / z) * x;
} else if (z <= 1.08e+41) {
tmp = x * ((y / z) - t);
} else if (z <= 6.6e+104) {
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 <= (-2.85d+79)) then
tmp = (y / z) * x
else if (z <= 1.08d+41) then
tmp = x * ((y / z) - t)
else if (z <= 6.6d+104) 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 <= -2.85e+79) {
tmp = (y / z) * x;
} else if (z <= 1.08e+41) {
tmp = x * ((y / z) - t);
} else if (z <= 6.6e+104) {
tmp = x * (t / z);
} else {
tmp = (y * x) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.85e+79: tmp = (y / z) * x elif z <= 1.08e+41: tmp = x * ((y / z) - t) elif z <= 6.6e+104: tmp = x * (t / z) else: tmp = (y * x) / z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.85e+79) tmp = Float64(Float64(y / z) * x); elseif (z <= 1.08e+41) tmp = Float64(x * Float64(Float64(y / z) - t)); elseif (z <= 6.6e+104) tmp = Float64(x * Float64(t / z)); else tmp = Float64(Float64(y * x) / z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.85e+79) tmp = (y / z) * x; elseif (z <= 1.08e+41) tmp = x * ((y / z) - t); elseif (z <= 6.6e+104) tmp = x * (t / z); else tmp = (y * x) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.85e+79], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 1.08e+41], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.6e+104], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.85 \cdot 10^{+79}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{elif}\;z \leq 1.08 \cdot 10^{+41}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{+104}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\end{array}
\end{array}
if z < -2.8499999999999998e79Initial program 86.5%
Taylor expanded in y around inf 55.0%
associate-*r/62.4%
Simplified62.4%
if -2.8499999999999998e79 < z < 1.08000000000000004e41Initial program 94.1%
Taylor expanded in z around 0 85.0%
mul-1-neg85.0%
unsub-neg85.0%
div-sub85.0%
associate-/l*85.0%
*-inverses85.0%
*-rgt-identity85.0%
Simplified85.0%
if 1.08000000000000004e41 < z < 6.59999999999999969e104Initial program 99.8%
Taylor expanded in z around inf 94.2%
*-commutative94.2%
sub-neg94.2%
remove-double-neg94.2%
neg-mul-194.2%
distribute-neg-in94.2%
neg-mul-194.2%
sub-neg94.2%
distribute-lft-neg-in94.2%
*-commutative94.2%
distribute-neg-frac94.2%
associate-/l*99.8%
distribute-rgt-neg-in99.8%
distribute-neg-frac99.8%
Simplified99.8%
Taylor expanded in t around inf 71.8%
if 6.59999999999999969e104 < z Initial program 93.0%
Taylor expanded in y around inf 66.2%
Final simplification76.8%
(FPCore (x y z t) :precision binary64 (if (<= z -1.0) (* x (/ (+ y t) z)) (if (<= z 1.0) (* x (- (/ y z) t)) (* x (+ (/ y z) (/ t z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.0) {
tmp = x * ((y + t) / z);
} else if (z <= 1.0) {
tmp = x * ((y / z) - t);
} else {
tmp = x * ((y / z) + (t / z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.0d0)) then
tmp = x * ((y + t) / z)
else if (z <= 1.0d0) then
tmp = x * ((y / z) - t)
else
tmp = x * ((y / z) + (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.0) {
tmp = x * ((y + t) / z);
} else if (z <= 1.0) {
tmp = x * ((y / z) - t);
} else {
tmp = x * ((y / z) + (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.0: tmp = x * ((y + t) / z) elif z <= 1.0: tmp = x * ((y / z) - t) else: tmp = x * ((y / z) + (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.0) tmp = Float64(x * Float64(Float64(y + t) / z)); elseif (z <= 1.0) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(x * Float64(Float64(y / z) + Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.0) tmp = x * ((y + t) / z); elseif (z <= 1.0) tmp = x * ((y / z) - t); else tmp = x * ((y / z) + (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.0], N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / z), $MachinePrecision] + N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} + \frac{t}{z}\right)\\
\end{array}
\end{array}
if z < -1Initial program 90.9%
Taylor expanded in z around inf 85.6%
*-commutative85.6%
sub-neg85.6%
remove-double-neg85.6%
neg-mul-185.6%
distribute-neg-in85.6%
neg-mul-185.6%
sub-neg85.6%
distribute-lft-neg-in85.6%
*-commutative85.6%
distribute-neg-frac85.6%
associate-/l*90.4%
distribute-rgt-neg-in90.4%
distribute-neg-frac90.4%
Simplified90.4%
if -1 < z < 1Initial program 92.8%
Taylor expanded in z around 0 91.7%
mul-1-neg91.7%
unsub-neg91.7%
div-sub91.7%
associate-/l*91.8%
*-inverses91.8%
*-rgt-identity91.8%
Simplified91.8%
if 1 < z Initial program 95.2%
Taylor expanded in z around inf 88.4%
*-commutative88.4%
sub-neg88.4%
remove-double-neg88.4%
neg-mul-188.4%
distribute-neg-in88.4%
neg-mul-188.4%
sub-neg88.4%
distribute-lft-neg-in88.4%
*-commutative88.4%
distribute-neg-frac88.4%
associate-/l*93.6%
distribute-rgt-neg-in93.6%
distribute-neg-frac93.6%
Simplified93.6%
Taylor expanded in t around 0 93.6%
+-commutative93.6%
Simplified93.6%
Final simplification92.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.0))) (* x (/ (+ y t) z)) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 1.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.0d0)) .or. (.not. (z <= 1.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.0) || !(z <= 1.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.0) or not (z <= 1.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.0) || !(z <= 1.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.0) || ~((z <= 1.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.0], N[Not[LessEqual[z, 1.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 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 93.3%
Taylor expanded in z around inf 87.1%
*-commutative87.1%
sub-neg87.1%
remove-double-neg87.1%
neg-mul-187.1%
distribute-neg-in87.1%
neg-mul-187.1%
sub-neg87.1%
distribute-lft-neg-in87.1%
*-commutative87.1%
distribute-neg-frac87.1%
associate-/l*92.2%
distribute-rgt-neg-in92.2%
distribute-neg-frac92.2%
Simplified92.2%
if -1 < z < 1Initial program 92.8%
Taylor expanded in z around 0 91.7%
mul-1-neg91.7%
unsub-neg91.7%
div-sub91.7%
associate-/l*91.8%
*-inverses91.8%
*-rgt-identity91.8%
Simplified91.8%
Final simplification92.0%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.35e+24) (not (<= t 3.1e+130))) (* x (/ t (+ z -1.0))) (* (/ y z) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.35e+24) || !(t <= 3.1e+130)) {
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 ((t <= (-1.35d+24)) .or. (.not. (t <= 3.1d+130))) 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 ((t <= -1.35e+24) || !(t <= 3.1e+130)) {
tmp = x * (t / (z + -1.0));
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.35e+24) or not (t <= 3.1e+130): tmp = x * (t / (z + -1.0)) else: tmp = (y / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.35e+24) || !(t <= 3.1e+130)) 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 ((t <= -1.35e+24) || ~((t <= 3.1e+130))) tmp = x * (t / (z + -1.0)); else tmp = (y / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.35e+24], N[Not[LessEqual[t, 3.1e+130]], $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}\;t \leq -1.35 \cdot 10^{+24} \lor \neg \left(t \leq 3.1 \cdot 10^{+130}\right):\\
\;\;\;\;x \cdot \frac{t}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if t < -1.35e24 or 3.1e130 < t Initial program 96.0%
Taylor expanded in y around 0 72.7%
mul-1-neg72.7%
distribute-neg-frac272.7%
neg-sub072.7%
associate--r-72.7%
metadata-eval72.7%
Simplified72.7%
if -1.35e24 < t < 3.1e130Initial program 91.2%
Taylor expanded in y around inf 77.0%
associate-*r/80.1%
Simplified80.1%
Final simplification77.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.15e+166) (not (<= t 6e+132))) (* x (/ t z)) (* (/ y z) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.15e+166) || !(t <= 6e+132)) {
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.15d+166)) .or. (.not. (t <= 6d+132))) 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.15e+166) || !(t <= 6e+132)) {
tmp = x * (t / z);
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.15e+166) or not (t <= 6e+132): tmp = x * (t / z) else: tmp = (y / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.15e+166) || !(t <= 6e+132)) 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.15e+166) || ~((t <= 6e+132))) tmp = x * (t / z); else tmp = (y / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.15e+166], N[Not[LessEqual[t, 6e+132]], $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.15 \cdot 10^{+166} \lor \neg \left(t \leq 6 \cdot 10^{+132}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if t < -1.15000000000000004e166 or 5.9999999999999996e132 < t Initial program 94.2%
Taylor expanded in z around inf 60.1%
*-commutative60.1%
sub-neg60.1%
remove-double-neg60.1%
neg-mul-160.1%
distribute-neg-in60.1%
neg-mul-160.1%
sub-neg60.1%
distribute-lft-neg-in60.1%
*-commutative60.1%
distribute-neg-frac60.1%
associate-/l*65.4%
distribute-rgt-neg-in65.4%
distribute-neg-frac65.4%
Simplified65.4%
Taylor expanded in t around inf 59.0%
if -1.15000000000000004e166 < t < 5.9999999999999996e132Initial program 92.7%
Taylor expanded in y around inf 72.3%
associate-*r/74.9%
Simplified74.9%
Final simplification70.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -0.0001) (not (<= z 1.0))) (* t (/ x z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.0001) || !(z <= 1.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 <= (-0.0001d0)) .or. (.not. (z <= 1.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 <= -0.0001) || !(z <= 1.0)) {
tmp = t * (x / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -0.0001) or not (z <= 1.0): tmp = t * (x / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -0.0001) || !(z <= 1.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 <= -0.0001) || ~((z <= 1.0))) tmp = t * (x / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -0.0001], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.0001 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -1.00000000000000005e-4 or 1 < z Initial program 93.4%
Taylor expanded in z around inf 87.3%
*-commutative87.3%
sub-neg87.3%
remove-double-neg87.3%
neg-mul-187.3%
distribute-neg-in87.3%
neg-mul-187.3%
sub-neg87.3%
distribute-lft-neg-in87.3%
*-commutative87.3%
distribute-neg-frac87.3%
associate-/l*92.3%
distribute-rgt-neg-in92.3%
distribute-neg-frac92.3%
Simplified92.3%
Taylor expanded in t around inf 49.7%
associate-/l*49.0%
Simplified49.0%
if -1.00000000000000005e-4 < z < 1Initial program 92.6%
Taylor expanded in z around 0 91.6%
mul-1-neg91.6%
unsub-neg91.6%
div-sub91.6%
associate-/l*91.6%
*-inverses91.6%
*-rgt-identity91.6%
Simplified91.6%
Taylor expanded in y around 0 31.8%
associate-*r*31.8%
mul-1-neg31.8%
Simplified31.8%
Final simplification41.1%
(FPCore (x y z t) :precision binary64 (if (<= t -1.2e+166) (* x (/ t z)) (if (<= t 2.9e+129) (* (/ y z) x) (/ x (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.2e+166) {
tmp = x * (t / z);
} else if (t <= 2.9e+129) {
tmp = (y / z) * x;
} else {
tmp = 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 (t <= (-1.2d+166)) then
tmp = x * (t / z)
else if (t <= 2.9d+129) then
tmp = (y / z) * x
else
tmp = x / (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.2e+166) {
tmp = x * (t / z);
} else if (t <= 2.9e+129) {
tmp = (y / z) * x;
} else {
tmp = x / (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.2e+166: tmp = x * (t / z) elif t <= 2.9e+129: tmp = (y / z) * x else: tmp = x / (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.2e+166) tmp = Float64(x * Float64(t / z)); elseif (t <= 2.9e+129) tmp = Float64(Float64(y / z) * x); else tmp = Float64(x / Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.2e+166) tmp = x * (t / z); elseif (t <= 2.9e+129) tmp = (y / z) * x; else tmp = x / (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.2e+166], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.9e+129], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.2 \cdot 10^{+166}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{elif}\;t \leq 2.9 \cdot 10^{+129}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\end{array}
\end{array}
if t < -1.19999999999999996e166Initial program 94.0%
Taylor expanded in z around inf 60.8%
*-commutative60.8%
sub-neg60.8%
remove-double-neg60.8%
neg-mul-160.8%
distribute-neg-in60.8%
neg-mul-160.8%
sub-neg60.8%
distribute-lft-neg-in60.8%
*-commutative60.8%
distribute-neg-frac60.8%
associate-/l*66.3%
distribute-rgt-neg-in66.3%
distribute-neg-frac66.3%
Simplified66.3%
Taylor expanded in t around inf 56.0%
if -1.19999999999999996e166 < t < 2.90000000000000003e129Initial program 92.7%
Taylor expanded in y around inf 72.3%
associate-*r/74.9%
Simplified74.9%
if 2.90000000000000003e129 < t Initial program 94.4%
Taylor expanded in z around inf 59.4%
*-commutative59.4%
sub-neg59.4%
remove-double-neg59.4%
neg-mul-159.4%
distribute-neg-in59.4%
neg-mul-159.4%
sub-neg59.4%
distribute-lft-neg-in59.4%
*-commutative59.4%
distribute-neg-frac59.4%
associate-/l*64.6%
distribute-rgt-neg-in64.6%
distribute-neg-frac64.6%
Simplified64.6%
clear-num64.6%
un-div-inv64.7%
+-commutative64.7%
Applied egg-rr64.7%
Taylor expanded in y around 0 62.0%
Final simplification70.8%
(FPCore (x y z t) :precision binary64 (if (<= z -0.0001) (* t (/ x z)) (if (<= z 1.0) (* x (- t)) (* x (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.0001) {
tmp = t * (x / z);
} else if (z <= 1.0) {
tmp = x * -t;
} else {
tmp = x * (t / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-0.0001d0)) then
tmp = t * (x / z)
else if (z <= 1.0d0) then
tmp = x * -t
else
tmp = x * (t / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.0001) {
tmp = t * (x / z);
} else if (z <= 1.0) {
tmp = x * -t;
} else {
tmp = x * (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -0.0001: tmp = t * (x / z) elif z <= 1.0: tmp = x * -t else: tmp = x * (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -0.0001) tmp = Float64(t * Float64(x / z)); elseif (z <= 1.0) tmp = Float64(x * Float64(-t)); else tmp = Float64(x * Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -0.0001) tmp = t * (x / z); elseif (z <= 1.0) tmp = x * -t; else tmp = x * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.0001], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(x * (-t)), $MachinePrecision], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.0001:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\end{array}
\end{array}
if z < -1.00000000000000005e-4Initial program 91.2%
Taylor expanded in z around inf 86.0%
*-commutative86.0%
sub-neg86.0%
remove-double-neg86.0%
neg-mul-186.0%
distribute-neg-in86.0%
neg-mul-186.0%
sub-neg86.0%
distribute-lft-neg-in86.0%
*-commutative86.0%
distribute-neg-frac86.0%
associate-/l*90.7%
distribute-rgt-neg-in90.7%
distribute-neg-frac90.7%
Simplified90.7%
Taylor expanded in t around inf 50.6%
associate-/l*51.9%
Simplified51.9%
if -1.00000000000000005e-4 < z < 1Initial program 92.6%
Taylor expanded in z around 0 91.6%
mul-1-neg91.6%
unsub-neg91.6%
div-sub91.6%
associate-/l*91.6%
*-inverses91.6%
*-rgt-identity91.6%
Simplified91.6%
Taylor expanded in y around 0 31.8%
associate-*r*31.8%
mul-1-neg31.8%
Simplified31.8%
if 1 < z Initial program 95.2%
Taylor expanded in z around inf 88.4%
*-commutative88.4%
sub-neg88.4%
remove-double-neg88.4%
neg-mul-188.4%
distribute-neg-in88.4%
neg-mul-188.4%
sub-neg88.4%
distribute-lft-neg-in88.4%
*-commutative88.4%
distribute-neg-frac88.4%
associate-/l*93.6%
distribute-rgt-neg-in93.6%
distribute-neg-frac93.6%
Simplified93.6%
Taylor expanded in t around inf 53.7%
Final simplification43.2%
(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 93.1%
Taylor expanded in z around 0 62.3%
mul-1-neg62.3%
unsub-neg62.3%
div-sub62.3%
associate-/l*62.4%
*-inverses62.4%
*-rgt-identity62.4%
Simplified62.4%
Taylor expanded in y around 0 21.0%
associate-*r*21.0%
mul-1-neg21.0%
Simplified21.0%
Final simplification21.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 2024085
(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)))))