
(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 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * ((y / z) - (t / (1.0d0 - z)))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
def code(x, y, z, t): return x * ((y / z) - (t / (1.0 - z)))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) - (t / (1.0 - z))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\end{array}
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (/ y z) (/ t (+ z -1.0)))))
(if (<= t_1 (- INFINITY))
(/ (* y x) z)
(if (<= t_1 2e+231)
(* t_1 x)
(/ (* x (- (* y (- 1.0 z)) (* z t))) (* z (- 1.0 z)))))))
double code(double x, double y, double z, double t) {
double t_1 = (y / z) + (t / (z + -1.0));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (y * x) / z;
} else if (t_1 <= 2e+231) {
tmp = t_1 * x;
} else {
tmp = (x * ((y * (1.0 - z)) - (z * t))) / (z * (1.0 - z));
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (y / z) + (t / (z + -1.0));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (y * x) / z;
} else if (t_1 <= 2e+231) {
tmp = t_1 * x;
} else {
tmp = (x * ((y * (1.0 - z)) - (z * t))) / (z * (1.0 - z));
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / z) + (t / (z + -1.0)) tmp = 0 if t_1 <= -math.inf: tmp = (y * x) / z elif t_1 <= 2e+231: tmp = t_1 * x else: tmp = (x * ((y * (1.0 - z)) - (z * t))) / (z * (1.0 - z)) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y / z) + Float64(t / Float64(z + -1.0))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(y * x) / z); elseif (t_1 <= 2e+231) tmp = Float64(t_1 * x); else tmp = Float64(Float64(x * Float64(Float64(y * Float64(1.0 - z)) - Float64(z * t))) / Float64(z * Float64(1.0 - z))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y / z) + (t / (z + -1.0)); tmp = 0.0; if (t_1 <= -Inf) tmp = (y * x) / z; elseif (t_1 <= 2e+231) tmp = t_1 * x; else tmp = (x * ((y * (1.0 - z)) - (z * t))) / (z * (1.0 - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / z), $MachinePrecision] + N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t$95$1, 2e+231], N[(t$95$1 * x), $MachinePrecision], N[(N[(x * N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} + \frac{t}{z + -1}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+231}:\\
\;\;\;\;t\_1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(y \cdot \left(1 - z\right) - z \cdot t\right)}{z \cdot \left(1 - z\right)}\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -inf.0Initial program 66.2%
Taylor expanded in y around inf 99.9%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 2.0000000000000001e231Initial program 97.9%
if 2.0000000000000001e231 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 86.0%
*-commutative86.0%
frac-sub86.0%
associate-*l/99.9%
Applied egg-rr99.9%
Final simplification98.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (/ y z) (/ t (+ z -1.0)))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 1e+308)))
(/ (* y x) z)
(* t_1 x))))
double code(double x, double y, double z, double t) {
double t_1 = (y / z) + (t / (z + -1.0));
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 1e+308)) {
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 / (z + -1.0));
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 1e+308)) {
tmp = (y * x) / z;
} else {
tmp = t_1 * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / z) + (t / (z + -1.0)) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 1e+308): 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(z + -1.0))) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 1e+308)) tmp = Float64(Float64(y * 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 / (z + -1.0)); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 1e+308))) 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[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 1e+308]], $MachinePrecision]], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision], N[(t$95$1 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} + \frac{t}{z + -1}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 10^{+308}\right):\\
\;\;\;\;\frac{y \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot x\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -inf.0 or 1e308 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 66.3%
Taylor expanded in y around inf 99.9%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 1e308Initial program 98.1%
Final simplification98.3%
(FPCore (x y z t) :precision binary64 (if (<= z -1.0) (* x (/ (+ y t) z)) (if (<= z 7.5e-11) (* x (- (/ y z) t)) (* x (- (/ y z) (* t (/ -1.0 z)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.0) {
tmp = x * ((y + t) / z);
} else if (z <= 7.5e-11) {
tmp = x * ((y / z) - t);
} else {
tmp = x * ((y / z) - (t * (-1.0 / z)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.0d0)) then
tmp = x * ((y + t) / z)
else if (z <= 7.5d-11) then
tmp = x * ((y / z) - t)
else
tmp = x * ((y / z) - (t * ((-1.0d0) / z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.0) {
tmp = x * ((y + t) / z);
} else if (z <= 7.5e-11) {
tmp = x * ((y / z) - t);
} else {
tmp = x * ((y / z) - (t * (-1.0 / z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.0: tmp = x * ((y + t) / z) elif z <= 7.5e-11: tmp = x * ((y / z) - t) else: tmp = x * ((y / z) - (t * (-1.0 / z))) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.0) tmp = Float64(x * Float64(Float64(y + t) / z)); elseif (z <= 7.5e-11) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(x * Float64(Float64(y / z) - Float64(t * Float64(-1.0 / z)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.0) tmp = x * ((y + t) / z); elseif (z <= 7.5e-11) tmp = x * ((y / z) - t); else tmp = x * ((y / z) - (t * (-1.0 / z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.0], N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.5e-11], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / z), $MachinePrecision] - N[(t * N[(-1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{-11}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t \cdot \frac{-1}{z}\right)\\
\end{array}
\end{array}
if z < -1Initial program 99.7%
Taylor expanded in z around inf 91.5%
associate-/l*98.2%
sub-neg98.2%
remove-double-neg98.2%
neg-mul-198.2%
distribute-rgt-neg-in98.2%
distribute-lft-in98.2%
neg-mul-198.2%
sub-neg98.2%
*-commutative98.2%
associate-*l/98.2%
*-commutative98.2%
associate-*r/98.2%
sub-neg98.2%
neg-mul-198.2%
distribute-lft-in98.2%
neg-mul-198.2%
remove-double-neg98.2%
neg-mul-198.2%
remove-double-neg98.2%
+-commutative98.2%
Simplified98.2%
if -1 < z < 7.5e-11Initial program 92.7%
Taylor expanded in z around 0 92.6%
if 7.5e-11 < z Initial program 94.2%
clear-num94.1%
associate-/r/94.3%
Applied egg-rr94.3%
Taylor expanded in z around inf 94.3%
Final simplification94.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 7.5e-11))) (* 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 <= 7.5e-11)) {
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 <= 7.5d-11))) 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 <= 7.5e-11)) {
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 <= 7.5e-11): 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 <= 7.5e-11)) 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 <= 7.5e-11))) 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, 7.5e-11]], $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 7.5 \cdot 10^{-11}\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 7.5e-11 < z Initial program 96.7%
Taylor expanded in z around inf 88.5%
associate-/l*96.0%
sub-neg96.0%
remove-double-neg96.0%
neg-mul-196.0%
distribute-rgt-neg-in96.0%
distribute-lft-in96.0%
neg-mul-196.0%
sub-neg96.0%
*-commutative96.0%
associate-*l/96.0%
*-commutative96.0%
associate-*r/96.0%
sub-neg96.0%
neg-mul-196.0%
distribute-lft-in96.0%
neg-mul-196.0%
remove-double-neg96.0%
neg-mul-196.0%
remove-double-neg96.0%
+-commutative96.0%
Simplified96.0%
if -1 < z < 7.5e-11Initial program 92.7%
Taylor expanded in z around 0 92.6%
Final simplification94.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -8e+144) (not (<= t 270000000000.0))) (* t (/ x (+ z -1.0))) (/ x (/ z y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -8e+144) || !(t <= 270000000000.0)) {
tmp = t * (x / (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 <= (-8d+144)) .or. (.not. (t <= 270000000000.0d0))) then
tmp = t * (x / (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 <= -8e+144) || !(t <= 270000000000.0)) {
tmp = t * (x / (z + -1.0));
} else {
tmp = x / (z / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -8e+144) or not (t <= 270000000000.0): tmp = t * (x / (z + -1.0)) else: tmp = x / (z / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -8e+144) || !(t <= 270000000000.0)) tmp = Float64(t * Float64(x / 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 <= -8e+144) || ~((t <= 270000000000.0))) tmp = t * (x / (z + -1.0)); else tmp = x / (z / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -8e+144], N[Not[LessEqual[t, 270000000000.0]], $MachinePrecision]], N[(t * N[(x / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{+144} \lor \neg \left(t \leq 270000000000\right):\\
\;\;\;\;t \cdot \frac{x}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\end{array}
\end{array}
if t < -8.00000000000000019e144 or 2.7e11 < t Initial program 94.1%
Taylor expanded in y around 0 70.9%
mul-1-neg70.9%
associate-/l*73.7%
distribute-rgt-neg-in73.7%
distribute-neg-frac273.7%
neg-sub073.7%
associate--r-73.7%
metadata-eval73.7%
Simplified73.7%
if -8.00000000000000019e144 < t < 2.7e11Initial program 95.0%
Taylor expanded in y around inf 78.2%
associate-*r/80.5%
Simplified80.5%
clear-num80.4%
un-div-inv80.7%
Applied egg-rr80.7%
Final simplification78.0%
(FPCore (x y z t) :precision binary64 (if (<= z -3.9e+107) (/ (* t x) z) (if (<= z 1.75e+48) (* x (- (/ y z) t)) (* y (/ x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.9e+107) {
tmp = (t * x) / z;
} else if (z <= 1.75e+48) {
tmp = x * ((y / z) - t);
} else {
tmp = y * (x / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-3.9d+107)) then
tmp = (t * x) / z
else if (z <= 1.75d+48) then
tmp = x * ((y / z) - t)
else
tmp = y * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.9e+107) {
tmp = (t * x) / z;
} else if (z <= 1.75e+48) {
tmp = x * ((y / z) - t);
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3.9e+107: tmp = (t * x) / z elif z <= 1.75e+48: tmp = x * ((y / z) - t) else: tmp = y * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3.9e+107) tmp = Float64(Float64(t * x) / z); elseif (z <= 1.75e+48) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3.9e+107) tmp = (t * x) / z; elseif (z <= 1.75e+48) tmp = x * ((y / z) - t); else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.9e+107], N[(N[(t * x), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 1.75e+48], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.9 \cdot 10^{+107}:\\
\;\;\;\;\frac{t \cdot x}{z}\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{+48}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if z < -3.8999999999999998e107Initial program 99.6%
Taylor expanded in z around inf 90.4%
neg-mul-190.4%
Simplified90.4%
Taylor expanded in y around 0 66.8%
*-commutative66.8%
Simplified66.8%
if -3.8999999999999998e107 < z < 1.7499999999999999e48Initial program 94.4%
Taylor expanded in z around 0 86.4%
if 1.7499999999999999e48 < z Initial program 92.5%
Taylor expanded in y around inf 59.2%
associate-/l*61.0%
*-un-lft-identity61.0%
associate-*l/61.1%
associate-*r*63.7%
un-div-inv63.8%
Applied egg-rr63.8%
Final simplification79.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -0.036) (not (<= z 9.5e-13))) (* t (/ x z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.036) || !(z <= 9.5e-13)) {
tmp = t * (x / z);
} else {
tmp = x * -t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-0.036d0)) .or. (.not. (z <= 9.5d-13))) then
tmp = t * (x / z)
else
tmp = x * -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.036) || !(z <= 9.5e-13)) {
tmp = t * (x / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -0.036) or not (z <= 9.5e-13): tmp = t * (x / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -0.036) || !(z <= 9.5e-13)) tmp = Float64(t * Float64(x / z)); else tmp = Float64(x * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -0.036) || ~((z <= 9.5e-13))) tmp = t * (x / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -0.036], N[Not[LessEqual[z, 9.5e-13]], $MachinePrecision]], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.036 \lor \neg \left(z \leq 9.5 \cdot 10^{-13}\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -0.0359999999999999973 or 9.49999999999999991e-13 < z Initial program 96.8%
Taylor expanded in z around inf 88.2%
neg-mul-188.2%
Simplified88.2%
Taylor expanded in y around 0 51.2%
associate-/l*51.1%
Simplified51.1%
if -0.0359999999999999973 < z < 9.49999999999999991e-13Initial program 92.6%
Taylor expanded in z around 0 92.5%
Taylor expanded in y around 0 38.8%
mul-1-neg38.8%
distribute-lft-neg-out38.8%
*-commutative38.8%
Simplified38.8%
Final simplification44.9%
(FPCore (x y z t) :precision binary64 (if (<= t -6.5e+111) (/ (* t x) z) (if (<= t 3.9e+95) (/ x (/ z y)) (* x (- t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -6.5e+111) {
tmp = (t * x) / z;
} else if (t <= 3.9e+95) {
tmp = x / (z / y);
} 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 <= (-6.5d+111)) then
tmp = (t * x) / z
else if (t <= 3.9d+95) then
tmp = x / (z / y)
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 <= -6.5e+111) {
tmp = (t * x) / z;
} else if (t <= 3.9e+95) {
tmp = x / (z / y);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -6.5e+111: tmp = (t * x) / z elif t <= 3.9e+95: tmp = x / (z / y) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -6.5e+111) tmp = Float64(Float64(t * x) / z); elseif (t <= 3.9e+95) tmp = Float64(x / Float64(z / y)); else tmp = Float64(x * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -6.5e+111) tmp = (t * x) / z; elseif (t <= 3.9e+95) tmp = x / (z / y); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -6.5e+111], N[(N[(t * x), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t, 3.9e+95], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.5 \cdot 10^{+111}:\\
\;\;\;\;\frac{t \cdot x}{z}\\
\mathbf{elif}\;t \leq 3.9 \cdot 10^{+95}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if t < -6.5000000000000002e111Initial program 92.9%
Taylor expanded in z around inf 61.0%
neg-mul-161.0%
Simplified61.0%
Taylor expanded in y around 0 51.6%
*-commutative51.6%
Simplified51.6%
if -6.5000000000000002e111 < t < 3.8999999999999997e95Initial program 94.7%
Taylor expanded in y around inf 77.1%
associate-*r/78.7%
Simplified78.7%
clear-num78.7%
un-div-inv78.9%
Applied egg-rr78.9%
if 3.8999999999999997e95 < t Initial program 95.8%
Taylor expanded in z around 0 60.0%
Taylor expanded in y around 0 48.1%
mul-1-neg48.1%
distribute-lft-neg-out48.1%
*-commutative48.1%
Simplified48.1%
Final simplification69.0%
(FPCore (x y z t) :precision binary64 (if (<= t -3.8e+147) (* t (/ x z)) (if (<= t 5.1e+95) (/ x (/ z y)) (* x (- t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.8e+147) {
tmp = t * (x / z);
} else if (t <= 5.1e+95) {
tmp = x / (z / y);
} 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+147)) then
tmp = t * (x / z)
else if (t <= 5.1d+95) then
tmp = x / (z / y)
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+147) {
tmp = t * (x / z);
} else if (t <= 5.1e+95) {
tmp = x / (z / y);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -3.8e+147: tmp = t * (x / z) elif t <= 5.1e+95: tmp = x / (z / y) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -3.8e+147) tmp = Float64(t * Float64(x / z)); elseif (t <= 5.1e+95) tmp = Float64(x / Float64(z / y)); 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+147) tmp = t * (x / z); elseif (t <= 5.1e+95) tmp = x / (z / y); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -3.8e+147], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.1e+95], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.8 \cdot 10^{+147}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{elif}\;t \leq 5.1 \cdot 10^{+95}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if t < -3.7999999999999997e147Initial program 91.2%
Taylor expanded in z around inf 60.7%
neg-mul-160.7%
Simplified60.7%
Taylor expanded in y around 0 51.7%
associate-/l*54.1%
Simplified54.1%
if -3.7999999999999997e147 < t < 5.10000000000000003e95Initial program 94.9%
Taylor expanded in y around inf 75.5%
associate-*r/77.0%
Simplified77.0%
clear-num77.0%
un-div-inv77.2%
Applied egg-rr77.2%
if 5.10000000000000003e95 < t Initial program 95.8%
Taylor expanded in z around 0 60.0%
Taylor expanded in y around 0 48.1%
mul-1-neg48.1%
distribute-lft-neg-out48.1%
*-commutative48.1%
Simplified48.1%
(FPCore (x y z t) :precision binary64 (if (<= t -1.55e+148) (* t (/ x z)) (if (<= t 2.3e+95) (* (/ y z) x) (* x (- t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.55e+148) {
tmp = t * (x / z);
} else if (t <= 2.3e+95) {
tmp = (y / z) * x;
} 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 <= (-1.55d+148)) then
tmp = t * (x / z)
else if (t <= 2.3d+95) then
tmp = (y / z) * x
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 <= -1.55e+148) {
tmp = t * (x / z);
} else if (t <= 2.3e+95) {
tmp = (y / z) * x;
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.55e+148: tmp = t * (x / z) elif t <= 2.3e+95: tmp = (y / z) * x else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.55e+148) tmp = Float64(t * Float64(x / z)); elseif (t <= 2.3e+95) tmp = Float64(Float64(y / z) * x); else tmp = Float64(x * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.55e+148) tmp = t * (x / z); elseif (t <= 2.3e+95) tmp = (y / z) * x; else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.55e+148], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.3e+95], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.55 \cdot 10^{+148}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{elif}\;t \leq 2.3 \cdot 10^{+95}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if t < -1.54999999999999988e148Initial program 91.2%
Taylor expanded in z around inf 60.7%
neg-mul-160.7%
Simplified60.7%
Taylor expanded in y around 0 51.7%
associate-/l*54.1%
Simplified54.1%
if -1.54999999999999988e148 < t < 2.29999999999999997e95Initial program 94.9%
Taylor expanded in y around inf 75.5%
associate-*r/77.0%
Simplified77.0%
if 2.29999999999999997e95 < t Initial program 95.8%
Taylor expanded in z around 0 60.0%
Taylor expanded in y around 0 48.1%
mul-1-neg48.1%
distribute-lft-neg-out48.1%
*-commutative48.1%
Simplified48.1%
Final simplification68.9%
(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 94.6%
Taylor expanded in z around 0 67.7%
Taylor expanded in y around 0 28.0%
mul-1-neg28.0%
distribute-lft-neg-out28.0%
*-commutative28.0%
Simplified28.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 2024181
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
:precision binary64
:alt
(! :herbie-platform default (if (< (* x (- (/ y z) (/ t (- 1 z)))) -3811613151656021/5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* x (- (/ y z) (* t (/ 1 (- 1 z))))) (if (< (* x (- (/ y z) (/ t (- 1 z)))) 7066972463851151/50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (/ (* y x) z) (- (/ (* t x) (- 1 z)))) (* x (- (/ y z) (* t (/ 1 (- 1 z))))))))
(* x (- (/ y z) (/ t (- 1.0 z)))))