
(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 (- 1.0 z)))))
(if (<= t_1 (- INFINITY))
(* y (/ x z))
(if (<= t_1 2e+302) (* x t_1) (/ (* x y) 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 <= -((double) INFINITY)) {
tmp = y * (x / z);
} else if (t_1 <= 2e+302) {
tmp = x * t_1;
} else {
tmp = (x * y) / z;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = y * (x / z);
} else if (t_1 <= 2e+302) {
tmp = x * t_1;
} else {
tmp = (x * y) / z;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / z) - (t / (1.0 - z)) tmp = 0 if t_1 <= -math.inf: tmp = y * (x / z) elif t_1 <= 2e+302: tmp = x * t_1 else: tmp = (x * y) / 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 <= Float64(-Inf)) tmp = Float64(y * Float64(x / z)); elseif (t_1 <= 2e+302) tmp = Float64(x * t_1); else tmp = Float64(Float64(x * y) / 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 <= -Inf) tmp = y * (x / z); elseif (t_1 <= 2e+302) tmp = x * t_1; else tmp = (x * y) / 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, (-Infinity)], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+302], N[(x * t$95$1), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} - \frac{t}{1 - z}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+302}:\\
\;\;\;\;x \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -inf.0Initial program 66.7%
clear-num66.7%
associate-/r/66.7%
Applied egg-rr66.7%
Taylor expanded in y around inf 99.9%
associate-*r/99.9%
Simplified99.9%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 2.0000000000000002e302Initial program 98.3%
if 2.0000000000000002e302 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) Initial program 53.8%
Taylor expanded in y around inf 100.0%
Final simplification98.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- (/ y z) (/ t (- 1.0 z))))))
(if (<= t_1 2e+296)
t_1
(/ (* x (fma y (- 1.0 z) (* z (- t)))) (* z (- 1.0 z))))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y / z) - (t / (1.0 - z)));
double tmp;
if (t_1 <= 2e+296) {
tmp = t_1;
} else {
tmp = (x * fma(y, (1.0 - z), (z * -t))) / (z * (1.0 - z));
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) tmp = 0.0 if (t_1 <= 2e+296) tmp = t_1; else tmp = Float64(Float64(x * fma(y, Float64(1.0 - z), Float64(z * Float64(-t)))) / Float64(z * Float64(1.0 - z))); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e+296], t$95$1, N[(N[(x * N[(y * N[(1.0 - z), $MachinePrecision] + N[(z * (-t)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\
\mathbf{if}\;t_1 \leq 2 \cdot 10^{+296}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \mathsf{fma}\left(y, 1 - z, z \cdot \left(-t\right)\right)}{z \cdot \left(1 - z\right)}\\
\end{array}
\end{array}
if (*.f64 x (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z)))) < 1.99999999999999996e296Initial program 96.5%
if 1.99999999999999996e296 < (*.f64 x (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z)))) Initial program 81.3%
*-commutative81.3%
frac-sub81.3%
associate-*l/100.0%
cancel-sign-sub-inv100.0%
fma-def100.0%
Applied egg-rr100.0%
Final simplification97.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t (+ z -1.0)))))
(if (<= t -1.1e+67)
t_1
(if (<= t -4.4e+49)
(/ (* x y) z)
(if (<= t -53000000000.0)
t_1
(if (<= t -3.8e-179)
(* x (- (/ y z) t))
(if (<= t 3e+48) (* y (/ x z)) t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / (z + -1.0));
double tmp;
if (t <= -1.1e+67) {
tmp = t_1;
} else if (t <= -4.4e+49) {
tmp = (x * y) / z;
} else if (t <= -53000000000.0) {
tmp = t_1;
} else if (t <= -3.8e-179) {
tmp = x * ((y / z) - t);
} else if (t <= 3e+48) {
tmp = y * (x / 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) :: tmp
t_1 = x * (t / (z + (-1.0d0)))
if (t <= (-1.1d+67)) then
tmp = t_1
else if (t <= (-4.4d+49)) then
tmp = (x * y) / z
else if (t <= (-53000000000.0d0)) then
tmp = t_1
else if (t <= (-3.8d-179)) then
tmp = x * ((y / z) - t)
else if (t <= 3d+48) then
tmp = y * (x / 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 * (t / (z + -1.0));
double tmp;
if (t <= -1.1e+67) {
tmp = t_1;
} else if (t <= -4.4e+49) {
tmp = (x * y) / z;
} else if (t <= -53000000000.0) {
tmp = t_1;
} else if (t <= -3.8e-179) {
tmp = x * ((y / z) - t);
} else if (t <= 3e+48) {
tmp = y * (x / z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / (z + -1.0)) tmp = 0 if t <= -1.1e+67: tmp = t_1 elif t <= -4.4e+49: tmp = (x * y) / z elif t <= -53000000000.0: tmp = t_1 elif t <= -3.8e-179: tmp = x * ((y / z) - t) elif t <= 3e+48: tmp = y * (x / z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / Float64(z + -1.0))) tmp = 0.0 if (t <= -1.1e+67) tmp = t_1; elseif (t <= -4.4e+49) tmp = Float64(Float64(x * y) / z); elseif (t <= -53000000000.0) tmp = t_1; elseif (t <= -3.8e-179) tmp = Float64(x * Float64(Float64(y / z) - t)); elseif (t <= 3e+48) tmp = Float64(y * Float64(x / z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / (z + -1.0)); tmp = 0.0; if (t <= -1.1e+67) tmp = t_1; elseif (t <= -4.4e+49) tmp = (x * y) / z; elseif (t <= -53000000000.0) tmp = t_1; elseif (t <= -3.8e-179) tmp = x * ((y / z) - t); elseif (t <= 3e+48) tmp = y * (x / z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.1e+67], t$95$1, If[LessEqual[t, -4.4e+49], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t, -53000000000.0], t$95$1, If[LessEqual[t, -3.8e-179], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3e+48], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z + -1}\\
\mathbf{if}\;t \leq -1.1 \cdot 10^{+67}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -4.4 \cdot 10^{+49}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{elif}\;t \leq -53000000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -3.8 \cdot 10^{-179}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{elif}\;t \leq 3 \cdot 10^{+48}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -1.1e67 or -4.4000000000000001e49 < t < -5.3e10 or 3e48 < t Initial program 98.1%
Taylor expanded in y around 0 74.8%
associate-*r/74.8%
associate-*r*74.8%
neg-mul-174.8%
associate-*l/79.7%
*-commutative79.7%
distribute-frac-neg79.7%
neg-mul-179.7%
metadata-eval79.7%
times-frac79.7%
*-lft-identity79.7%
neg-mul-179.7%
sub-neg79.7%
+-commutative79.7%
distribute-neg-in79.7%
remove-double-neg79.7%
metadata-eval79.7%
Simplified79.7%
if -1.1e67 < t < -4.4000000000000001e49Initial program 84.2%
Taylor expanded in y around inf 97.3%
if -5.3e10 < t < -3.79999999999999974e-179Initial program 99.9%
Taylor expanded in z around 0 80.5%
mul-1-neg80.5%
unsub-neg80.5%
associate-*l/89.3%
distribute-rgt-out--89.4%
Simplified89.4%
if -3.79999999999999974e-179 < t < 3e48Initial program 88.3%
clear-num87.8%
associate-/r/88.3%
Applied egg-rr88.3%
Taylor expanded in y around inf 84.7%
associate-*r/87.4%
Simplified87.4%
Final simplification84.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ x (/ z t))))
(if (<= z -2.6e+175)
t_1
(if (<= z -1.6e+27)
(* x (/ y z))
(if (<= z -6.8e+16)
(/ t (/ z x))
(if (<= z 1.6e+54) (* x (- (/ y z) t)) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x / (z / t);
double tmp;
if (z <= -2.6e+175) {
tmp = t_1;
} else if (z <= -1.6e+27) {
tmp = x * (y / z);
} else if (z <= -6.8e+16) {
tmp = t / (z / x);
} else if (z <= 1.6e+54) {
tmp = x * ((y / z) - t);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x / (z / t)
if (z <= (-2.6d+175)) then
tmp = t_1
else if (z <= (-1.6d+27)) then
tmp = x * (y / z)
else if (z <= (-6.8d+16)) then
tmp = t / (z / x)
else if (z <= 1.6d+54) then
tmp = x * ((y / z) - t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x / (z / t);
double tmp;
if (z <= -2.6e+175) {
tmp = t_1;
} else if (z <= -1.6e+27) {
tmp = x * (y / z);
} else if (z <= -6.8e+16) {
tmp = t / (z / x);
} else if (z <= 1.6e+54) {
tmp = x * ((y / z) - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x / (z / t) tmp = 0 if z <= -2.6e+175: tmp = t_1 elif z <= -1.6e+27: tmp = x * (y / z) elif z <= -6.8e+16: tmp = t / (z / x) elif z <= 1.6e+54: tmp = x * ((y / z) - t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x / Float64(z / t)) tmp = 0.0 if (z <= -2.6e+175) tmp = t_1; elseif (z <= -1.6e+27) tmp = Float64(x * Float64(y / z)); elseif (z <= -6.8e+16) tmp = Float64(t / Float64(z / x)); elseif (z <= 1.6e+54) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x / (z / t); tmp = 0.0; if (z <= -2.6e+175) tmp = t_1; elseif (z <= -1.6e+27) tmp = x * (y / z); elseif (z <= -6.8e+16) tmp = t / (z / x); elseif (z <= 1.6e+54) tmp = x * ((y / z) - t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.6e+175], t$95$1, If[LessEqual[z, -1.6e+27], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -6.8e+16], N[(t / N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.6e+54], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{\frac{z}{t}}\\
\mathbf{if}\;z \leq -2.6 \cdot 10^{+175}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.6 \cdot 10^{+27}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;z \leq -6.8 \cdot 10^{+16}:\\
\;\;\;\;\frac{t}{\frac{z}{x}}\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{+54}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -2.6e175 or 1.6e54 < z Initial program 95.3%
Taylor expanded in z around inf 87.1%
*-commutative87.1%
associate-/l*94.6%
neg-mul-194.6%
Simplified94.6%
Taylor expanded in y around 0 68.6%
if -2.6e175 < z < -1.60000000000000008e27Initial program 99.7%
Taylor expanded in y around inf 57.9%
associate-*l/67.7%
Simplified67.7%
if -1.60000000000000008e27 < z < -6.8e16Initial program 100.0%
Taylor expanded in z around inf 99.6%
*-commutative99.6%
associate-/l*99.6%
neg-mul-199.6%
Simplified99.6%
Taylor expanded in y around 0 99.6%
associate-*r/99.6%
Simplified99.6%
clear-num99.6%
un-div-inv100.0%
Applied egg-rr100.0%
if -6.8e16 < z < 1.6e54Initial program 91.9%
Taylor expanded in z around 0 86.6%
mul-1-neg86.6%
unsub-neg86.6%
associate-*l/81.5%
distribute-rgt-out--85.8%
Simplified85.8%
Final simplification78.4%
(FPCore (x y z t)
:precision binary64
(if (or (<= z -1e-19)
(not (or (<= z -2.9e-242) (and (not (<= z 1.4e-280)) (<= z 1.0)))))
(* t (/ x z))
(* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1e-19) || !((z <= -2.9e-242) || (!(z <= 1.4e-280) && (z <= 1.0)))) {
tmp = t * (x / z);
} else {
tmp = x * -t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1d-19)) .or. (.not. (z <= (-2.9d-242)) .or. (.not. (z <= 1.4d-280)) .and. (z <= 1.0d0))) then
tmp = t * (x / z)
else
tmp = x * -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1e-19) || !((z <= -2.9e-242) || (!(z <= 1.4e-280) && (z <= 1.0)))) {
tmp = t * (x / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1e-19) or not ((z <= -2.9e-242) or (not (z <= 1.4e-280) and (z <= 1.0))): tmp = t * (x / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1e-19) || !((z <= -2.9e-242) || (!(z <= 1.4e-280) && (z <= 1.0)))) tmp = Float64(t * Float64(x / z)); else tmp = Float64(x * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1e-19) || ~(((z <= -2.9e-242) || (~((z <= 1.4e-280)) && (z <= 1.0))))) tmp = t * (x / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1e-19], N[Not[Or[LessEqual[z, -2.9e-242], And[N[Not[LessEqual[z, 1.4e-280]], $MachinePrecision], LessEqual[z, 1.0]]]], $MachinePrecision]], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{-19} \lor \neg \left(z \leq -2.9 \cdot 10^{-242} \lor \neg \left(z \leq 1.4 \cdot 10^{-280}\right) \land z \leq 1\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -9.9999999999999998e-20 or -2.9000000000000001e-242 < z < 1.40000000000000009e-280 or 1 < z Initial program 96.4%
Taylor expanded in z around inf 87.1%
*-commutative87.1%
associate-/l*91.4%
neg-mul-191.4%
Simplified91.4%
Taylor expanded in y around 0 52.4%
associate-*r/51.6%
Simplified51.6%
if -9.9999999999999998e-20 < z < -2.9000000000000001e-242 or 1.40000000000000009e-280 < z < 1Initial program 90.6%
Taylor expanded in z around 0 90.9%
mul-1-neg90.9%
unsub-neg90.9%
associate-*l/85.5%
distribute-rgt-out--89.5%
Simplified89.5%
Taylor expanded in y around 0 38.1%
associate-*r*38.1%
mul-1-neg38.1%
Simplified38.1%
Final simplification46.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.95e-18) (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.95e-18) || !(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.95d-18)) .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.95e-18) || !(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.95e-18) 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.95e-18) || !(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.95e-18) || ~((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.95e-18], 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.95 \cdot 10^{-18} \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.95000000000000002e-18 or 1 < z Initial program 96.6%
Taylor expanded in z around inf 88.6%
*-commutative88.6%
associate-/l*94.2%
associate-/r/88.9%
cancel-sign-sub-inv88.9%
metadata-eval88.9%
*-lft-identity88.9%
Simplified88.9%
if -1.95000000000000002e-18 < z < 1Initial program 91.3%
Taylor expanded in z around 0 90.5%
mul-1-neg90.5%
unsub-neg90.5%
associate-*l/85.3%
distribute-rgt-out--90.3%
Simplified90.3%
Final simplification89.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 88.4%
*-commutative88.4%
associate-/l*94.8%
neg-mul-194.8%
Simplified94.8%
Taylor expanded in z around 0 94.8%
associate-/l*88.4%
associate-*r/95.6%
*-commutative95.6%
Applied egg-rr95.6%
if -1 < z < 1Initial program 90.6%
Taylor expanded in z around 0 90.6%
mul-1-neg90.6%
unsub-neg90.6%
associate-*l/84.7%
distribute-rgt-out--89.7%
Simplified89.7%
Final simplification92.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ y t) z)))
(if (<= z -1.05)
(/ t_1 (/ 1.0 x))
(if (<= z 1.0) (* x (- (/ y z) t)) (* x t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (y + t) / z;
double tmp;
if (z <= -1.05) {
tmp = t_1 / (1.0 / x);
} else if (z <= 1.0) {
tmp = x * ((y / z) - t);
} else {
tmp = x * t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (y + t) / z
if (z <= (-1.05d0)) then
tmp = t_1 / (1.0d0 / x)
else if (z <= 1.0d0) then
tmp = x * ((y / z) - t)
else
tmp = x * t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y + t) / z;
double tmp;
if (z <= -1.05) {
tmp = t_1 / (1.0 / x);
} else if (z <= 1.0) {
tmp = x * ((y / z) - t);
} else {
tmp = x * t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y + t) / z tmp = 0 if z <= -1.05: tmp = t_1 / (1.0 / x) elif z <= 1.0: tmp = x * ((y / z) - t) else: tmp = x * t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y + t) / z) tmp = 0.0 if (z <= -1.05) tmp = Float64(t_1 / Float64(1.0 / x)); elseif (z <= 1.0) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(x * t_1); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y + t) / z; tmp = 0.0; if (z <= -1.05) tmp = t_1 / (1.0 / x); elseif (z <= 1.0) tmp = x * ((y / z) - t); else tmp = x * t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[z, -1.05], N[(t$95$1 / N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(x * t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y + t}{z}\\
\mathbf{if}\;z \leq -1.05:\\
\;\;\;\;\frac{t_1}{\frac{1}{x}}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot t_1\\
\end{array}
\end{array}
if z < -1.05000000000000004Initial program 98.4%
Taylor expanded in z around inf 85.0%
*-commutative85.0%
associate-/l*95.5%
neg-mul-195.5%
Simplified95.5%
Taylor expanded in z around 0 95.5%
associate-/l*85.0%
associate-*r/96.2%
*-commutative96.2%
Applied egg-rr96.2%
associate-/r/87.7%
div-inv87.7%
associate-/r*96.3%
Applied egg-rr96.3%
if -1.05000000000000004 < z < 1Initial program 90.6%
Taylor expanded in z around 0 90.6%
mul-1-neg90.6%
unsub-neg90.6%
associate-*l/84.7%
distribute-rgt-out--89.7%
Simplified89.7%
if 1 < z Initial program 96.0%
Taylor expanded in z around inf 92.5%
*-commutative92.5%
associate-/l*93.9%
neg-mul-193.9%
Simplified93.9%
Taylor expanded in z around 0 93.9%
associate-/l*92.5%
associate-*r/94.8%
*-commutative94.8%
Applied egg-rr94.8%
Final simplification92.8%
(FPCore (x y z t) :precision binary64 (if (or (<= t -7.5e+67) (not (<= t 8e+101))) (* t (/ x z)) (* y (/ x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7.5e+67) || !(t <= 8e+101)) {
tmp = t * (x / 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 <= (-7.5d+67)) .or. (.not. (t <= 8d+101))) then
tmp = t * (x / 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 <= -7.5e+67) || !(t <= 8e+101)) {
tmp = t * (x / z);
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -7.5e+67) or not (t <= 8e+101): tmp = t * (x / z) else: tmp = y * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -7.5e+67) || !(t <= 8e+101)) tmp = Float64(t * Float64(x / 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 <= -7.5e+67) || ~((t <= 8e+101))) tmp = t * (x / z); else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -7.5e+67], N[Not[LessEqual[t, 8e+101]], $MachinePrecision]], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.5 \cdot 10^{+67} \lor \neg \left(t \leq 8 \cdot 10^{+101}\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if t < -7.5000000000000005e67 or 7.9999999999999998e101 < t Initial program 97.8%
Taylor expanded in z around inf 60.9%
*-commutative60.9%
associate-/l*69.5%
neg-mul-169.5%
Simplified69.5%
Taylor expanded in y around 0 52.5%
associate-*r/50.3%
Simplified50.3%
if -7.5000000000000005e67 < t < 7.9999999999999998e101Initial program 92.0%
clear-num91.7%
associate-/r/92.0%
Applied egg-rr92.0%
Taylor expanded in y around inf 79.1%
associate-*r/80.7%
Simplified80.7%
Final simplification69.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -6.6e+67) (not (<= t 7.4e+101))) (/ x (/ z t)) (* y (/ x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -6.6e+67) || !(t <= 7.4e+101)) {
tmp = x / (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 ((t <= (-6.6d+67)) .or. (.not. (t <= 7.4d+101))) then
tmp = x / (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 ((t <= -6.6e+67) || !(t <= 7.4e+101)) {
tmp = x / (z / t);
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -6.6e+67) or not (t <= 7.4e+101): tmp = x / (z / t) else: tmp = y * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -6.6e+67) || !(t <= 7.4e+101)) tmp = Float64(x / Float64(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 ((t <= -6.6e+67) || ~((t <= 7.4e+101))) tmp = x / (z / t); else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -6.6e+67], N[Not[LessEqual[t, 7.4e+101]], $MachinePrecision]], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.6 \cdot 10^{+67} \lor \neg \left(t \leq 7.4 \cdot 10^{+101}\right):\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if t < -6.6000000000000006e67 or 7.3999999999999995e101 < t Initial program 97.8%
Taylor expanded in z around inf 60.9%
*-commutative60.9%
associate-/l*69.5%
neg-mul-169.5%
Simplified69.5%
Taylor expanded in y around 0 58.4%
if -6.6000000000000006e67 < t < 7.3999999999999995e101Initial program 92.0%
clear-num91.7%
associate-/r/92.0%
Applied egg-rr92.0%
Taylor expanded in y around inf 79.1%
associate-*r/80.7%
Simplified80.7%
Final simplification72.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 94.1%
Taylor expanded in z around 0 63.0%
mul-1-neg63.0%
unsub-neg63.0%
associate-*l/61.7%
distribute-rgt-out--64.0%
Simplified64.0%
Taylor expanded in y around 0 23.3%
associate-*r*23.3%
mul-1-neg23.3%
Simplified23.3%
Final simplification23.3%
(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 2023196
(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)))))