
(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 9 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 (/ x z))) (t_2 (+ (/ y z) (/ t (+ z -1.0)))) (t_3 (* t_2 x)))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 -1e-180)
t_3
(if (<= t_2 2e-130)
(/ (* x (+ y t)) z)
(if (<= t_2 4e+294) t_3 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (x / z);
double t_2 = (y / z) + (t / (z + -1.0));
double t_3 = t_2 * x;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= -1e-180) {
tmp = t_3;
} else if (t_2 <= 2e-130) {
tmp = (x * (y + t)) / z;
} else if (t_2 <= 4e+294) {
tmp = t_3;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = y * (x / z);
double t_2 = (y / z) + (t / (z + -1.0));
double t_3 = t_2 * x;
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= -1e-180) {
tmp = t_3;
} else if (t_2 <= 2e-130) {
tmp = (x * (y + t)) / z;
} else if (t_2 <= 4e+294) {
tmp = t_3;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (x / z) t_2 = (y / z) + (t / (z + -1.0)) t_3 = t_2 * x tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= -1e-180: tmp = t_3 elif t_2 <= 2e-130: tmp = (x * (y + t)) / z elif t_2 <= 4e+294: tmp = t_3 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(x / z)) t_2 = Float64(Float64(y / z) + Float64(t / Float64(z + -1.0))) t_3 = Float64(t_2 * x) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= -1e-180) tmp = t_3; elseif (t_2 <= 2e-130) tmp = Float64(Float64(x * Float64(y + t)) / z); elseif (t_2 <= 4e+294) tmp = t_3; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (x / z); t_2 = (y / z) + (t / (z + -1.0)); t_3 = t_2 * x; tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= -1e-180) tmp = t_3; elseif (t_2 <= 2e-130) tmp = (x * (y + t)) / z; elseif (t_2 <= 4e+294) tmp = t_3; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / z), $MachinePrecision] + N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * x), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, -1e-180], t$95$3, If[LessEqual[t$95$2, 2e-130], N[(N[(x * N[(y + t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t$95$2, 4e+294], t$95$3, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{x}{z}\\
t_2 := \frac{y}{z} + \frac{t}{z + -1}\\
t_3 := t\_2 \cdot x\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-180}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-130}:\\
\;\;\;\;\frac{x \cdot \left(y + t\right)}{z}\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+294}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -inf.0 or 4.00000000000000027e294 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 70.0%
Taylor expanded in y around inf 99.8%
associate-*r/70.0%
Simplified70.0%
clear-num70.0%
un-div-inv71.3%
Applied egg-rr71.3%
associate-/r/99.8%
Simplified99.8%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -1e-180 or 2.0000000000000002e-130 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 4.00000000000000027e294Initial program 99.7%
if -1e-180 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 2.0000000000000002e-130Initial program 81.0%
Taylor expanded in z around inf 99.9%
Taylor expanded in y around 0 99.9%
+-commutative99.9%
*-commutative99.9%
distribute-lft-in99.9%
Simplified99.9%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- (/ y z) t))) (t_2 (* x (/ (+ y t) z))))
(if (<= z -1.0)
t_2
(if (<= z -8e-238)
t_1
(if (<= z 1.7e-233) (* y (/ x z)) (if (<= z 1.0) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y / z) - t);
double t_2 = x * ((y + t) / z);
double tmp;
if (z <= -1.0) {
tmp = t_2;
} else if (z <= -8e-238) {
tmp = t_1;
} else if (z <= 1.7e-233) {
tmp = y * (x / z);
} else if (z <= 1.0) {
tmp = t_1;
} else {
tmp = t_2;
}
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)
t_2 = x * ((y + t) / z)
if (z <= (-1.0d0)) then
tmp = t_2
else if (z <= (-8d-238)) then
tmp = t_1
else if (z <= 1.7d-233) then
tmp = y * (x / z)
else if (z <= 1.0d0) then
tmp = t_1
else
tmp = t_2
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);
double t_2 = x * ((y + t) / z);
double tmp;
if (z <= -1.0) {
tmp = t_2;
} else if (z <= -8e-238) {
tmp = t_1;
} else if (z <= 1.7e-233) {
tmp = y * (x / z);
} else if (z <= 1.0) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((y / z) - t) t_2 = x * ((y + t) / z) tmp = 0 if z <= -1.0: tmp = t_2 elif z <= -8e-238: tmp = t_1 elif z <= 1.7e-233: tmp = y * (x / z) elif z <= 1.0: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(y / z) - t)) t_2 = Float64(x * Float64(Float64(y + t) / z)) tmp = 0.0 if (z <= -1.0) tmp = t_2; elseif (z <= -8e-238) tmp = t_1; elseif (z <= 1.7e-233) tmp = Float64(y * Float64(x / z)); elseif (z <= 1.0) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((y / z) - t); t_2 = x * ((y + t) / z); tmp = 0.0; if (z <= -1.0) tmp = t_2; elseif (z <= -8e-238) tmp = t_1; elseif (z <= 1.7e-233) tmp = y * (x / z); elseif (z <= 1.0) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.0], t$95$2, If[LessEqual[z, -8e-238], t$95$1, If[LessEqual[z, 1.7e-233], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\frac{y}{z} - t\right)\\
t_2 := x \cdot \frac{y + t}{z}\\
\mathbf{if}\;z \leq -1:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -8 \cdot 10^{-238}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{-233}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 94.9%
Taylor expanded in z around inf 87.5%
*-commutative87.5%
remove-double-neg87.5%
cancel-sign-sub-inv87.5%
metadata-eval87.5%
*-lft-identity87.5%
distribute-neg-out87.5%
neg-mul-187.5%
sub-neg87.5%
distribute-lft-neg-in87.5%
*-commutative87.5%
distribute-neg-frac87.5%
associate-/l*93.4%
distribute-rgt-neg-in93.4%
distribute-neg-frac93.4%
Simplified93.4%
if -1 < z < -7.9999999999999999e-238 or 1.7000000000000001e-233 < z < 1Initial program 94.7%
Taylor expanded in z around 0 94.6%
mul-1-neg94.6%
unsub-neg94.6%
div-sub94.6%
associate-/l*94.6%
*-inverses94.6%
*-rgt-identity94.6%
Simplified94.6%
if -7.9999999999999999e-238 < z < 1.7000000000000001e-233Initial program 79.2%
Taylor expanded in y around inf 89.8%
associate-*r/69.5%
Simplified69.5%
clear-num69.4%
un-div-inv70.8%
Applied egg-rr70.8%
associate-/r/92.4%
Simplified92.4%
Final simplification93.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.4e+88) (not (<= t 1.42e+150))) (* t (/ x (+ z -1.0))) (/ (* y x) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.4e+88) || !(t <= 1.42e+150)) {
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 ((t <= (-2.4d+88)) .or. (.not. (t <= 1.42d+150))) 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 ((t <= -2.4e+88) || !(t <= 1.42e+150)) {
tmp = t * (x / (z + -1.0));
} else {
tmp = (y * x) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.4e+88) or not (t <= 1.42e+150): tmp = t * (x / (z + -1.0)) else: tmp = (y * x) / z return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.4e+88) || !(t <= 1.42e+150)) tmp = Float64(t * Float64(x / Float64(z + -1.0))); else tmp = Float64(Float64(y * x) / z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.4e+88) || ~((t <= 1.42e+150))) tmp = t * (x / (z + -1.0)); else tmp = (y * x) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.4e+88], N[Not[LessEqual[t, 1.42e+150]], $MachinePrecision]], N[(t * N[(x / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.4 \cdot 10^{+88} \lor \neg \left(t \leq 1.42 \cdot 10^{+150}\right):\\
\;\;\;\;t \cdot \frac{x}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\end{array}
\end{array}
if t < -2.3999999999999999e88 or 1.42e150 < t Initial program 95.6%
Taylor expanded in y around 0 72.8%
mul-1-neg72.8%
associate-/l*76.8%
distribute-rgt-neg-in76.8%
distribute-neg-frac276.8%
neg-sub076.8%
associate--r-76.8%
metadata-eval76.8%
Simplified76.8%
if -2.3999999999999999e88 < t < 1.42e150Initial program 90.5%
Taylor expanded in y around inf 79.4%
Final simplification78.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.9e+86) (not (<= t 2.5e+146))) (* x (/ t (+ z -1.0))) (/ (* y x) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.9e+86) || !(t <= 2.5e+146)) {
tmp = x * (t / (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 ((t <= (-2.9d+86)) .or. (.not. (t <= 2.5d+146))) then
tmp = x * (t / (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 ((t <= -2.9e+86) || !(t <= 2.5e+146)) {
tmp = x * (t / (z + -1.0));
} else {
tmp = (y * x) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.9e+86) or not (t <= 2.5e+146): tmp = x * (t / (z + -1.0)) else: tmp = (y * x) / z return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.9e+86) || !(t <= 2.5e+146)) tmp = Float64(x * Float64(t / Float64(z + -1.0))); else tmp = Float64(Float64(y * x) / z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.9e+86) || ~((t <= 2.5e+146))) tmp = x * (t / (z + -1.0)); else tmp = (y * x) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.9e+86], N[Not[LessEqual[t, 2.5e+146]], $MachinePrecision]], N[(x * N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.9 \cdot 10^{+86} \lor \neg \left(t \leq 2.5 \cdot 10^{+146}\right):\\
\;\;\;\;x \cdot \frac{t}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\end{array}
\end{array}
if t < -2.8999999999999999e86 or 2.4999999999999999e146 < t Initial program 95.6%
Taylor expanded in y around 0 82.1%
mul-1-neg82.1%
distribute-neg-frac282.1%
neg-sub082.1%
associate--r-82.1%
metadata-eval82.1%
Simplified82.1%
if -2.8999999999999999e86 < t < 2.4999999999999999e146Initial program 90.5%
Taylor expanded in y around inf 79.4%
Final simplification80.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2e-12) (not (<= z 1.0))) (* t (/ x z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2e-12) || !(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 <= (-2d-12)) .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 <= -2e-12) || !(z <= 1.0)) {
tmp = t * (x / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2e-12) 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 <= -2e-12) || !(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 <= -2e-12) || ~((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, -2e-12], 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 -2 \cdot 10^{-12} \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.99999999999999996e-12 or 1 < z Initial program 95.1%
Taylor expanded in y around 0 57.3%
mul-1-neg57.3%
distribute-neg-frac257.3%
neg-sub057.3%
associate--r-57.3%
metadata-eval57.3%
Simplified57.3%
Taylor expanded in z around inf 51.0%
associate-/l*54.6%
Simplified54.6%
if -1.99999999999999996e-12 < z < 1Initial program 89.6%
Taylor expanded in y around 0 35.6%
mul-1-neg35.6%
distribute-neg-frac235.6%
neg-sub035.6%
associate--r-35.6%
metadata-eval35.6%
Simplified35.6%
Taylor expanded in z around 0 35.6%
*-commutative35.6%
neg-mul-135.6%
distribute-lft-neg-in35.6%
Simplified35.6%
Final simplification45.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2e-12) (not (<= z 1.0))) (* x (/ t z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2e-12) || !(z <= 1.0)) {
tmp = x * (t / 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 <= (-2d-12)) .or. (.not. (z <= 1.0d0))) then
tmp = x * (t / 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 <= -2e-12) || !(z <= 1.0)) {
tmp = x * (t / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2e-12) or not (z <= 1.0): tmp = x * (t / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2e-12) || !(z <= 1.0)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(x * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2e-12) || ~((z <= 1.0))) tmp = x * (t / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2e-12], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{-12} \lor \neg \left(z \leq 1\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -1.99999999999999996e-12 or 1 < z Initial program 95.1%
Taylor expanded in y around 0 57.3%
mul-1-neg57.3%
distribute-neg-frac257.3%
neg-sub057.3%
associate--r-57.3%
metadata-eval57.3%
Simplified57.3%
Taylor expanded in z around inf 51.0%
associate-*l/55.8%
*-commutative55.8%
Simplified55.8%
if -1.99999999999999996e-12 < z < 1Initial program 89.6%
Taylor expanded in y around 0 35.6%
mul-1-neg35.6%
distribute-neg-frac235.6%
neg-sub035.6%
associate--r-35.6%
metadata-eval35.6%
Simplified35.6%
Taylor expanded in z around 0 35.6%
*-commutative35.6%
neg-mul-135.6%
distribute-lft-neg-in35.6%
Simplified35.6%
Final simplification45.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3e+88) (not (<= t 2e+120))) (* x (/ t z)) (* (/ y z) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3e+88) || !(t <= 2e+120)) {
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 <= (-3d+88)) .or. (.not. (t <= 2d+120))) 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 <= -3e+88) || !(t <= 2e+120)) {
tmp = x * (t / z);
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3e+88) or not (t <= 2e+120): tmp = x * (t / z) else: tmp = (y / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3e+88) || !(t <= 2e+120)) 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 <= -3e+88) || ~((t <= 2e+120))) tmp = x * (t / z); else tmp = (y / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3e+88], N[Not[LessEqual[t, 2e+120]], $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 -3 \cdot 10^{+88} \lor \neg \left(t \leq 2 \cdot 10^{+120}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if t < -3.00000000000000005e88 or 2e120 < t Initial program 94.2%
Taylor expanded in y around 0 78.2%
mul-1-neg78.2%
distribute-neg-frac278.2%
neg-sub078.2%
associate--r-78.2%
metadata-eval78.2%
Simplified78.2%
Taylor expanded in z around inf 49.9%
associate-*l/59.8%
*-commutative59.8%
Simplified59.8%
if -3.00000000000000005e88 < t < 2e120Initial program 91.1%
Taylor expanded in y around inf 80.4%
associate-*r/77.9%
Simplified77.9%
Final simplification70.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.3e+86) (not (<= t 2.4e+130))) (* x (/ t z)) (/ (* y x) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.3e+86) || !(t <= 2.4e+130)) {
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 ((t <= (-2.3d+86)) .or. (.not. (t <= 2.4d+130))) 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 ((t <= -2.3e+86) || !(t <= 2.4e+130)) {
tmp = x * (t / z);
} else {
tmp = (y * x) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.3e+86) or not (t <= 2.4e+130): tmp = x * (t / z) else: tmp = (y * x) / z return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.3e+86) || !(t <= 2.4e+130)) 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 ((t <= -2.3e+86) || ~((t <= 2.4e+130))) tmp = x * (t / z); else tmp = (y * x) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.3e+86], N[Not[LessEqual[t, 2.4e+130]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.3 \cdot 10^{+86} \lor \neg \left(t \leq 2.4 \cdot 10^{+130}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\end{array}
\end{array}
if t < -2.2999999999999999e86 or 2.40000000000000024e130 < t Initial program 94.2%
Taylor expanded in y around 0 78.2%
mul-1-neg78.2%
distribute-neg-frac278.2%
neg-sub078.2%
associate--r-78.2%
metadata-eval78.2%
Simplified78.2%
Taylor expanded in z around inf 49.9%
associate-*l/59.8%
*-commutative59.8%
Simplified59.8%
if -2.2999999999999999e86 < t < 2.40000000000000024e130Initial program 91.1%
Taylor expanded in y around inf 80.4%
Final simplification72.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 92.3%
Taylor expanded in y around 0 46.4%
mul-1-neg46.4%
distribute-neg-frac246.4%
neg-sub046.4%
associate--r-46.4%
metadata-eval46.4%
Simplified46.4%
Taylor expanded in z around 0 22.7%
*-commutative22.7%
neg-mul-122.7%
distribute-lft-neg-in22.7%
Simplified22.7%
Final simplification22.7%
(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 2024079
(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)))))