
(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 -2e+300) (* 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 <= -2e+300) {
tmp = y * (x / z);
} else {
tmp = t_1 * 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) :: tmp
t_1 = (y / z) - (t / (1.0d0 - z))
if (t_1 <= (-2d+300)) then
tmp = y * (x / z)
else
tmp = t_1 * 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 / (1.0 - z));
double tmp;
if (t_1 <= -2e+300) {
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 <= -2e+300: 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 <= -2e+300) 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 <= -2e+300) 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, -2e+300], 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 -2 \cdot 10^{+300}:\\
\;\;\;\;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))) < -2.0000000000000001e300Initial program 74.9%
Taylor expanded in z around inf 74.1%
*-commutative74.1%
associate-/l*59.0%
neg-mul-159.0%
Simplified59.0%
Taylor expanded in z around 0 59.0%
Taylor expanded in y around inf 99.9%
associate-*r/100.0%
Simplified100.0%
if -2.0000000000000001e300 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) Initial program 97.1%
Final simplification97.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t z))))
(if (<= z -8.2e+152)
t_1
(if (<= z -1.7e+135)
(* (/ y z) x)
(if (<= z -6.6e+66)
t_1
(if (<= z 6.6e+43) (* x (- (/ y z) t)) (/ (* t x) z)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double tmp;
if (z <= -8.2e+152) {
tmp = t_1;
} else if (z <= -1.7e+135) {
tmp = (y / z) * x;
} else if (z <= -6.6e+66) {
tmp = t_1;
} else if (z <= 6.6e+43) {
tmp = x * ((y / z) - 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) :: t_1
real(8) :: tmp
t_1 = x * (t / z)
if (z <= (-8.2d+152)) then
tmp = t_1
else if (z <= (-1.7d+135)) then
tmp = (y / z) * x
else if (z <= (-6.6d+66)) then
tmp = t_1
else if (z <= 6.6d+43) then
tmp = x * ((y / z) - 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 t_1 = x * (t / z);
double tmp;
if (z <= -8.2e+152) {
tmp = t_1;
} else if (z <= -1.7e+135) {
tmp = (y / z) * x;
} else if (z <= -6.6e+66) {
tmp = t_1;
} else if (z <= 6.6e+43) {
tmp = x * ((y / z) - t);
} else {
tmp = (t * x) / z;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / z) tmp = 0 if z <= -8.2e+152: tmp = t_1 elif z <= -1.7e+135: tmp = (y / z) * x elif z <= -6.6e+66: tmp = t_1 elif z <= 6.6e+43: tmp = x * ((y / z) - t) else: tmp = (t * x) / z return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / z)) tmp = 0.0 if (z <= -8.2e+152) tmp = t_1; elseif (z <= -1.7e+135) tmp = Float64(Float64(y / z) * x); elseif (z <= -6.6e+66) tmp = t_1; elseif (z <= 6.6e+43) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(Float64(t * x) / z); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / z); tmp = 0.0; if (z <= -8.2e+152) tmp = t_1; elseif (z <= -1.7e+135) tmp = (y / z) * x; elseif (z <= -6.6e+66) tmp = t_1; elseif (z <= 6.6e+43) tmp = x * ((y / z) - t); else tmp = (t * x) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8.2e+152], t$95$1, If[LessEqual[z, -1.7e+135], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, -6.6e+66], t$95$1, If[LessEqual[z, 6.6e+43], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[(t * x), $MachinePrecision] / z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
\mathbf{if}\;z \leq -8.2 \cdot 10^{+152}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.7 \cdot 10^{+135}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{elif}\;z \leq -6.6 \cdot 10^{+66}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{+43}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t \cdot x}{z}\\
\end{array}
\end{array}
if z < -8.1999999999999996e152 or -1.70000000000000005e135 < z < -6.6000000000000003e66Initial program 99.7%
Taylor expanded in y around 0 59.8%
associate-*r/59.8%
associate-*r*59.8%
neg-mul-159.8%
associate-*l/68.2%
*-commutative68.2%
neg-mul-168.2%
*-commutative68.2%
associate-*r/68.1%
metadata-eval68.1%
associate-/r*68.1%
neg-mul-168.1%
associate-*r/68.2%
*-rgt-identity68.2%
neg-sub068.2%
associate--r-68.2%
metadata-eval68.2%
Simplified68.2%
Taylor expanded in z around inf 68.2%
if -8.1999999999999996e152 < z < -1.70000000000000005e135Initial program 100.0%
Taylor expanded in y around inf 84.5%
associate-*l/100.0%
Simplified100.0%
if -6.6000000000000003e66 < z < 6.6000000000000003e43Initial program 94.6%
Taylor expanded in z around 0 88.0%
associate-*l/86.2%
associate-*r*86.2%
neg-mul-186.2%
distribute-rgt-out91.1%
unsub-neg91.1%
Simplified91.1%
if 6.6000000000000003e43 < z Initial program 93.3%
Taylor expanded in y around 0 60.0%
associate-*r/60.0%
associate-*r*60.0%
neg-mul-160.0%
associate-*l/58.6%
*-commutative58.6%
neg-mul-158.6%
*-commutative58.6%
associate-*r/58.5%
metadata-eval58.5%
associate-/r*58.5%
neg-mul-158.5%
associate-*r/58.6%
*-rgt-identity58.6%
neg-sub058.6%
associate--r-58.6%
metadata-eval58.6%
Simplified58.6%
Taylor expanded in z around inf 60.0%
Final simplification80.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.9e+128) (not (<= t 2.1e+105))) (* x (/ t (+ z -1.0))) (/ x (/ z y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.9e+128) || !(t <= 2.1e+105)) {
tmp = x * (t / (z + -1.0));
} 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 ((t <= (-1.9d+128)) .or. (.not. (t <= 2.1d+105))) then
tmp = x * (t / (z + (-1.0d0)))
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 ((t <= -1.9e+128) || !(t <= 2.1e+105)) {
tmp = x * (t / (z + -1.0));
} else {
tmp = x / (z / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.9e+128) or not (t <= 2.1e+105): tmp = x * (t / (z + -1.0)) else: tmp = x / (z / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.9e+128) || !(t <= 2.1e+105)) tmp = Float64(x * Float64(t / Float64(z + -1.0))); else tmp = Float64(x / Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.9e+128) || ~((t <= 2.1e+105))) tmp = x * (t / (z + -1.0)); else tmp = x / (z / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.9e+128], N[Not[LessEqual[t, 2.1e+105]], $MachinePrecision]], N[(x * N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.9 \cdot 10^{+128} \lor \neg \left(t \leq 2.1 \cdot 10^{+105}\right):\\
\;\;\;\;x \cdot \frac{t}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\end{array}
\end{array}
if t < -1.89999999999999995e128 or 2.1000000000000001e105 < t Initial program 96.3%
Taylor expanded in y around 0 70.8%
associate-*r/70.8%
associate-*r*70.8%
neg-mul-170.8%
associate-*l/78.4%
*-commutative78.4%
neg-mul-178.4%
*-commutative78.4%
associate-*r/78.4%
metadata-eval78.4%
associate-/r*78.4%
neg-mul-178.4%
associate-*r/78.4%
*-rgt-identity78.4%
neg-sub078.4%
associate--r-78.4%
metadata-eval78.4%
Simplified78.4%
if -1.89999999999999995e128 < t < 2.1000000000000001e105Initial program 95.0%
Taylor expanded in z around inf 80.6%
*-commutative80.6%
associate-/l*81.2%
neg-mul-181.2%
Simplified81.2%
Taylor expanded in y around inf 83.5%
Final simplification81.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.55e+22) (not (<= z 1.0))) (* (/ x z) (+ y t)) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.55e+22) || !(z <= 1.0)) {
tmp = (x / z) * (y + t);
} 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.55d+22)) .or. (.not. (z <= 1.0d0))) then
tmp = (x / z) * (y + t)
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.55e+22) || !(z <= 1.0)) {
tmp = (x / z) * (y + t);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.55e+22) or not (z <= 1.0): tmp = (x / z) * (y + t) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.55e+22) || !(z <= 1.0)) tmp = Float64(Float64(x / z) * Float64(y + t)); 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.55e+22) || ~((z <= 1.0))) tmp = (x / z) * (y + t); else tmp = x * ((y / z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.55e+22], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] * N[(y + t), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{+22} \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{x}{z} \cdot \left(y + t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -1.5500000000000001e22 or 1 < z Initial program 97.0%
Taylor expanded in z around inf 87.4%
*-commutative87.4%
associate-/l*96.7%
associate-/r/89.6%
cancel-sign-sub-inv89.6%
metadata-eval89.6%
*-lft-identity89.6%
Simplified89.6%
if -1.5500000000000001e22 < z < 1Initial program 93.9%
Taylor expanded in z around 0 91.6%
associate-*l/88.2%
associate-*r*88.2%
neg-mul-188.2%
distribute-rgt-out93.6%
unsub-neg93.6%
Simplified93.6%
Final simplification91.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.55e+22) (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.55e+22) || !(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.55d+22)) .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.55e+22) || !(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.55e+22) 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.55e+22) || !(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.55e+22) || ~((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.55e+22], 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.55 \cdot 10^{+22} \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.5500000000000001e22 or 1 < z Initial program 97.0%
Taylor expanded in z around inf 87.4%
associate-/l*88.8%
associate-/r/96.9%
cancel-sign-sub-inv96.9%
metadata-eval96.9%
*-lft-identity96.9%
Simplified96.9%
if -1.5500000000000001e22 < z < 1Initial program 93.9%
Taylor expanded in z around 0 91.6%
associate-*l/88.2%
associate-*r*88.2%
neg-mul-188.2%
distribute-rgt-out93.6%
unsub-neg93.6%
Simplified93.6%
Final simplification95.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.4e-47) (not (<= z 2.9e+18))) (* x (/ t z)) (* t (- x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.4e-47) || !(z <= 2.9e+18)) {
tmp = x * (t / z);
} else {
tmp = t * -x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-3.4d-47)) .or. (.not. (z <= 2.9d+18))) then
tmp = x * (t / z)
else
tmp = t * -x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.4e-47) || !(z <= 2.9e+18)) {
tmp = x * (t / z);
} else {
tmp = t * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.4e-47) or not (z <= 2.9e+18): tmp = x * (t / z) else: tmp = t * -x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.4e-47) || !(z <= 2.9e+18)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(t * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.4e-47) || ~((z <= 2.9e+18))) tmp = x * (t / z); else tmp = t * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.4e-47], N[Not[LessEqual[z, 2.9e+18]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(t * (-x)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.4 \cdot 10^{-47} \lor \neg \left(z \leq 2.9 \cdot 10^{+18}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(-x\right)\\
\end{array}
\end{array}
if z < -3.4000000000000002e-47 or 2.9e18 < z Initial program 96.5%
Taylor expanded in y around 0 52.6%
associate-*r/52.6%
associate-*r*52.6%
neg-mul-152.6%
associate-*l/54.5%
*-commutative54.5%
neg-mul-154.5%
*-commutative54.5%
associate-*r/54.4%
metadata-eval54.4%
associate-/r*54.4%
neg-mul-154.4%
associate-*r/54.5%
*-rgt-identity54.5%
neg-sub054.5%
associate--r-54.5%
metadata-eval54.5%
Simplified54.5%
Taylor expanded in z around inf 54.5%
if -3.4000000000000002e-47 < z < 2.9e18Initial program 94.1%
Taylor expanded in y around 0 28.5%
associate-*r/28.5%
associate-*r*28.5%
neg-mul-128.5%
associate-*l/28.5%
*-commutative28.5%
neg-mul-128.5%
*-commutative28.5%
associate-*r/28.5%
metadata-eval28.5%
associate-/r*28.5%
neg-mul-128.5%
associate-*r/28.5%
*-rgt-identity28.5%
neg-sub028.5%
associate--r-28.5%
metadata-eval28.5%
Simplified28.5%
Taylor expanded in z around 0 28.2%
mul-1-neg28.2%
Simplified28.2%
Final simplification42.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.7e+128) (not (<= t 1.3e+173))) (* x (/ t z)) (* y (/ x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.7e+128) || !(t <= 1.3e+173)) {
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 <= (-1.7d+128)) .or. (.not. (t <= 1.3d+173))) 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 <= -1.7e+128) || !(t <= 1.3e+173)) {
tmp = x * (t / z);
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.7e+128) or not (t <= 1.3e+173): tmp = x * (t / z) else: tmp = y * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.7e+128) || !(t <= 1.3e+173)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.7e+128) || ~((t <= 1.3e+173))) tmp = x * (t / z); else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.7e+128], N[Not[LessEqual[t, 1.3e+173]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.7 \cdot 10^{+128} \lor \neg \left(t \leq 1.3 \cdot 10^{+173}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if t < -1.6999999999999999e128 or 1.2999999999999999e173 < t Initial program 95.7%
Taylor expanded in y around 0 68.6%
associate-*r/68.6%
associate-*r*68.6%
neg-mul-168.6%
associate-*l/78.8%
*-commutative78.8%
neg-mul-178.8%
*-commutative78.8%
associate-*r/78.8%
metadata-eval78.8%
associate-/r*78.8%
neg-mul-178.8%
associate-*r/78.8%
*-rgt-identity78.8%
neg-sub078.8%
associate--r-78.8%
metadata-eval78.8%
Simplified78.8%
Taylor expanded in z around inf 62.2%
if -1.6999999999999999e128 < t < 1.2999999999999999e173Initial program 95.4%
Taylor expanded in z around inf 78.7%
*-commutative78.7%
associate-/l*79.8%
neg-mul-179.8%
Simplified79.8%
Taylor expanded in z around 0 79.8%
Taylor expanded in y around inf 77.9%
associate-*r/76.5%
Simplified76.5%
Final simplification72.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.8e+128) (not (<= t 7.5e+170))) (* x (/ t z)) (* (/ y z) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.8e+128) || !(t <= 7.5e+170)) {
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.8d+128)) .or. (.not. (t <= 7.5d+170))) 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.8e+128) || !(t <= 7.5e+170)) {
tmp = x * (t / z);
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.8e+128) or not (t <= 7.5e+170): tmp = x * (t / z) else: tmp = (y / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.8e+128) || !(t <= 7.5e+170)) 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.8e+128) || ~((t <= 7.5e+170))) tmp = x * (t / z); else tmp = (y / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.8e+128], N[Not[LessEqual[t, 7.5e+170]], $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.8 \cdot 10^{+128} \lor \neg \left(t \leq 7.5 \cdot 10^{+170}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if t < -1.80000000000000014e128 or 7.5000000000000002e170 < t Initial program 95.7%
Taylor expanded in y around 0 68.6%
associate-*r/68.6%
associate-*r*68.6%
neg-mul-168.6%
associate-*l/78.8%
*-commutative78.8%
neg-mul-178.8%
*-commutative78.8%
associate-*r/78.8%
metadata-eval78.8%
associate-/r*78.8%
neg-mul-178.8%
associate-*r/78.8%
*-rgt-identity78.8%
neg-sub078.8%
associate--r-78.8%
metadata-eval78.8%
Simplified78.8%
Taylor expanded in z around inf 62.2%
if -1.80000000000000014e128 < t < 7.5000000000000002e170Initial program 95.4%
Taylor expanded in y around inf 77.9%
associate-*l/81.0%
Simplified81.0%
Final simplification76.0%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2e+128) (not (<= t 1.4e+170))) (* x (/ t z)) (/ x (/ z y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2e+128) || !(t <= 1.4e+170)) {
tmp = x * (t / z);
} 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 ((t <= (-2d+128)) .or. (.not. (t <= 1.4d+170))) then
tmp = x * (t / z)
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 ((t <= -2e+128) || !(t <= 1.4e+170)) {
tmp = x * (t / z);
} else {
tmp = x / (z / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2e+128) or not (t <= 1.4e+170): tmp = x * (t / z) else: tmp = x / (z / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2e+128) || !(t <= 1.4e+170)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(x / Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2e+128) || ~((t <= 1.4e+170))) tmp = x * (t / z); else tmp = x / (z / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2e+128], N[Not[LessEqual[t, 1.4e+170]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2 \cdot 10^{+128} \lor \neg \left(t \leq 1.4 \cdot 10^{+170}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\end{array}
\end{array}
if t < -2.0000000000000002e128 or 1.40000000000000008e170 < t Initial program 95.7%
Taylor expanded in y around 0 68.6%
associate-*r/68.6%
associate-*r*68.6%
neg-mul-168.6%
associate-*l/78.8%
*-commutative78.8%
neg-mul-178.8%
*-commutative78.8%
associate-*r/78.8%
metadata-eval78.8%
associate-/r*78.8%
neg-mul-178.8%
associate-*r/78.8%
*-rgt-identity78.8%
neg-sub078.8%
associate--r-78.8%
metadata-eval78.8%
Simplified78.8%
Taylor expanded in z around inf 62.2%
if -2.0000000000000002e128 < t < 1.40000000000000008e170Initial program 95.4%
Taylor expanded in z around inf 78.7%
*-commutative78.7%
associate-/l*79.8%
neg-mul-179.8%
Simplified79.8%
Taylor expanded in y around inf 81.6%
Final simplification76.4%
(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 95.4%
Taylor expanded in y around 0 41.7%
associate-*r/41.7%
associate-*r*41.7%
neg-mul-141.7%
associate-*l/42.7%
*-commutative42.7%
neg-mul-142.7%
*-commutative42.7%
associate-*r/42.7%
metadata-eval42.7%
associate-/r*42.7%
neg-mul-142.7%
associate-*r/42.7%
*-rgt-identity42.7%
neg-sub042.7%
associate--r-42.7%
metadata-eval42.7%
Simplified42.7%
Taylor expanded in z around 0 20.0%
mul-1-neg20.0%
Simplified20.0%
Final simplification20.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 2023176
(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)))))