
(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * ((y / z) - (t / (1.0d0 - z)))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
def code(x, y, z, t): return x * ((y / z) - (t / (1.0 - z)))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) - (t / (1.0 - z))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * ((y / z) - (t / (1.0d0 - z)))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
def code(x, y, z, t): return x * ((y / z) - (t / (1.0 - z)))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) - (t / (1.0 - z))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\end{array}
(FPCore (x y z t) :precision binary64 (if (<= y -4.5e+189) (/ (* y x) z) (* x (+ (/ y z) (/ t (+ z -1.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.5e+189) {
tmp = (y * x) / z;
} else {
tmp = x * ((y / z) + (t / (z + -1.0)));
}
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 (y <= (-4.5d+189)) then
tmp = (y * x) / z
else
tmp = x * ((y / z) + (t / (z + (-1.0d0))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.5e+189) {
tmp = (y * x) / z;
} else {
tmp = x * ((y / z) + (t / (z + -1.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -4.5e+189: tmp = (y * x) / z else: tmp = x * ((y / z) + (t / (z + -1.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -4.5e+189) tmp = Float64(Float64(y * x) / z); else tmp = Float64(x * Float64(Float64(y / z) + Float64(t / Float64(z + -1.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -4.5e+189) tmp = (y * x) / z; else tmp = x * ((y / z) + (t / (z + -1.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -4.5e+189], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision], N[(x * N[(N[(y / z), $MachinePrecision] + N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{+189}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} + \frac{t}{z + -1}\right)\\
\end{array}
\end{array}
if y < -4.49999999999999973e189Initial program 83.9%
Taylor expanded in y around inf 99.9%
if -4.49999999999999973e189 < y Initial program 94.9%
Final simplification95.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* y x) z)) (t_2 (* t (/ x z))))
(if (<= y -9.6e-97)
t_1
(if (<= y -6.8e-116)
t_2
(if (<= y -3.6e-126)
(* y (/ x z))
(if (<= y 9.5e-131)
(/ (* x t) z)
(if (<= y 9e-5) (/ x (/ z y)) (if (<= y 7e+77) t_2 t_1))))))))
double code(double x, double y, double z, double t) {
double t_1 = (y * x) / z;
double t_2 = t * (x / z);
double tmp;
if (y <= -9.6e-97) {
tmp = t_1;
} else if (y <= -6.8e-116) {
tmp = t_2;
} else if (y <= -3.6e-126) {
tmp = y * (x / z);
} else if (y <= 9.5e-131) {
tmp = (x * t) / z;
} else if (y <= 9e-5) {
tmp = x / (z / y);
} else if (y <= 7e+77) {
tmp = t_2;
} 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 = (y * x) / z
t_2 = t * (x / z)
if (y <= (-9.6d-97)) then
tmp = t_1
else if (y <= (-6.8d-116)) then
tmp = t_2
else if (y <= (-3.6d-126)) then
tmp = y * (x / z)
else if (y <= 9.5d-131) then
tmp = (x * t) / z
else if (y <= 9d-5) then
tmp = x / (z / y)
else if (y <= 7d+77) then
tmp = t_2
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 = (y * x) / z;
double t_2 = t * (x / z);
double tmp;
if (y <= -9.6e-97) {
tmp = t_1;
} else if (y <= -6.8e-116) {
tmp = t_2;
} else if (y <= -3.6e-126) {
tmp = y * (x / z);
} else if (y <= 9.5e-131) {
tmp = (x * t) / z;
} else if (y <= 9e-5) {
tmp = x / (z / y);
} else if (y <= 7e+77) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y * x) / z t_2 = t * (x / z) tmp = 0 if y <= -9.6e-97: tmp = t_1 elif y <= -6.8e-116: tmp = t_2 elif y <= -3.6e-126: tmp = y * (x / z) elif y <= 9.5e-131: tmp = (x * t) / z elif y <= 9e-5: tmp = x / (z / y) elif y <= 7e+77: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y * x) / z) t_2 = Float64(t * Float64(x / z)) tmp = 0.0 if (y <= -9.6e-97) tmp = t_1; elseif (y <= -6.8e-116) tmp = t_2; elseif (y <= -3.6e-126) tmp = Float64(y * Float64(x / z)); elseif (y <= 9.5e-131) tmp = Float64(Float64(x * t) / z); elseif (y <= 9e-5) tmp = Float64(x / Float64(z / y)); elseif (y <= 7e+77) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y * x) / z; t_2 = t * (x / z); tmp = 0.0; if (y <= -9.6e-97) tmp = t_1; elseif (y <= -6.8e-116) tmp = t_2; elseif (y <= -3.6e-126) tmp = y * (x / z); elseif (y <= 9.5e-131) tmp = (x * t) / z; elseif (y <= 9e-5) tmp = x / (z / y); elseif (y <= 7e+77) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9.6e-97], t$95$1, If[LessEqual[y, -6.8e-116], t$95$2, If[LessEqual[y, -3.6e-126], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.5e-131], N[(N[(x * t), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[y, 9e-5], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7e+77], t$95$2, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot x}{z}\\
t_2 := t \cdot \frac{x}{z}\\
\mathbf{if}\;y \leq -9.6 \cdot 10^{-97}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -6.8 \cdot 10^{-116}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -3.6 \cdot 10^{-126}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq 9.5 \cdot 10^{-131}:\\
\;\;\;\;\frac{x \cdot t}{z}\\
\mathbf{elif}\;y \leq 9 \cdot 10^{-5}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{elif}\;y \leq 7 \cdot 10^{+77}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -9.5999999999999999e-97 or 7.0000000000000003e77 < y Initial program 91.2%
Taylor expanded in y around inf 82.7%
if -9.5999999999999999e-97 < y < -6.79999999999999985e-116 or 9.00000000000000057e-5 < y < 7.0000000000000003e77Initial program 99.7%
Taylor expanded in y around 0 86.1%
mul-1-neg86.1%
distribute-neg-frac286.1%
neg-sub086.1%
associate--r-86.1%
metadata-eval86.1%
Simplified86.1%
Taylor expanded in z around inf 65.9%
associate-/l*82.4%
Simplified82.4%
if -6.79999999999999985e-116 < y < -3.5999999999999999e-126Initial program 77.5%
Taylor expanded in y around inf 100.0%
associate-*r/77.5%
Simplified77.5%
clear-num77.5%
un-div-inv77.5%
Applied egg-rr77.5%
associate-/r/100.0%
Simplified100.0%
if -3.5999999999999999e-126 < y < 9.4999999999999996e-131Initial program 95.3%
Taylor expanded in z around inf 66.0%
Taylor expanded in y around 0 59.8%
*-commutative59.8%
Simplified59.8%
if 9.4999999999999996e-131 < y < 9.00000000000000057e-5Initial program 99.6%
Taylor expanded in y around inf 47.4%
associate-*r/51.6%
Simplified51.6%
clear-num51.8%
un-div-inv51.8%
Applied egg-rr51.8%
Final simplification73.5%
(FPCore (x y z t)
:precision binary64
(if (<= z -8.2e+91)
(* x (/ y z))
(if (<= z -1.7e+15)
(/ t (/ z x))
(if (<= z 30000.0)
(* x (- (/ y z) t))
(if (<= z 9.6e+272) (* x (/ t z)) (* y (/ x z)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -8.2e+91) {
tmp = x * (y / z);
} else if (z <= -1.7e+15) {
tmp = t / (z / x);
} else if (z <= 30000.0) {
tmp = x * ((y / z) - t);
} else if (z <= 9.6e+272) {
tmp = x * (t / z);
} else {
tmp = y * (x / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-8.2d+91)) then
tmp = x * (y / z)
else if (z <= (-1.7d+15)) then
tmp = t / (z / x)
else if (z <= 30000.0d0) then
tmp = x * ((y / z) - t)
else if (z <= 9.6d+272) then
tmp = x * (t / z)
else
tmp = y * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -8.2e+91) {
tmp = x * (y / z);
} else if (z <= -1.7e+15) {
tmp = t / (z / x);
} else if (z <= 30000.0) {
tmp = x * ((y / z) - t);
} else if (z <= 9.6e+272) {
tmp = x * (t / z);
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -8.2e+91: tmp = x * (y / z) elif z <= -1.7e+15: tmp = t / (z / x) elif z <= 30000.0: tmp = x * ((y / z) - t) elif z <= 9.6e+272: tmp = x * (t / z) else: tmp = y * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -8.2e+91) tmp = Float64(x * Float64(y / z)); elseif (z <= -1.7e+15) tmp = Float64(t / Float64(z / x)); elseif (z <= 30000.0) tmp = Float64(x * Float64(Float64(y / z) - t)); elseif (z <= 9.6e+272) tmp = Float64(x * Float64(t / z)); else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -8.2e+91) tmp = x * (y / z); elseif (z <= -1.7e+15) tmp = t / (z / x); elseif (z <= 30000.0) tmp = x * ((y / z) - t); elseif (z <= 9.6e+272) tmp = x * (t / z); else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -8.2e+91], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.7e+15], N[(t / N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 30000.0], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.6e+272], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.2 \cdot 10^{+91}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;z \leq -1.7 \cdot 10^{+15}:\\
\;\;\;\;\frac{t}{\frac{z}{x}}\\
\mathbf{elif}\;z \leq 30000:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{elif}\;z \leq 9.6 \cdot 10^{+272}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if z < -8.2000000000000005e91Initial program 93.4%
Taylor expanded in y around inf 49.6%
associate-*r/57.7%
Simplified57.7%
if -8.2000000000000005e91 < z < -1.7e15Initial program 99.7%
Taylor expanded in y around 0 68.4%
mul-1-neg68.4%
distribute-neg-frac268.4%
neg-sub068.4%
associate--r-68.4%
metadata-eval68.4%
Simplified68.4%
Taylor expanded in z around inf 62.3%
associate-/l*68.3%
Simplified68.3%
clear-num68.4%
un-div-inv68.4%
Applied egg-rr68.4%
if -1.7e15 < z < 3e4Initial program 91.3%
Taylor expanded in z around 0 89.3%
mul-1-neg89.3%
unsub-neg89.3%
div-sub89.3%
associate-/l*89.4%
*-inverses89.4%
*-rgt-identity89.4%
Simplified89.4%
if 3e4 < z < 9.6000000000000001e272Initial program 99.8%
Taylor expanded in y around 0 70.5%
mul-1-neg70.5%
distribute-neg-frac270.5%
neg-sub070.5%
associate--r-70.5%
metadata-eval70.5%
Simplified70.5%
Taylor expanded in z around inf 70.3%
if 9.6000000000000001e272 < z Initial program 88.4%
Taylor expanded in y around inf 87.6%
associate-*r/88.4%
Simplified88.4%
clear-num88.4%
un-div-inv88.6%
Applied egg-rr88.6%
associate-/r/99.6%
Simplified99.6%
Final simplification78.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4.9e-85) (not (<= y 7e+77))) (/ (* y x) z) (* x (/ t (+ z -1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.9e-85) || !(y <= 7e+77)) {
tmp = (y * x) / z;
} else {
tmp = x * (t / (z + -1.0));
}
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 ((y <= (-4.9d-85)) .or. (.not. (y <= 7d+77))) then
tmp = (y * x) / z
else
tmp = x * (t / (z + (-1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.9e-85) || !(y <= 7e+77)) {
tmp = (y * x) / z;
} else {
tmp = x * (t / (z + -1.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -4.9e-85) or not (y <= 7e+77): tmp = (y * x) / z else: tmp = x * (t / (z + -1.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -4.9e-85) || !(y <= 7e+77)) tmp = Float64(Float64(y * x) / z); else tmp = Float64(x * Float64(t / Float64(z + -1.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -4.9e-85) || ~((y <= 7e+77))) tmp = (y * x) / z; else tmp = x * (t / (z + -1.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4.9e-85], N[Not[LessEqual[y, 7e+77]], $MachinePrecision]], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision], N[(x * N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.9 \cdot 10^{-85} \lor \neg \left(y \leq 7 \cdot 10^{+77}\right):\\
\;\;\;\;\frac{y \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z + -1}\\
\end{array}
\end{array}
if y < -4.90000000000000015e-85 or 7.0000000000000003e77 < y Initial program 91.0%
Taylor expanded in y around inf 83.9%
if -4.90000000000000015e-85 < y < 7.0000000000000003e77Initial program 96.4%
Taylor expanded in y around 0 74.1%
mul-1-neg74.1%
distribute-neg-frac274.1%
neg-sub074.1%
associate--r-74.1%
metadata-eval74.1%
Simplified74.1%
Final simplification79.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -10.0) (not (<= z 3.1e-29))) (* x (/ (+ y t) z)) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -10.0) || !(z <= 3.1e-29)) {
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 <= (-10.0d0)) .or. (.not. (z <= 3.1d-29))) 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 <= -10.0) || !(z <= 3.1e-29)) {
tmp = x * ((y + t) / z);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -10.0) or not (z <= 3.1e-29): tmp = x * ((y + t) / z) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -10.0) || !(z <= 3.1e-29)) 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 <= -10.0) || ~((z <= 3.1e-29))) 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, -10.0], N[Not[LessEqual[z, 3.1e-29]], $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 -10 \lor \neg \left(z \leq 3.1 \cdot 10^{-29}\right):\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -10 or 3.10000000000000026e-29 < z Initial program 96.4%
Taylor expanded in z around inf 85.8%
*-commutative85.8%
remove-double-neg85.8%
cancel-sign-sub-inv85.8%
metadata-eval85.8%
*-lft-identity85.8%
distribute-neg-out85.8%
neg-mul-185.8%
sub-neg85.8%
distribute-lft-neg-in85.8%
*-commutative85.8%
distribute-neg-frac85.8%
associate-/l*95.4%
distribute-rgt-neg-in95.4%
distribute-neg-frac95.4%
Simplified95.4%
if -10 < z < 3.10000000000000026e-29Initial program 90.8%
Taylor expanded in z around 0 90.1%
mul-1-neg90.1%
unsub-neg90.1%
div-sub90.1%
associate-/l*90.2%
*-inverses90.2%
*-rgt-identity90.2%
Simplified90.2%
Final simplification92.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 3.1e-29))) (* t (/ x z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 3.1e-29)) {
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 <= (-1.0d0)) .or. (.not. (z <= 3.1d-29))) 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 <= -1.0) || !(z <= 3.1e-29)) {
tmp = t * (x / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.0) or not (z <= 3.1e-29): tmp = t * (x / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.0) || !(z <= 3.1e-29)) 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 <= -1.0) || ~((z <= 3.1e-29))) tmp = t * (x / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 3.1e-29]], $MachinePrecision]], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 3.1 \cdot 10^{-29}\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -1 or 3.10000000000000026e-29 < z Initial program 96.5%
Taylor expanded in y around 0 57.0%
mul-1-neg57.0%
distribute-neg-frac257.0%
neg-sub057.0%
associate--r-57.0%
metadata-eval57.0%
Simplified57.0%
Taylor expanded in z around inf 49.6%
associate-/l*52.6%
Simplified52.6%
if -1 < z < 3.10000000000000026e-29Initial program 90.7%
Taylor expanded in y around 0 35.2%
mul-1-neg35.2%
distribute-neg-frac235.2%
neg-sub035.2%
associate--r-35.2%
metadata-eval35.2%
Simplified35.2%
Taylor expanded in z around 0 34.6%
mul-1-neg34.6%
Simplified34.6%
Final simplification43.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 3.1e-29))) (* x (/ t z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 3.1e-29)) {
tmp = x * (t / 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 <= (-1.0d0)) .or. (.not. (z <= 3.1d-29))) then
tmp = x * (t / 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 <= -1.0) || !(z <= 3.1e-29)) {
tmp = x * (t / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.0) or not (z <= 3.1e-29): tmp = x * (t / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.0) || !(z <= 3.1e-29)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(x * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.0) || ~((z <= 3.1e-29))) tmp = x * (t / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 3.1e-29]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 3.1 \cdot 10^{-29}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -1 or 3.10000000000000026e-29 < z Initial program 96.5%
Taylor expanded in y around 0 57.0%
mul-1-neg57.0%
distribute-neg-frac257.0%
neg-sub057.0%
associate--r-57.0%
metadata-eval57.0%
Simplified57.0%
Taylor expanded in z around inf 56.2%
if -1 < z < 3.10000000000000026e-29Initial program 90.7%
Taylor expanded in y around 0 35.2%
mul-1-neg35.2%
distribute-neg-frac235.2%
neg-sub035.2%
associate--r-35.2%
metadata-eval35.2%
Simplified35.2%
Taylor expanded in z around 0 34.6%
mul-1-neg34.6%
Simplified34.6%
Final simplification45.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.6e+154) (not (<= t 1.35e+149))) (* x (/ t z)) (* x (/ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.6e+154) || !(t <= 1.35e+149)) {
tmp = x * (t / z);
} else {
tmp = x * (y / 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 <= (-3.6d+154)) .or. (.not. (t <= 1.35d+149))) then
tmp = x * (t / z)
else
tmp = x * (y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.6e+154) || !(t <= 1.35e+149)) {
tmp = x * (t / z);
} else {
tmp = x * (y / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3.6e+154) or not (t <= 1.35e+149): tmp = x * (t / z) else: tmp = x * (y / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3.6e+154) || !(t <= 1.35e+149)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(x * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -3.6e+154) || ~((t <= 1.35e+149))) tmp = x * (t / z); else tmp = x * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3.6e+154], N[Not[LessEqual[t, 1.35e+149]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.6 \cdot 10^{+154} \lor \neg \left(t \leq 1.35 \cdot 10^{+149}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\end{array}
\end{array}
if t < -3.6000000000000001e154 or 1.35e149 < t Initial program 95.3%
Taylor expanded in y around 0 84.7%
mul-1-neg84.7%
distribute-neg-frac284.7%
neg-sub084.7%
associate--r-84.7%
metadata-eval84.7%
Simplified84.7%
Taylor expanded in z around inf 51.2%
if -3.6000000000000001e154 < t < 1.35e149Initial program 93.1%
Taylor expanded in y around inf 72.5%
associate-*r/73.1%
Simplified73.1%
Final simplification67.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -7e+153) (not (<= t 2.7e+149))) (* x (/ t z)) (/ x (/ z y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7e+153) || !(t <= 2.7e+149)) {
tmp = x * (t / z);
} else {
tmp = x / (z / y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-7d+153)) .or. (.not. (t <= 2.7d+149))) then
tmp = x * (t / z)
else
tmp = x / (z / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7e+153) || !(t <= 2.7e+149)) {
tmp = x * (t / z);
} else {
tmp = x / (z / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -7e+153) or not (t <= 2.7e+149): tmp = x * (t / z) else: tmp = x / (z / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -7e+153) || !(t <= 2.7e+149)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(x / Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -7e+153) || ~((t <= 2.7e+149))) tmp = x * (t / z); else tmp = x / (z / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -7e+153], N[Not[LessEqual[t, 2.7e+149]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7 \cdot 10^{+153} \lor \neg \left(t \leq 2.7 \cdot 10^{+149}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\end{array}
\end{array}
if t < -6.9999999999999998e153 or 2.7000000000000001e149 < t Initial program 95.3%
Taylor expanded in y around 0 84.7%
mul-1-neg84.7%
distribute-neg-frac284.7%
neg-sub084.7%
associate--r-84.7%
metadata-eval84.7%
Simplified84.7%
Taylor expanded in z around inf 51.2%
if -6.9999999999999998e153 < t < 2.7000000000000001e149Initial program 93.1%
Taylor expanded in y around inf 72.5%
associate-*r/73.1%
Simplified73.1%
clear-num73.0%
un-div-inv73.1%
Applied egg-rr73.1%
Final simplification67.6%
(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 93.7%
Taylor expanded in y around 0 46.4%
mul-1-neg46.4%
distribute-neg-frac246.4%
neg-sub046.4%
associate--r-46.4%
metadata-eval46.4%
Simplified46.4%
Taylor expanded in z around 0 22.5%
mul-1-neg22.5%
Simplified22.5%
Final simplification22.5%
(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 2024115
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
:precision binary64
:alt
(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)))))