
(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 (- 1.0 z))))) (if (<= t_1 (- INFINITY)) (* y (/ x z)) (* t_1 x))))
double code(double x, double y, double z, double t) {
double t_1 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = y * (x / z);
} else {
tmp = t_1 * x;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = y * (x / z);
} else {
tmp = t_1 * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / z) - (t / (1.0 - z)) tmp = 0 if t_1 <= -math.inf: tmp = y * (x / z) else: tmp = t_1 * x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y / z) - Float64(t / Float64(1.0 - z))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(y * Float64(x / z)); else tmp = Float64(t_1 * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y / z) - (t / (1.0 - z)); tmp = 0.0; if (t_1 <= -Inf) tmp = y * (x / z); else tmp = t_1 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} - \frac{t}{1 - z}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot x\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -inf.0Initial program 66.5%
Taylor expanded in y around inf 99.6%
associate-/l*74.8%
associate-/r/99.8%
Simplified99.8%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) Initial program 97.7%
Final simplification97.8%
(FPCore (x y z t)
:precision binary64
(if (or (<= z -3.3e-20)
(and (not (<= z -4.9e-116))
(or (<= z 1.45e-219) (not (<= z 1.5e-26)))))
(* t (/ x z))
(* t (- x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.3e-20) || (!(z <= -4.9e-116) && ((z <= 1.45e-219) || !(z <= 1.5e-26)))) {
tmp = t * (x / z);
} else {
tmp = t * -x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-3.3d-20)) .or. (.not. (z <= (-4.9d-116))) .and. (z <= 1.45d-219) .or. (.not. (z <= 1.5d-26))) then
tmp = t * (x / z)
else
tmp = t * -x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.3e-20) || (!(z <= -4.9e-116) && ((z <= 1.45e-219) || !(z <= 1.5e-26)))) {
tmp = t * (x / z);
} else {
tmp = t * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.3e-20) or (not (z <= -4.9e-116) and ((z <= 1.45e-219) or not (z <= 1.5e-26))): tmp = t * (x / z) else: tmp = t * -x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.3e-20) || (!(z <= -4.9e-116) && ((z <= 1.45e-219) || !(z <= 1.5e-26)))) tmp = Float64(t * Float64(x / z)); else tmp = Float64(t * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.3e-20) || (~((z <= -4.9e-116)) && ((z <= 1.45e-219) || ~((z <= 1.5e-26))))) tmp = t * (x / z); else tmp = t * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.3e-20], And[N[Not[LessEqual[z, -4.9e-116]], $MachinePrecision], Or[LessEqual[z, 1.45e-219], N[Not[LessEqual[z, 1.5e-26]], $MachinePrecision]]]], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(t * (-x)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{-20} \lor \neg \left(z \leq -4.9 \cdot 10^{-116}\right) \land \left(z \leq 1.45 \cdot 10^{-219} \lor \neg \left(z \leq 1.5 \cdot 10^{-26}\right)\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(-x\right)\\
\end{array}
\end{array}
if z < -3.3e-20 or -4.89999999999999977e-116 < z < 1.44999999999999992e-219 or 1.50000000000000006e-26 < z Initial program 96.2%
Taylor expanded in z around inf 82.8%
cancel-sign-sub-inv82.8%
metadata-eval82.8%
*-lft-identity82.8%
+-commutative82.8%
Simplified82.8%
Taylor expanded in t around inf 36.0%
div-inv36.0%
associate-*l*39.2%
div-inv39.2%
Applied egg-rr39.2%
if -3.3e-20 < z < -4.89999999999999977e-116 or 1.44999999999999992e-219 < z < 1.50000000000000006e-26Initial program 95.7%
Taylor expanded in y around 0 46.0%
associate-*r/46.0%
associate-*r*46.0%
neg-mul-146.0%
associate-*l/46.0%
*-commutative46.0%
distribute-frac-neg46.0%
mul-1-neg46.0%
associate-*r/46.0%
*-commutative46.0%
associate-*r/46.0%
metadata-eval46.0%
associate-/r*46.0%
neg-mul-146.0%
associate-*r/46.0%
*-rgt-identity46.0%
neg-sub046.0%
associate--r-46.0%
metadata-eval46.0%
Simplified46.0%
Taylor expanded in z around 0 46.0%
*-commutative46.0%
neg-mul-146.0%
distribute-rgt-neg-in46.0%
Simplified46.0%
Final simplification41.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t z))) (t_2 (* t (- x))))
(if (<= z -3.3e-20)
t_1
(if (<= z -4.9e-116)
t_2
(if (<= z 1.55e-219) (* t (/ x z)) (if (<= z 1.5e-26) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double t_2 = t * -x;
double tmp;
if (z <= -3.3e-20) {
tmp = t_1;
} else if (z <= -4.9e-116) {
tmp = t_2;
} else if (z <= 1.55e-219) {
tmp = t * (x / z);
} else if (z <= 1.5e-26) {
tmp = t_2;
} 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 * (t / z)
t_2 = t * -x
if (z <= (-3.3d-20)) then
tmp = t_1
else if (z <= (-4.9d-116)) then
tmp = t_2
else if (z <= 1.55d-219) then
tmp = t * (x / z)
else if (z <= 1.5d-26) then
tmp = t_2
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 * (t / z);
double t_2 = t * -x;
double tmp;
if (z <= -3.3e-20) {
tmp = t_1;
} else if (z <= -4.9e-116) {
tmp = t_2;
} else if (z <= 1.55e-219) {
tmp = t * (x / z);
} else if (z <= 1.5e-26) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / z) t_2 = t * -x tmp = 0 if z <= -3.3e-20: tmp = t_1 elif z <= -4.9e-116: tmp = t_2 elif z <= 1.55e-219: tmp = t * (x / z) elif z <= 1.5e-26: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / z)) t_2 = Float64(t * Float64(-x)) tmp = 0.0 if (z <= -3.3e-20) tmp = t_1; elseif (z <= -4.9e-116) tmp = t_2; elseif (z <= 1.55e-219) tmp = Float64(t * Float64(x / z)); elseif (z <= 1.5e-26) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / z); t_2 = t * -x; tmp = 0.0; if (z <= -3.3e-20) tmp = t_1; elseif (z <= -4.9e-116) tmp = t_2; elseif (z <= 1.55e-219) tmp = t * (x / z); elseif (z <= 1.5e-26) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * (-x)), $MachinePrecision]}, If[LessEqual[z, -3.3e-20], t$95$1, If[LessEqual[z, -4.9e-116], t$95$2, If[LessEqual[z, 1.55e-219], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.5e-26], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
t_2 := t \cdot \left(-x\right)\\
\mathbf{if}\;z \leq -3.3 \cdot 10^{-20}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -4.9 \cdot 10^{-116}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{-219}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{-26}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.3e-20 or 1.50000000000000006e-26 < z Initial program 97.5%
Taylor expanded in z around inf 96.7%
cancel-sign-sub-inv96.7%
metadata-eval96.7%
*-lft-identity96.7%
+-commutative96.7%
Simplified96.7%
Taylor expanded in t around inf 42.8%
associate-*l/47.6%
*-commutative47.6%
Simplified47.6%
if -3.3e-20 < z < -4.89999999999999977e-116 or 1.5499999999999999e-219 < z < 1.50000000000000006e-26Initial program 95.7%
Taylor expanded in y around 0 46.0%
associate-*r/46.0%
associate-*r*46.0%
neg-mul-146.0%
associate-*l/46.0%
*-commutative46.0%
distribute-frac-neg46.0%
mul-1-neg46.0%
associate-*r/46.0%
*-commutative46.0%
associate-*r/46.0%
metadata-eval46.0%
associate-/r*46.0%
neg-mul-146.0%
associate-*r/46.0%
*-rgt-identity46.0%
neg-sub046.0%
associate--r-46.0%
metadata-eval46.0%
Simplified46.0%
Taylor expanded in z around 0 46.0%
*-commutative46.0%
neg-mul-146.0%
distribute-rgt-neg-in46.0%
Simplified46.0%
if -4.89999999999999977e-116 < z < 1.5499999999999999e-219Initial program 92.8%
Taylor expanded in z around inf 47.8%
cancel-sign-sub-inv47.8%
metadata-eval47.8%
*-lft-identity47.8%
+-commutative47.8%
Simplified47.8%
Taylor expanded in t around inf 18.9%
div-inv18.9%
associate-*l*22.6%
div-inv22.6%
Applied egg-rr22.6%
Final simplification41.9%
(FPCore (x y z t)
:precision binary64
(if (<= z -9e+138)
(* (/ y z) x)
(if (<= z -8.2e+77)
(/ x (/ z t))
(if (<= z 2.9e-5) (* x (- (/ y z) t)) (/ x (/ z y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -9e+138) {
tmp = (y / z) * x;
} else if (z <= -8.2e+77) {
tmp = x / (z / t);
} else if (z <= 2.9e-5) {
tmp = x * ((y / z) - t);
} else {
tmp = x / (z / y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-9d+138)) then
tmp = (y / z) * x
else if (z <= (-8.2d+77)) then
tmp = x / (z / t)
else if (z <= 2.9d-5) then
tmp = x * ((y / z) - t)
else
tmp = x / (z / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -9e+138) {
tmp = (y / z) * x;
} else if (z <= -8.2e+77) {
tmp = x / (z / t);
} else if (z <= 2.9e-5) {
tmp = x * ((y / z) - t);
} else {
tmp = x / (z / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -9e+138: tmp = (y / z) * x elif z <= -8.2e+77: tmp = x / (z / t) elif z <= 2.9e-5: tmp = x * ((y / z) - t) else: tmp = x / (z / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -9e+138) tmp = Float64(Float64(y / z) * x); elseif (z <= -8.2e+77) tmp = Float64(x / Float64(z / t)); elseif (z <= 2.9e-5) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(x / Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -9e+138) tmp = (y / z) * x; elseif (z <= -8.2e+77) tmp = x / (z / t); elseif (z <= 2.9e-5) tmp = x * ((y / z) - t); else tmp = x / (z / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -9e+138], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, -8.2e+77], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.9e-5], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{+138}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{elif}\;z \leq -8.2 \cdot 10^{+77}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{-5}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\end{array}
\end{array}
if z < -8.99999999999999963e138Initial program 96.3%
Taylor expanded in y around inf 55.3%
associate-*r/70.9%
Simplified70.9%
if -8.99999999999999963e138 < z < -8.2000000000000002e77Initial program 98.9%
Taylor expanded in z around inf 85.7%
associate-/l*99.6%
cancel-sign-sub-inv99.6%
metadata-eval99.6%
*-lft-identity99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in t around inf 86.3%
if -8.2000000000000002e77 < z < 2.9e-5Initial program 95.2%
Taylor expanded in z around 0 88.8%
+-commutative88.8%
associate-*r/88.0%
*-commutative88.0%
associate-*r*88.0%
neg-mul-188.0%
distribute-rgt-out91.5%
unsub-neg91.5%
Simplified91.5%
if 2.9e-5 < z Initial program 97.2%
Taylor expanded in y around inf 57.3%
associate-*r/61.0%
Simplified61.0%
clear-num61.0%
un-div-inv61.1%
Applied egg-rr61.1%
Final simplification79.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t (+ z -1.0)))))
(if (<= t -9.2e+80)
t_1
(if (<= t 4.4e-21)
(* (/ y z) x)
(if (<= t 1.65e+112) (* x (- (/ y z) t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / (z + -1.0));
double tmp;
if (t <= -9.2e+80) {
tmp = t_1;
} else if (t <= 4.4e-21) {
tmp = (y / z) * x;
} else if (t <= 1.65e+112) {
tmp = x * ((y / z) - t);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * (t / (z + (-1.0d0)))
if (t <= (-9.2d+80)) then
tmp = t_1
else if (t <= 4.4d-21) then
tmp = (y / z) * x
else if (t <= 1.65d+112) then
tmp = x * ((y / z) - t)
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 * (t / (z + -1.0));
double tmp;
if (t <= -9.2e+80) {
tmp = t_1;
} else if (t <= 4.4e-21) {
tmp = (y / z) * x;
} else if (t <= 1.65e+112) {
tmp = x * ((y / z) - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / (z + -1.0)) tmp = 0 if t <= -9.2e+80: tmp = t_1 elif t <= 4.4e-21: tmp = (y / z) * x elif t <= 1.65e+112: tmp = x * ((y / z) - t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / Float64(z + -1.0))) tmp = 0.0 if (t <= -9.2e+80) tmp = t_1; elseif (t <= 4.4e-21) tmp = Float64(Float64(y / z) * x); elseif (t <= 1.65e+112) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / (z + -1.0)); tmp = 0.0; if (t <= -9.2e+80) tmp = t_1; elseif (t <= 4.4e-21) tmp = (y / z) * x; elseif (t <= 1.65e+112) tmp = x * ((y / z) - t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -9.2e+80], t$95$1, If[LessEqual[t, 4.4e-21], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t, 1.65e+112], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z + -1}\\
\mathbf{if}\;t \leq -9.2 \cdot 10^{+80}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 4.4 \cdot 10^{-21}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{elif}\;t \leq 1.65 \cdot 10^{+112}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -9.20000000000000016e80 or 1.64999999999999995e112 < t Initial program 97.3%
Taylor expanded in y around 0 67.4%
associate-*r/67.4%
associate-*r*67.4%
neg-mul-167.4%
associate-*l/78.0%
*-commutative78.0%
distribute-frac-neg78.0%
mul-1-neg78.0%
associate-*r/78.0%
*-commutative78.0%
associate-*r/77.9%
metadata-eval77.9%
associate-/r*77.9%
neg-mul-177.9%
associate-*r/78.0%
*-rgt-identity78.0%
neg-sub078.0%
associate--r-78.0%
metadata-eval78.0%
Simplified78.0%
if -9.20000000000000016e80 < t < 4.4000000000000001e-21Initial program 95.9%
Taylor expanded in y around inf 80.2%
associate-*r/86.3%
Simplified86.3%
if 4.4000000000000001e-21 < t < 1.64999999999999995e112Initial program 92.9%
Taylor expanded in z around 0 85.8%
+-commutative85.8%
associate-*r/79.0%
*-commutative79.0%
associate-*r*79.0%
neg-mul-179.0%
distribute-rgt-out79.0%
unsub-neg79.0%
Simplified79.0%
Final simplification83.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.1) (not (<= z 4.2e-33))) (* x (/ (+ y t) z)) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.1) || !(z <= 4.2e-33)) {
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.1d0)) .or. (.not. (z <= 4.2d-33))) 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.1) || !(z <= 4.2e-33)) {
tmp = x * ((y + t) / z);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.1) or not (z <= 4.2e-33): 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.1) || !(z <= 4.2e-33)) 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.1) || ~((z <= 4.2e-33))) 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.1], N[Not[LessEqual[z, 4.2e-33]], $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.1 \lor \neg \left(z \leq 4.2 \cdot 10^{-33}\right):\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -1.1000000000000001 or 4.2e-33 < z Initial program 97.4%
Taylor expanded in z around inf 96.5%
cancel-sign-sub-inv96.5%
metadata-eval96.5%
*-lft-identity96.5%
+-commutative96.5%
Simplified96.5%
if -1.1000000000000001 < z < 4.2e-33Initial program 94.6%
Taylor expanded in z around 0 91.7%
+-commutative91.7%
associate-*r/90.7%
*-commutative90.7%
associate-*r*90.7%
neg-mul-190.7%
distribute-rgt-out94.6%
unsub-neg94.6%
Simplified94.6%
Final simplification95.6%
(FPCore (x y z t) :precision binary64 (if (<= z -1.1) (* x (/ (+ y t) z)) (if (<= z 2.9e-5) (* x (- (/ y z) t)) (/ x (/ z (+ y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.1) {
tmp = x * ((y + t) / z);
} else if (z <= 2.9e-5) {
tmp = x * ((y / z) - t);
} else {
tmp = x / (z / (y + 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.1d0)) then
tmp = x * ((y + t) / z)
else if (z <= 2.9d-5) then
tmp = x * ((y / z) - t)
else
tmp = x / (z / (y + t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.1) {
tmp = x * ((y + t) / z);
} else if (z <= 2.9e-5) {
tmp = x * ((y / z) - t);
} else {
tmp = x / (z / (y + t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.1: tmp = x * ((y + t) / z) elif z <= 2.9e-5: tmp = x * ((y / z) - t) else: tmp = x / (z / (y + t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.1) tmp = Float64(x * Float64(Float64(y + t) / z)); elseif (z <= 2.9e-5) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(x / Float64(z / Float64(y + t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.1) tmp = x * ((y + t) / z); elseif (z <= 2.9e-5) tmp = x * ((y / z) - t); else tmp = x / (z / (y + t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.1], N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.9e-5], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1:\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{-5}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y + t}}\\
\end{array}
\end{array}
if z < -1.1000000000000001Initial program 97.6%
Taylor expanded in z around inf 96.5%
cancel-sign-sub-inv96.5%
metadata-eval96.5%
*-lft-identity96.5%
+-commutative96.5%
Simplified96.5%
if -1.1000000000000001 < z < 2.9e-5Initial program 94.7%
Taylor expanded in z around 0 91.8%
+-commutative91.8%
associate-*r/90.8%
*-commutative90.8%
associate-*r*90.8%
neg-mul-190.8%
distribute-rgt-out94.7%
unsub-neg94.7%
Simplified94.7%
if 2.9e-5 < z Initial program 97.2%
Taylor expanded in z around inf 87.9%
associate-/l*96.5%
cancel-sign-sub-inv96.5%
metadata-eval96.5%
*-lft-identity96.5%
+-commutative96.5%
Simplified96.5%
Final simplification95.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -6.5e+143) (not (<= t 2.6e+112))) (* x (/ t z)) (* (/ y z) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -6.5e+143) || !(t <= 2.6e+112)) {
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 <= (-6.5d+143)) .or. (.not. (t <= 2.6d+112))) 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 <= -6.5e+143) || !(t <= 2.6e+112)) {
tmp = x * (t / z);
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -6.5e+143) or not (t <= 2.6e+112): tmp = x * (t / z) else: tmp = (y / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -6.5e+143) || !(t <= 2.6e+112)) 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 <= -6.5e+143) || ~((t <= 2.6e+112))) tmp = x * (t / z); else tmp = (y / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -6.5e+143], N[Not[LessEqual[t, 2.6e+112]], $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 -6.5 \cdot 10^{+143} \lor \neg \left(t \leq 2.6 \cdot 10^{+112}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if t < -6.4999999999999997e143 or 2.6000000000000001e112 < t Initial program 96.7%
Taylor expanded in z around inf 66.2%
cancel-sign-sub-inv66.2%
metadata-eval66.2%
*-lft-identity66.2%
+-commutative66.2%
Simplified66.2%
Taylor expanded in t around inf 51.4%
associate-*l/63.2%
*-commutative63.2%
Simplified63.2%
if -6.4999999999999997e143 < t < 2.6000000000000001e112Initial program 95.8%
Taylor expanded in y around inf 75.5%
associate-*r/79.7%
Simplified79.7%
Final simplification75.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.7e+144) (not (<= t 3.5e+114))) (/ x (/ z t)) (* (/ y z) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.7e+144) || !(t <= 3.5e+114)) {
tmp = x / (z / t);
} 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.7d+144)) .or. (.not. (t <= 3.5d+114))) then
tmp = x / (z / t)
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.7e+144) || !(t <= 3.5e+114)) {
tmp = x / (z / t);
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.7e+144) or not (t <= 3.5e+114): tmp = x / (z / t) else: tmp = (y / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.7e+144) || !(t <= 3.5e+114)) tmp = Float64(x / Float64(z / t)); 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.7e+144) || ~((t <= 3.5e+114))) tmp = x / (z / t); else tmp = (y / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.7e+144], N[Not[LessEqual[t, 3.5e+114]], $MachinePrecision]], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.7 \cdot 10^{+144} \lor \neg \left(t \leq 3.5 \cdot 10^{+114}\right):\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if t < -1.7e144 or 3.5000000000000001e114 < t Initial program 96.7%
Taylor expanded in z around inf 53.0%
associate-/l*66.3%
cancel-sign-sub-inv66.3%
metadata-eval66.3%
*-lft-identity66.3%
+-commutative66.3%
Simplified66.3%
Taylor expanded in t around inf 63.3%
if -1.7e144 < t < 3.5000000000000001e114Initial program 95.8%
Taylor expanded in y around inf 75.5%
associate-*r/79.7%
Simplified79.7%
Final simplification75.7%
(FPCore (x y z t) :precision binary64 (* t (- x)))
double code(double x, double y, double z, double t) {
return t * -x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t * -x
end function
public static double code(double x, double y, double z, double t) {
return t * -x;
}
def code(x, y, z, t): return t * -x
function code(x, y, z, t) return Float64(t * Float64(-x)) end
function tmp = code(x, y, z, t) tmp = t * -x; end
code[x_, y_, z_, t_] := N[(t * (-x)), $MachinePrecision]
\begin{array}{l}
\\
t \cdot \left(-x\right)
\end{array}
Initial program 96.0%
Taylor expanded in y around 0 37.7%
associate-*r/37.7%
associate-*r*37.7%
neg-mul-137.7%
associate-*l/40.2%
*-commutative40.2%
distribute-frac-neg40.2%
mul-1-neg40.2%
associate-*r/40.2%
*-commutative40.2%
associate-*r/40.2%
metadata-eval40.2%
associate-/r*40.2%
neg-mul-140.2%
associate-*r/40.2%
*-rgt-identity40.2%
neg-sub040.2%
associate--r-40.2%
metadata-eval40.2%
Simplified40.2%
Taylor expanded in z around 0 18.7%
*-commutative18.7%
neg-mul-118.7%
distribute-rgt-neg-in18.7%
Simplified18.7%
Final simplification18.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 2024027
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
:precision binary64
:herbie-target
(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)))))