
(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 5e+284) (* t_1 x) (* y (/ x z)))))
double code(double x, double y, double z, double t) {
double t_1 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_1 <= 5e+284) {
tmp = t_1 * x;
} 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) :: t_1
real(8) :: tmp
t_1 = (y / z) - (t / (1.0d0 - z))
if (t_1 <= 5d+284) then
tmp = t_1 * x
else
tmp = y * (x / z)
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 <= 5e+284) {
tmp = t_1 * x;
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / z) - (t / (1.0 - z)) tmp = 0 if t_1 <= 5e+284: tmp = t_1 * x else: tmp = y * (x / z) 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 <= 5e+284) tmp = Float64(t_1 * x); else tmp = Float64(y * Float64(x / z)); 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 <= 5e+284) tmp = t_1 * x; else tmp = y * (x / z); 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, 5e+284], N[(t$95$1 * x), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} - \frac{t}{1 - z}\\
\mathbf{if}\;t_1 \leq 5 \cdot 10^{+284}:\\
\;\;\;\;t_1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 4.9999999999999999e284Initial program 97.0%
if 4.9999999999999999e284 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) Initial program 69.5%
Taylor expanded in z around inf 67.3%
*-commutative67.3%
associate-/l*49.2%
neg-mul-149.2%
Simplified49.2%
Taylor expanded in y around inf 99.9%
associate-*r/100.0%
Simplified100.0%
Final simplification97.1%
(FPCore (x y z t)
:precision binary64
(if (<= t -1.5e+94)
(* y (/ x z))
(if (<= t 5.5e+122)
(* (/ y z) x)
(if (<= t 3.6e+203) (* x (- t)) (* x (/ t z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.5e+94) {
tmp = y * (x / z);
} else if (t <= 5.5e+122) {
tmp = (y / z) * x;
} else if (t <= 3.6e+203) {
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 (t <= (-1.5d+94)) then
tmp = y * (x / z)
else if (t <= 5.5d+122) then
tmp = (y / z) * x
else if (t <= 3.6d+203) 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 (t <= -1.5e+94) {
tmp = y * (x / z);
} else if (t <= 5.5e+122) {
tmp = (y / z) * x;
} else if (t <= 3.6e+203) {
tmp = x * -t;
} else {
tmp = x * (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.5e+94: tmp = y * (x / z) elif t <= 5.5e+122: tmp = (y / z) * x elif t <= 3.6e+203: tmp = x * -t else: tmp = x * (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.5e+94) tmp = Float64(y * Float64(x / z)); elseif (t <= 5.5e+122) tmp = Float64(Float64(y / z) * x); elseif (t <= 3.6e+203) 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 (t <= -1.5e+94) tmp = y * (x / z); elseif (t <= 5.5e+122) tmp = (y / z) * x; elseif (t <= 3.6e+203) tmp = x * -t; else tmp = x * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.5e+94], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.5e+122], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t, 3.6e+203], N[(x * (-t)), $MachinePrecision], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.5 \cdot 10^{+94}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;t \leq 5.5 \cdot 10^{+122}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{elif}\;t \leq 3.6 \cdot 10^{+203}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\end{array}
\end{array}
if t < -1.5e94Initial program 90.7%
Taylor expanded in z around inf 52.9%
*-commutative52.9%
associate-/l*55.1%
neg-mul-155.1%
Simplified55.1%
Taylor expanded in y around inf 50.3%
associate-*r/52.7%
Simplified52.7%
if -1.5e94 < t < 5.4999999999999998e122Initial program 95.3%
Taylor expanded in y around inf 76.8%
associate-*l/79.0%
Simplified79.0%
if 5.4999999999999998e122 < t < 3.59999999999999982e203Initial program 99.8%
Taylor expanded in y around 0 89.0%
mul-1-neg89.0%
associate-/l*82.8%
associate-/r/88.9%
distribute-rgt-neg-in88.9%
Simplified88.9%
Taylor expanded in z around 0 71.5%
mul-1-neg71.5%
distribute-lft-neg-out71.5%
*-commutative71.5%
Simplified71.5%
if 3.59999999999999982e203 < t Initial program 99.7%
Taylor expanded in z around inf 69.0%
sub-neg69.0%
remove-double-neg69.0%
neg-mul-169.0%
distribute-neg-in69.0%
neg-mul-169.0%
sub-neg69.0%
distribute-lft-neg-in69.0%
distribute-neg-frac69.0%
associate-/l*55.3%
associate-/r/78.9%
distribute-lft-neg-in78.9%
Simplified78.9%
Taylor expanded in y around 0 72.2%
Final simplification73.5%
(FPCore (x y z t)
:precision binary64
(if (<= z -6.2e+29)
(* x (* y (/ 1.0 z)))
(if (<= z 5e+53)
(* x (- (/ y z) t))
(if (<= z 3.8e+206) (/ x (/ z t)) (* (/ y z) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -6.2e+29) {
tmp = x * (y * (1.0 / z));
} else if (z <= 5e+53) {
tmp = x * ((y / z) - t);
} else if (z <= 3.8e+206) {
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 (z <= (-6.2d+29)) then
tmp = x * (y * (1.0d0 / z))
else if (z <= 5d+53) then
tmp = x * ((y / z) - t)
else if (z <= 3.8d+206) 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 (z <= -6.2e+29) {
tmp = x * (y * (1.0 / z));
} else if (z <= 5e+53) {
tmp = x * ((y / z) - t);
} else if (z <= 3.8e+206) {
tmp = x / (z / t);
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -6.2e+29: tmp = x * (y * (1.0 / z)) elif z <= 5e+53: tmp = x * ((y / z) - t) elif z <= 3.8e+206: tmp = x / (z / t) else: tmp = (y / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -6.2e+29) tmp = Float64(x * Float64(y * Float64(1.0 / z))); elseif (z <= 5e+53) tmp = Float64(x * Float64(Float64(y / z) - t)); elseif (z <= 3.8e+206) 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 (z <= -6.2e+29) tmp = x * (y * (1.0 / z)); elseif (z <= 5e+53) tmp = x * ((y / z) - t); elseif (z <= 3.8e+206) tmp = x / (z / t); else tmp = (y / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -6.2e+29], N[(x * N[(y * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5e+53], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.8e+206], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.2 \cdot 10^{+29}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{1}{z}\right)\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+53}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{+206}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if z < -6.1999999999999998e29Initial program 97.6%
Taylor expanded in y around inf 68.6%
div-inv68.7%
*-commutative68.7%
associate-*l*70.7%
Applied egg-rr70.7%
if -6.1999999999999998e29 < z < 5.0000000000000004e53Initial program 94.2%
Taylor expanded in z around 0 86.9%
associate-*l/85.1%
associate-*r*85.1%
neg-mul-185.1%
distribute-rgt-out88.4%
unsub-neg88.4%
Simplified88.4%
if 5.0000000000000004e53 < z < 3.7999999999999999e206Initial program 96.9%
Taylor expanded in z around inf 92.2%
*-commutative92.2%
associate-/l*96.9%
neg-mul-196.9%
Simplified96.9%
Taylor expanded in y around 0 63.6%
if 3.7999999999999999e206 < z Initial program 95.5%
Taylor expanded in y around inf 72.8%
associate-*l/77.2%
Simplified77.2%
Final simplification80.6%
(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 97.3%
Taylor expanded in z around inf 89.4%
sub-neg89.4%
remove-double-neg89.4%
neg-mul-189.4%
distribute-neg-in89.4%
neg-mul-189.4%
sub-neg89.4%
distribute-lft-neg-in89.4%
distribute-neg-frac89.4%
associate-/l*79.7%
associate-/r/95.6%
distribute-lft-neg-in95.6%
Simplified95.6%
if -1 < z < 1Initial program 93.6%
Taylor expanded in z around 0 91.8%
associate-*l/89.0%
associate-*r*89.0%
neg-mul-189.0%
distribute-rgt-out92.7%
unsub-neg92.7%
Simplified92.7%
Final simplification94.1%
(FPCore (x y z t) :precision binary64 (if (<= z -1.0) (* x (/ (+ y t) z)) (if (<= z 1.0) (* x (- (/ y z) t)) (/ x (/ z (+ y t))))))
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 / (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.0d0)) then
tmp = x * ((y + t) / z)
else if (z <= 1.0d0) 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.0) {
tmp = x * ((y + t) / z);
} else if (z <= 1.0) {
tmp = x * ((y / z) - t);
} else {
tmp = x / (z / (y + t));
}
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 / (z / (y + t)) 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(z / Float64(y + t))); 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 / (z / (y + t)); 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[(z / N[(y + t), $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}:\\
\;\;\;\;\frac{x}{\frac{z}{y + t}}\\
\end{array}
\end{array}
if z < -1Initial program 97.8%
Taylor expanded in z around inf 89.4%
sub-neg89.4%
remove-double-neg89.4%
neg-mul-189.4%
distribute-neg-in89.4%
neg-mul-189.4%
sub-neg89.4%
distribute-lft-neg-in89.4%
distribute-neg-frac89.4%
associate-/l*77.1%
associate-/r/94.8%
distribute-lft-neg-in94.8%
Simplified94.8%
if -1 < z < 1Initial program 93.6%
Taylor expanded in z around 0 91.8%
associate-*l/89.0%
associate-*r*89.0%
neg-mul-189.0%
distribute-rgt-out92.7%
unsub-neg92.7%
Simplified92.7%
if 1 < z Initial program 96.9%
Taylor expanded in z around inf 89.4%
*-commutative89.4%
associate-/l*96.2%
neg-mul-196.2%
Simplified96.2%
Taylor expanded in z around 0 96.2%
Final simplification94.1%
(FPCore (x y z t) :precision binary64 (if (<= z -1.02) (* x (* (+ y t) (/ 1.0 z))) (if (<= z 1.0) (* x (- (/ y z) t)) (/ x (/ z (+ y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.02) {
tmp = x * ((y + t) * (1.0 / z));
} else if (z <= 1.0) {
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.02d0)) then
tmp = x * ((y + t) * (1.0d0 / z))
else if (z <= 1.0d0) 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.02) {
tmp = x * ((y + t) * (1.0 / z));
} else if (z <= 1.0) {
tmp = x * ((y / z) - t);
} else {
tmp = x / (z / (y + t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.02: tmp = x * ((y + t) * (1.0 / z)) elif z <= 1.0: 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.02) tmp = Float64(x * Float64(Float64(y + t) * Float64(1.0 / z))); elseif (z <= 1.0) 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.02) tmp = x * ((y + t) * (1.0 / z)); elseif (z <= 1.0) 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.02], N[(x * N[(N[(y + t), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], 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.02:\\
\;\;\;\;x \cdot \left(\left(y + t\right) \cdot \frac{1}{z}\right)\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y + t}}\\
\end{array}
\end{array}
if z < -1.02Initial program 97.8%
Taylor expanded in z around inf 89.4%
sub-neg89.4%
remove-double-neg89.4%
neg-mul-189.4%
distribute-neg-in89.4%
neg-mul-189.4%
sub-neg89.4%
distribute-lft-neg-in89.4%
distribute-neg-frac89.4%
associate-/l*77.1%
associate-/r/94.8%
distribute-lft-neg-in94.8%
Simplified94.8%
div-inv94.9%
Applied egg-rr94.9%
if -1.02 < z < 1Initial program 93.6%
Taylor expanded in z around 0 91.8%
associate-*l/89.0%
associate-*r*89.0%
neg-mul-189.0%
distribute-rgt-out92.7%
unsub-neg92.7%
Simplified92.7%
if 1 < z Initial program 96.9%
Taylor expanded in z around inf 89.4%
*-commutative89.4%
associate-/l*96.2%
neg-mul-196.2%
Simplified96.2%
Taylor expanded in z around 0 96.2%
Final simplification94.1%
(FPCore (x y z t) :precision binary64 (if (<= t 1.3e+122) (* y (/ x z)) (if (<= t 7e+202) (* x (- t)) (* x (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.3e+122) {
tmp = y * (x / z);
} else if (t <= 7e+202) {
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 (t <= 1.3d+122) then
tmp = y * (x / z)
else if (t <= 7d+202) 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 (t <= 1.3e+122) {
tmp = y * (x / z);
} else if (t <= 7e+202) {
tmp = x * -t;
} else {
tmp = x * (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 1.3e+122: tmp = y * (x / z) elif t <= 7e+202: tmp = x * -t else: tmp = x * (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 1.3e+122) tmp = Float64(y * Float64(x / z)); elseif (t <= 7e+202) 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 (t <= 1.3e+122) tmp = y * (x / z); elseif (t <= 7e+202) tmp = x * -t; else tmp = x * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.3e+122], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7e+202], N[(x * (-t)), $MachinePrecision], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.3 \cdot 10^{+122}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;t \leq 7 \cdot 10^{+202}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\end{array}
\end{array}
if t < 1.30000000000000004e122Initial program 94.4%
Taylor expanded in z around inf 70.1%
*-commutative70.1%
associate-/l*70.4%
neg-mul-170.4%
Simplified70.4%
Taylor expanded in y around inf 71.7%
associate-*r/67.6%
Simplified67.6%
if 1.30000000000000004e122 < t < 6.99999999999999975e202Initial program 99.8%
Taylor expanded in y around 0 89.0%
mul-1-neg89.0%
associate-/l*82.8%
associate-/r/88.9%
distribute-rgt-neg-in88.9%
Simplified88.9%
Taylor expanded in z around 0 71.5%
mul-1-neg71.5%
distribute-lft-neg-out71.5%
*-commutative71.5%
Simplified71.5%
if 6.99999999999999975e202 < t Initial program 99.7%
Taylor expanded in z around inf 69.0%
sub-neg69.0%
remove-double-neg69.0%
neg-mul-169.0%
distribute-neg-in69.0%
neg-mul-169.0%
sub-neg69.0%
distribute-lft-neg-in69.0%
distribute-neg-frac69.0%
associate-/l*55.3%
associate-/r/78.9%
distribute-lft-neg-in78.9%
Simplified78.9%
Taylor expanded in y around 0 72.2%
Final simplification68.4%
(FPCore (x y z t) :precision binary64 (if (<= t 1.3e+120) (/ x (/ z y)) (if (<= t 5.8e+203) (* x (- t)) (* x (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.3e+120) {
tmp = x / (z / y);
} else if (t <= 5.8e+203) {
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 (t <= 1.3d+120) then
tmp = x / (z / y)
else if (t <= 5.8d+203) 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 (t <= 1.3e+120) {
tmp = x / (z / y);
} else if (t <= 5.8e+203) {
tmp = x * -t;
} else {
tmp = x * (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 1.3e+120: tmp = x / (z / y) elif t <= 5.8e+203: tmp = x * -t else: tmp = x * (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 1.3e+120) tmp = Float64(x / Float64(z / y)); elseif (t <= 5.8e+203) 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 (t <= 1.3e+120) tmp = x / (z / y); elseif (t <= 5.8e+203) tmp = x * -t; else tmp = x * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.3e+120], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.8e+203], N[(x * (-t)), $MachinePrecision], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.3 \cdot 10^{+120}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{elif}\;t \leq 5.8 \cdot 10^{+203}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\end{array}
\end{array}
if t < 1.2999999999999999e120Initial program 94.4%
Taylor expanded in z around inf 70.1%
*-commutative70.1%
associate-/l*70.4%
neg-mul-170.4%
Simplified70.4%
Taylor expanded in y around inf 72.0%
if 1.2999999999999999e120 < t < 5.80000000000000021e203Initial program 99.8%
Taylor expanded in y around 0 89.0%
mul-1-neg89.0%
associate-/l*82.8%
associate-/r/88.9%
distribute-rgt-neg-in88.9%
Simplified88.9%
Taylor expanded in z around 0 71.5%
mul-1-neg71.5%
distribute-lft-neg-out71.5%
*-commutative71.5%
Simplified71.5%
if 5.80000000000000021e203 < t Initial program 99.7%
Taylor expanded in z around inf 69.0%
sub-neg69.0%
remove-double-neg69.0%
neg-mul-169.0%
distribute-neg-in69.0%
neg-mul-169.0%
sub-neg69.0%
distribute-lft-neg-in69.0%
distribute-neg-frac69.0%
associate-/l*55.3%
associate-/r/78.9%
distribute-lft-neg-in78.9%
Simplified78.9%
Taylor expanded in y around 0 72.2%
Final simplification72.0%
(FPCore (x y z t) :precision binary64 (if (<= t 3.8e+122) (* y (/ x z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 3.8e+122) {
tmp = y * (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 (t <= 3.8d+122) then
tmp = y * (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 (t <= 3.8e+122) {
tmp = y * (x / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 3.8e+122: tmp = y * (x / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 3.8e+122) tmp = Float64(y * 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 (t <= 3.8e+122) tmp = y * (x / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 3.8e+122], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 3.8 \cdot 10^{+122}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if t < 3.7999999999999998e122Initial program 94.4%
Taylor expanded in z around inf 70.1%
*-commutative70.1%
associate-/l*70.4%
neg-mul-170.4%
Simplified70.4%
Taylor expanded in y around inf 71.7%
associate-*r/67.6%
Simplified67.6%
if 3.7999999999999998e122 < t Initial program 99.7%
Taylor expanded in y around 0 85.1%
mul-1-neg85.1%
associate-/l*74.3%
associate-/r/89.2%
distribute-rgt-neg-in89.2%
Simplified89.2%
Taylor expanded in z around 0 44.1%
mul-1-neg44.1%
distribute-lft-neg-out44.1%
*-commutative44.1%
Simplified44.1%
Final simplification63.5%
(FPCore (x y z t) :precision binary64 (* x (- t)))
double code(double x, double y, double z, double t) {
return x * -t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * -t
end function
public static double code(double x, double y, double z, double t) {
return x * -t;
}
def code(x, y, z, t): return x * -t
function code(x, y, z, t) return Float64(x * Float64(-t)) end
function tmp = code(x, y, z, t) tmp = x * -t; end
code[x_, y_, z_, t_] := N[(x * (-t)), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(-t\right)
\end{array}
Initial program 95.4%
Taylor expanded in y around 0 45.3%
mul-1-neg45.3%
associate-/l*44.1%
associate-/r/46.4%
distribute-rgt-neg-in46.4%
Simplified46.4%
Taylor expanded in z around 0 25.6%
mul-1-neg25.6%
distribute-lft-neg-out25.6%
*-commutative25.6%
Simplified25.6%
Final simplification25.6%
(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 2023199
(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)))))