
(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 (or (<= t_1 -5e+266) (not (<= t_1 INFINITY))) (* y (/ x z)) (* t_1 x))))
double code(double x, double y, double z, double t) {
double t_1 = (y / z) + (t / (z + -1.0));
double tmp;
if ((t_1 <= -5e+266) || !(t_1 <= ((double) INFINITY))) {
tmp = y * (x / z);
} else {
tmp = t_1 * x;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (y / z) + (t / (z + -1.0));
double tmp;
if ((t_1 <= -5e+266) || !(t_1 <= Double.POSITIVE_INFINITY)) {
tmp = y * (x / z);
} else {
tmp = t_1 * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / z) + (t / (z + -1.0)) tmp = 0 if (t_1 <= -5e+266) or not (t_1 <= math.inf): tmp = y * (x / z) else: tmp = t_1 * x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y / z) + Float64(t / Float64(z + -1.0))) tmp = 0.0 if ((t_1 <= -5e+266) || !(t_1 <= Inf)) tmp = Float64(y * Float64(x / z)); else tmp = Float64(t_1 * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y / z) + (t / (z + -1.0)); tmp = 0.0; if ((t_1 <= -5e+266) || ~((t_1 <= Inf))) tmp = y * (x / z); else tmp = t_1 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / z), $MachinePrecision] + N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e+266], N[Not[LessEqual[t$95$1, Infinity]], $MachinePrecision]], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} + \frac{t}{z + -1}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+266} \lor \neg \left(t\_1 \leq \infty\right):\\
\;\;\;\;y \cdot \frac{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))) < -4.9999999999999999e266 or +inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 76.5%
Taylor expanded in y around inf 99.9%
associate-*r/76.5%
Simplified76.5%
clear-num76.6%
un-div-inv76.8%
Applied egg-rr76.8%
associate-/r/100.0%
Applied egg-rr100.0%
if -4.9999999999999999e266 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < +inf.0Initial program 95.4%
Final simplification95.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -14600.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 <= -14600.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 <= (-14600.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 <= -14600.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 <= -14600.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 <= -14600.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 <= -14600.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, -14600.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 -14600 \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 < -14600 or 1 < z Initial program 97.6%
Taylor expanded in z around inf 85.7%
associate-/l*96.6%
cancel-sign-sub-inv96.6%
metadata-eval96.6%
*-lft-identity96.6%
+-commutative96.6%
Simplified96.6%
if -14600 < z < 1Initial program 90.3%
Taylor expanded in z around 0 89.2%
Final simplification92.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.6e+117) (not (<= t 5e+52))) (* x (/ t (+ z -1.0))) (/ x (/ z y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.6e+117) || !(t <= 5e+52)) {
tmp = x * (t / (z + -1.0));
} else {
tmp = x / (z / y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-1.6d+117)) .or. (.not. (t <= 5d+52))) then
tmp = x * (t / (z + (-1.0d0)))
else
tmp = x / (z / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.6e+117) || !(t <= 5e+52)) {
tmp = x * (t / (z + -1.0));
} else {
tmp = x / (z / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.6e+117) or not (t <= 5e+52): tmp = x * (t / (z + -1.0)) else: tmp = x / (z / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.6e+117) || !(t <= 5e+52)) tmp = Float64(x * Float64(t / Float64(z + -1.0))); else tmp = Float64(x / Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.6e+117) || ~((t <= 5e+52))) tmp = x * (t / (z + -1.0)); else tmp = x / (z / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.6e+117], N[Not[LessEqual[t, 5e+52]], $MachinePrecision]], N[(x * N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.6 \cdot 10^{+117} \lor \neg \left(t \leq 5 \cdot 10^{+52}\right):\\
\;\;\;\;x \cdot \frac{t}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\end{array}
\end{array}
if t < -1.60000000000000002e117 or 5e52 < t Initial program 94.4%
Taylor expanded in y around 0 75.4%
mul-1-neg75.4%
distribute-neg-frac275.4%
neg-sub075.4%
associate--r-75.4%
metadata-eval75.4%
Simplified75.4%
if -1.60000000000000002e117 < t < 5e52Initial program 93.7%
Taylor expanded in y around inf 75.7%
associate-*r/84.2%
Simplified84.2%
clear-num84.1%
un-div-inv84.6%
Applied egg-rr84.6%
Final simplification80.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.7e+171) (not (<= t 1.4e+56))) (* t (/ x (+ z -1.0))) (/ x (/ z y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.7e+171) || !(t <= 1.4e+56)) {
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 <= (-3.7d+171)) .or. (.not. (t <= 1.4d+56))) 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 <= -3.7e+171) || !(t <= 1.4e+56)) {
tmp = t * (x / (z + -1.0));
} else {
tmp = x / (z / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3.7e+171) or not (t <= 1.4e+56): tmp = t * (x / (z + -1.0)) else: tmp = x / (z / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3.7e+171) || !(t <= 1.4e+56)) 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 <= -3.7e+171) || ~((t <= 1.4e+56))) 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, -3.7e+171], N[Not[LessEqual[t, 1.4e+56]], $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 -3.7 \cdot 10^{+171} \lor \neg \left(t \leq 1.4 \cdot 10^{+56}\right):\\
\;\;\;\;t \cdot \frac{x}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\end{array}
\end{array}
if t < -3.69999999999999998e171 or 1.40000000000000004e56 < t Initial program 95.9%
Taylor expanded in y around 0 73.3%
mul-1-neg73.3%
associate-/l*73.3%
distribute-rgt-neg-in73.3%
distribute-neg-frac273.3%
neg-sub073.3%
associate--r-73.3%
metadata-eval73.3%
Simplified73.3%
if -3.69999999999999998e171 < t < 1.40000000000000004e56Initial program 92.9%
Taylor expanded in y around inf 74.7%
associate-*r/81.5%
Simplified81.5%
clear-num81.4%
un-div-inv81.9%
Applied egg-rr81.9%
Final simplification78.8%
(FPCore (x y z t) :precision binary64 (if (<= z -1.2e+109) (* (/ y z) x) (if (<= z 6.5e+37) (* x (- (/ y z) t)) (* x (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.2e+109) {
tmp = (y / z) * x;
} else if (z <= 6.5e+37) {
tmp = x * ((y / z) - 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 (z <= (-1.2d+109)) then
tmp = (y / z) * x
else if (z <= 6.5d+37) then
tmp = x * ((y / z) - 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 (z <= -1.2e+109) {
tmp = (y / z) * x;
} else if (z <= 6.5e+37) {
tmp = x * ((y / z) - t);
} else {
tmp = x * (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.2e+109: tmp = (y / z) * x elif z <= 6.5e+37: tmp = x * ((y / z) - t) else: tmp = x * (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.2e+109) tmp = Float64(Float64(y / z) * x); elseif (z <= 6.5e+37) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(x * Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.2e+109) tmp = (y / z) * x; elseif (z <= 6.5e+37) tmp = x * ((y / z) - t); else tmp = x * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.2e+109], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 6.5e+37], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+109}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{+37}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\end{array}
\end{array}
if z < -1.19999999999999994e109Initial program 94.9%
Taylor expanded in y around inf 61.7%
associate-*r/84.0%
Simplified84.0%
if -1.19999999999999994e109 < z < 6.4999999999999998e37Initial program 92.6%
Taylor expanded in z around 0 83.5%
if 6.4999999999999998e37 < z Initial program 97.8%
clear-num97.7%
associate-/r/97.9%
Applied egg-rr97.9%
Taylor expanded in z around inf 90.7%
cancel-sign-sub-inv90.7%
metadata-eval90.7%
*-lft-identity90.7%
associate-*r/97.8%
Simplified97.8%
Taylor expanded in y around 0 64.4%
*-commutative64.4%
associate-/l*69.8%
Simplified69.8%
Final simplification80.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.45e-9) (not (<= z 1.0))) (* t (/ x z)) (* t (- x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.45e-9) || !(z <= 1.0)) {
tmp = t * (x / z);
} else {
tmp = t * -x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.45d-9)) .or. (.not. (z <= 1.0d0))) then
tmp = t * (x / z)
else
tmp = t * -x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.45e-9) || !(z <= 1.0)) {
tmp = t * (x / z);
} else {
tmp = t * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.45e-9) or not (z <= 1.0): tmp = t * (x / z) else: tmp = t * -x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.45e-9) || !(z <= 1.0)) tmp = Float64(t * Float64(x / z)); else tmp = Float64(t * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.45e-9) || ~((z <= 1.0))) tmp = t * (x / z); else tmp = t * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.45e-9], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(t * (-x)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{-9} \lor \neg \left(z \leq 1\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(-x\right)\\
\end{array}
\end{array}
if z < -1.44999999999999996e-9 or 1 < z Initial program 97.6%
Taylor expanded in z around inf 86.0%
neg-mul-186.0%
Simplified86.0%
Taylor expanded in y around 0 52.0%
associate-/l*51.2%
Simplified51.2%
if -1.44999999999999996e-9 < z < 1Initial program 90.1%
Taylor expanded in z around 0 89.0%
Taylor expanded in y around 0 36.5%
associate-*r*36.5%
neg-mul-136.5%
Simplified36.5%
Final simplification44.0%
(FPCore (x y z t) :precision binary64 (if (<= t -3.5e+174) (* x (/ t z)) (if (<= t 7.6e+182) (/ x (/ z y)) (* t (- x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.5e+174) {
tmp = x * (t / z);
} else if (t <= 7.6e+182) {
tmp = x / (z / y);
} else {
tmp = t * -x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-3.5d+174)) then
tmp = x * (t / z)
else if (t <= 7.6d+182) then
tmp = x / (z / y)
else
tmp = t * -x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.5e+174) {
tmp = x * (t / z);
} else if (t <= 7.6e+182) {
tmp = x / (z / y);
} else {
tmp = t * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -3.5e+174: tmp = x * (t / z) elif t <= 7.6e+182: tmp = x / (z / y) else: tmp = t * -x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -3.5e+174) tmp = Float64(x * Float64(t / z)); elseif (t <= 7.6e+182) tmp = Float64(x / Float64(z / y)); else tmp = Float64(t * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -3.5e+174) tmp = x * (t / z); elseif (t <= 7.6e+182) tmp = x / (z / y); else tmp = t * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -3.5e+174], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.6e+182], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], N[(t * (-x)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.5 \cdot 10^{+174}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{elif}\;t \leq 7.6 \cdot 10^{+182}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(-x\right)\\
\end{array}
\end{array}
if t < -3.5000000000000001e174Initial program 96.7%
clear-num96.7%
associate-/r/96.7%
Applied egg-rr96.7%
Taylor expanded in z around inf 62.2%
cancel-sign-sub-inv62.2%
metadata-eval62.2%
*-lft-identity62.2%
associate-*r/65.3%
Simplified65.3%
Taylor expanded in y around 0 58.1%
*-commutative58.1%
associate-/l*61.2%
Simplified61.2%
if -3.5000000000000001e174 < t < 7.60000000000000025e182Initial program 93.3%
Taylor expanded in y around inf 68.9%
associate-*r/75.2%
Simplified75.2%
clear-num75.1%
un-div-inv75.8%
Applied egg-rr75.8%
if 7.60000000000000025e182 < t Initial program 95.9%
Taylor expanded in z around 0 71.1%
Taylor expanded in y around 0 70.8%
associate-*r*70.8%
neg-mul-170.8%
Simplified70.8%
Final simplification73.7%
(FPCore (x y z t) :precision binary64 (if (<= t -2e+175) (* x (/ t z)) (if (<= t 1e+183) (* (/ y z) x) (* t (- x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2e+175) {
tmp = x * (t / z);
} else if (t <= 1e+183) {
tmp = (y / z) * x;
} else {
tmp = t * -x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-2d+175)) then
tmp = x * (t / z)
else if (t <= 1d+183) then
tmp = (y / z) * x
else
tmp = t * -x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2e+175) {
tmp = x * (t / z);
} else if (t <= 1e+183) {
tmp = (y / z) * x;
} else {
tmp = t * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2e+175: tmp = x * (t / z) elif t <= 1e+183: tmp = (y / z) * x else: tmp = t * -x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2e+175) tmp = Float64(x * Float64(t / z)); elseif (t <= 1e+183) tmp = Float64(Float64(y / z) * x); else tmp = Float64(t * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2e+175) tmp = x * (t / z); elseif (t <= 1e+183) tmp = (y / z) * x; else tmp = t * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2e+175], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1e+183], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], N[(t * (-x)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2 \cdot 10^{+175}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{elif}\;t \leq 10^{+183}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(-x\right)\\
\end{array}
\end{array}
if t < -1.9999999999999999e175Initial program 96.7%
clear-num96.7%
associate-/r/96.7%
Applied egg-rr96.7%
Taylor expanded in z around inf 62.2%
cancel-sign-sub-inv62.2%
metadata-eval62.2%
*-lft-identity62.2%
associate-*r/65.3%
Simplified65.3%
Taylor expanded in y around 0 58.1%
*-commutative58.1%
associate-/l*61.2%
Simplified61.2%
if -1.9999999999999999e175 < t < 9.99999999999999947e182Initial program 93.3%
Taylor expanded in y around inf 68.9%
associate-*r/75.2%
Simplified75.2%
if 9.99999999999999947e182 < t Initial program 95.9%
Taylor expanded in z around 0 71.1%
Taylor expanded in y around 0 70.8%
associate-*r*70.8%
neg-mul-170.8%
Simplified70.8%
Final simplification73.2%
(FPCore (x y z t) :precision binary64 (if (<= z -1.45e-9) (* t (/ x z)) (if (<= z 1.1) (* t (- x)) (* x (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.45e-9) {
tmp = t * (x / z);
} else if (z <= 1.1) {
tmp = t * -x;
} 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 (z <= (-1.45d-9)) then
tmp = t * (x / z)
else if (z <= 1.1d0) then
tmp = t * -x
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 (z <= -1.45e-9) {
tmp = t * (x / z);
} else if (z <= 1.1) {
tmp = t * -x;
} else {
tmp = x * (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.45e-9: tmp = t * (x / z) elif z <= 1.1: tmp = t * -x else: tmp = x * (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.45e-9) tmp = Float64(t * Float64(x / z)); elseif (z <= 1.1) tmp = Float64(t * Float64(-x)); else tmp = Float64(x * Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.45e-9) tmp = t * (x / z); elseif (z <= 1.1) tmp = t * -x; else tmp = x * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.45e-9], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.1], N[(t * (-x)), $MachinePrecision], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{-9}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 1.1:\\
\;\;\;\;t \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\end{array}
\end{array}
if z < -1.44999999999999996e-9Initial program 97.1%
Taylor expanded in z around inf 80.2%
neg-mul-180.2%
Simplified80.2%
Taylor expanded in y around 0 45.8%
associate-/l*47.1%
Simplified47.1%
if -1.44999999999999996e-9 < z < 1.1000000000000001Initial program 90.1%
Taylor expanded in z around 0 89.0%
Taylor expanded in y around 0 36.5%
associate-*r*36.5%
neg-mul-136.5%
Simplified36.5%
if 1.1000000000000001 < z Initial program 98.2%
clear-num98.1%
associate-/r/98.2%
Applied egg-rr98.2%
Taylor expanded in z around inf 92.2%
cancel-sign-sub-inv92.2%
metadata-eval92.2%
*-lft-identity92.2%
associate-*r/98.0%
Simplified98.0%
Taylor expanded in y around 0 58.7%
*-commutative58.7%
associate-/l*63.1%
Simplified63.1%
Final simplification45.8%
(FPCore (x y z t) :precision binary64 (if (<= z 1.0) (* t (- x)) (* t x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.0) {
tmp = t * -x;
} else {
tmp = t * x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 1.0d0) then
tmp = t * -x
else
tmp = t * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.0) {
tmp = t * -x;
} else {
tmp = t * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 1.0: tmp = t * -x else: tmp = t * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 1.0) tmp = Float64(t * Float64(-x)); else tmp = Float64(t * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 1.0) tmp = t * -x; else tmp = t * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 1.0], N[(t * (-x)), $MachinePrecision], N[(t * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;t \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot x\\
\end{array}
\end{array}
if z < 1Initial program 92.6%
Taylor expanded in z around 0 77.6%
Taylor expanded in y around 0 30.0%
associate-*r*30.0%
neg-mul-130.0%
Simplified30.0%
if 1 < z Initial program 98.2%
Taylor expanded in z around 0 38.3%
Taylor expanded in y around 0 12.6%
associate-*r*12.6%
neg-mul-112.6%
Simplified12.6%
add-cube-cbrt12.6%
pow312.6%
add-sqr-sqrt9.4%
sqrt-unprod17.5%
sqr-neg17.5%
sqrt-unprod8.4%
add-sqr-sqrt20.1%
*-commutative20.1%
Applied egg-rr20.1%
rem-cube-cbrt20.1%
Simplified20.1%
Final simplification27.6%
(FPCore (x y z t) :precision binary64 (* t x))
double code(double x, double y, double z, double t) {
return t * x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t * x
end function
public static double code(double x, double y, double z, double t) {
return t * x;
}
def code(x, y, z, t): return t * x
function code(x, y, z, t) return Float64(t * x) end
function tmp = code(x, y, z, t) tmp = t * x; end
code[x_, y_, z_, t_] := N[(t * x), $MachinePrecision]
\begin{array}{l}
\\
t \cdot x
\end{array}
Initial program 94.0%
Taylor expanded in z around 0 67.9%
Taylor expanded in y around 0 25.7%
associate-*r*25.7%
neg-mul-125.7%
Simplified25.7%
add-cube-cbrt25.5%
pow325.5%
add-sqr-sqrt12.7%
sqrt-unprod14.0%
sqr-neg14.0%
sqrt-unprod4.5%
add-sqr-sqrt9.9%
*-commutative9.9%
Applied egg-rr9.9%
rem-cube-cbrt9.9%
Simplified9.9%
Final simplification9.9%
(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 2024118
(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)))))