
(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 9 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 (or (<= t_1 (- INFINITY)) (not (<= t_1 1e+291)))
(* y (/ x z))
(* x t_1))))
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)) || !(t_1 <= 1e+291)) {
tmp = y * (x / z);
} else {
tmp = x * t_1;
}
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) || !(t_1 <= 1e+291)) {
tmp = y * (x / z);
} else {
tmp = x * t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / z) - (t / (1.0 - z)) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 1e+291): tmp = y * (x / z) else: tmp = x * t_1 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)) || !(t_1 <= 1e+291)) tmp = Float64(y * Float64(x / z)); else tmp = Float64(x * t_1); 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) || ~((t_1 <= 1e+291))) tmp = y * (x / z); else tmp = x * t_1; 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[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 1e+291]], $MachinePrecision]], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} - \frac{t}{1 - z}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 10^{+291}\right):\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\_1\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -inf.0 or 9.9999999999999996e290 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 54.9%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6451.8
Applied rewrites51.8%
Applied rewrites99.9%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 9.9999999999999996e290Initial program 97.1%
Final simplification97.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ x z)))
(t_2 (- (/ y z) (/ t (- 1.0 z))))
(t_3 (* x (- (/ y z) t))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 -1e-58)
t_3
(if (<= t_2 5e-174)
(/ (* t x) z)
(if (<= t_2 5e+70) (* (/ y z) x) (if (<= t_2 1e+291) t_3 t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (x / z);
double t_2 = (y / z) - (t / (1.0 - z));
double t_3 = x * ((y / z) - t);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= -1e-58) {
tmp = t_3;
} else if (t_2 <= 5e-174) {
tmp = (t * x) / z;
} else if (t_2 <= 5e+70) {
tmp = (y / z) * x;
} else if (t_2 <= 1e+291) {
tmp = t_3;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = y * (x / z);
double t_2 = (y / z) - (t / (1.0 - z));
double t_3 = x * ((y / z) - t);
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= -1e-58) {
tmp = t_3;
} else if (t_2 <= 5e-174) {
tmp = (t * x) / z;
} else if (t_2 <= 5e+70) {
tmp = (y / z) * x;
} else if (t_2 <= 1e+291) {
tmp = t_3;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (x / z) t_2 = (y / z) - (t / (1.0 - z)) t_3 = x * ((y / z) - t) tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= -1e-58: tmp = t_3 elif t_2 <= 5e-174: tmp = (t * x) / z elif t_2 <= 5e+70: tmp = (y / z) * x elif t_2 <= 1e+291: tmp = t_3 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(x / z)) t_2 = Float64(Float64(y / z) - Float64(t / Float64(1.0 - z))) t_3 = Float64(x * Float64(Float64(y / z) - t)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= -1e-58) tmp = t_3; elseif (t_2 <= 5e-174) tmp = Float64(Float64(t * x) / z); elseif (t_2 <= 5e+70) tmp = Float64(Float64(y / z) * x); elseif (t_2 <= 1e+291) tmp = t_3; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (x / z); t_2 = (y / z) - (t / (1.0 - z)); t_3 = x * ((y / z) - t); tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= -1e-58) tmp = t_3; elseif (t_2 <= 5e-174) tmp = (t * x) / z; elseif (t_2 <= 5e+70) tmp = (y / z) * x; elseif (t_2 <= 1e+291) tmp = t_3; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, -1e-58], t$95$3, If[LessEqual[t$95$2, 5e-174], N[(N[(t * x), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t$95$2, 5e+70], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t$95$2, 1e+291], t$95$3, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{x}{z}\\
t_2 := \frac{y}{z} - \frac{t}{1 - z}\\
t_3 := x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-58}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-174}:\\
\;\;\;\;\frac{t \cdot x}{z}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+70}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{elif}\;t\_2 \leq 10^{+291}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -inf.0 or 9.9999999999999996e290 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 54.9%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6451.8
Applied rewrites51.8%
Applied rewrites99.9%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -1e-58 or 5.0000000000000002e70 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 9.9999999999999996e290Initial program 99.9%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-out--N/A
unsub-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-*.f6474.8
Applied rewrites74.8%
Taylor expanded in y around 0
Applied rewrites81.0%
if -1e-58 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 5.0000000000000002e-174Initial program 87.3%
Taylor expanded in z around inf
*-lft-identityN/A
metadata-evalN/A
associate-*r*N/A
distribute-lft-out--N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
remove-double-negN/A
mul-1-negN/A
distribute-neg-inN/A
+-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites93.9%
Taylor expanded in z around inf
Applied rewrites98.0%
Taylor expanded in y around 0
Applied rewrites74.5%
if 5.0000000000000002e-174 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 5.0000000000000002e70Initial program 99.7%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6470.8
Applied rewrites70.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -0.98) (not (<= z 5.2e-10))) (* x (/ (+ t y) z)) (/ (* x (- y (* t z))) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.98) || !(z <= 5.2e-10)) {
tmp = x * ((t + y) / z);
} else {
tmp = (x * (y - (t * z))) / 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 <= (-0.98d0)) .or. (.not. (z <= 5.2d-10))) then
tmp = x * ((t + y) / z)
else
tmp = (x * (y - (t * z))) / z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.98) || !(z <= 5.2e-10)) {
tmp = x * ((t + y) / z);
} else {
tmp = (x * (y - (t * z))) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -0.98) or not (z <= 5.2e-10): tmp = x * ((t + y) / z) else: tmp = (x * (y - (t * z))) / z return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -0.98) || !(z <= 5.2e-10)) tmp = Float64(x * Float64(Float64(t + y) / z)); else tmp = Float64(Float64(x * Float64(y - Float64(t * z))) / z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -0.98) || ~((z <= 5.2e-10))) tmp = x * ((t + y) / z); else tmp = (x * (y - (t * z))) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -0.98], N[Not[LessEqual[z, 5.2e-10]], $MachinePrecision]], N[(x * N[(N[(t + y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(y - N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.98 \lor \neg \left(z \leq 5.2 \cdot 10^{-10}\right):\\
\;\;\;\;x \cdot \frac{t + y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(y - t \cdot z\right)}{z}\\
\end{array}
\end{array}
if z < -0.97999999999999998 or 5.19999999999999962e-10 < z Initial program 95.1%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6494.7
Applied rewrites94.7%
if -0.97999999999999998 < z < 5.19999999999999962e-10Initial program 88.6%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-out--N/A
unsub-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-*.f6494.3
Applied rewrites94.3%
Final simplification94.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 5.2e-10))) (* x (/ (+ t y) z)) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 5.2e-10)) {
tmp = x * ((t + y) / 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 <= 5.2d-10))) then
tmp = x * ((t + y) / 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 <= 5.2e-10)) {
tmp = x * ((t + y) / z);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.0) or not (z <= 5.2e-10): tmp = x * ((t + y) / z) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.0) || !(z <= 5.2e-10)) tmp = Float64(x * Float64(Float64(t + y) / 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 <= 5.2e-10))) tmp = x * ((t + y) / 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, 5.2e-10]], $MachinePrecision]], N[(x * N[(N[(t + y), $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 5.2 \cdot 10^{-10}\right):\\
\;\;\;\;x \cdot \frac{t + y}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -1 or 5.19999999999999962e-10 < z Initial program 95.1%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6494.7
Applied rewrites94.7%
if -1 < z < 5.19999999999999962e-10Initial program 88.6%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-out--N/A
unsub-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-*.f6494.3
Applied rewrites94.3%
Taylor expanded in y around 0
Applied rewrites88.4%
Final simplification91.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.28e-19) (not (<= z 160000000.0))) (/ (* (+ y t) x) z) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.28e-19) || !(z <= 160000000.0)) {
tmp = ((y + t) * x) / 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.28d-19)) .or. (.not. (z <= 160000000.0d0))) then
tmp = ((y + t) * x) / 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.28e-19) || !(z <= 160000000.0)) {
tmp = ((y + t) * x) / z;
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.28e-19) or not (z <= 160000000.0): tmp = ((y + t) * x) / z else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.28e-19) || !(z <= 160000000.0)) tmp = Float64(Float64(Float64(y + t) * x) / 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.28e-19) || ~((z <= 160000000.0))) tmp = ((y + t) * x) / z; else tmp = x * ((y / z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.28e-19], N[Not[LessEqual[z, 160000000.0]], $MachinePrecision]], N[(N[(N[(y + t), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.28 \cdot 10^{-19} \lor \neg \left(z \leq 160000000\right):\\
\;\;\;\;\frac{\left(y + t\right) \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -1.27999999999999988e-19 or 1.6e8 < z Initial program 95.0%
Taylor expanded in z around inf
*-lft-identityN/A
metadata-evalN/A
associate-*r*N/A
distribute-lft-out--N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
remove-double-negN/A
mul-1-negN/A
distribute-neg-inN/A
+-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites91.0%
Taylor expanded in z around inf
Applied rewrites90.5%
if -1.27999999999999988e-19 < z < 1.6e8Initial program 89.0%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-out--N/A
unsub-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-*.f6494.5
Applied rewrites94.5%
Taylor expanded in y around 0
Applied rewrites88.8%
Final simplification89.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.6e+102) (not (<= t 9e+81))) (* x (/ t z)) (* y (/ x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.6e+102) || !(t <= 9e+81)) {
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 ((t <= (-3.6d+102)) .or. (.not. (t <= 9d+81))) 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 ((t <= -3.6e+102) || !(t <= 9e+81)) {
tmp = x * (t / z);
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3.6e+102) or not (t <= 9e+81): tmp = x * (t / z) else: tmp = y * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3.6e+102) || !(t <= 9e+81)) 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 ((t <= -3.6e+102) || ~((t <= 9e+81))) tmp = x * (t / z); else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3.6e+102], N[Not[LessEqual[t, 9e+81]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.6 \cdot 10^{+102} \lor \neg \left(t \leq 9 \cdot 10^{+81}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if t < -3.6000000000000002e102 or 9.00000000000000034e81 < t Initial program 97.8%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6467.9
Applied rewrites67.9%
Taylor expanded in y around 0
Applied rewrites59.4%
if -3.6000000000000002e102 < t < 9.00000000000000034e81Initial program 88.6%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6477.5
Applied rewrites77.5%
Applied rewrites80.6%
Final simplification72.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.96e+105) (not (<= t 3.15e+195))) (* x (- t)) (* y (/ x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.96e+105) || !(t <= 3.15e+195)) {
tmp = x * -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 <= (-1.96d+105)) .or. (.not. (t <= 3.15d+195))) then
tmp = x * -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 <= -1.96e+105) || !(t <= 3.15e+195)) {
tmp = x * -t;
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.96e+105) or not (t <= 3.15e+195): tmp = x * -t else: tmp = y * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.96e+105) || !(t <= 3.15e+195)) tmp = Float64(x * Float64(-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 <= -1.96e+105) || ~((t <= 3.15e+195))) tmp = x * -t; else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.96e+105], N[Not[LessEqual[t, 3.15e+195]], $MachinePrecision]], N[(x * (-t)), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.96 \cdot 10^{+105} \lor \neg \left(t \leq 3.15 \cdot 10^{+195}\right):\\
\;\;\;\;x \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if t < -1.95999999999999994e105 or 3.15e195 < t Initial program 97.1%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
sub-negN/A
lower--.f6489.7
Applied rewrites89.7%
Taylor expanded in z around 0
Applied rewrites52.3%
if -1.95999999999999994e105 < t < 3.15e195Initial program 90.1%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6472.8
Applied rewrites72.8%
Applied rewrites75.5%
Final simplification69.4%
(FPCore (x y z t) :precision binary64 (if (<= t -4.8e+104) (/ (* t x) z) (if (<= t 3.15e+195) (* y (/ x z)) (* x (- t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -4.8e+104) {
tmp = (t * x) / z;
} else if (t <= 3.15e+195) {
tmp = y * (x / z);
} else {
tmp = x * -t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-4.8d+104)) then
tmp = (t * x) / z
else if (t <= 3.15d+195) then
tmp = y * (x / z)
else
tmp = x * -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -4.8e+104) {
tmp = (t * x) / z;
} else if (t <= 3.15e+195) {
tmp = y * (x / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -4.8e+104: tmp = (t * x) / z elif t <= 3.15e+195: tmp = y * (x / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -4.8e+104) tmp = Float64(Float64(t * x) / z); elseif (t <= 3.15e+195) tmp = Float64(y * Float64(x / z)); else tmp = Float64(x * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -4.8e+104) tmp = (t * x) / z; elseif (t <= 3.15e+195) tmp = y * (x / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -4.8e+104], N[(N[(t * x), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t, 3.15e+195], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.8 \cdot 10^{+104}:\\
\;\;\;\;\frac{t \cdot x}{z}\\
\mathbf{elif}\;t \leq 3.15 \cdot 10^{+195}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if t < -4.8e104Initial program 97.7%
Taylor expanded in z around inf
*-lft-identityN/A
metadata-evalN/A
associate-*r*N/A
distribute-lft-out--N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
remove-double-negN/A
mul-1-negN/A
distribute-neg-inN/A
+-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites49.6%
Taylor expanded in z around inf
Applied rewrites60.7%
Taylor expanded in y around 0
Applied rewrites56.2%
if -4.8e104 < t < 3.15e195Initial program 90.1%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6472.8
Applied rewrites72.8%
Applied rewrites75.5%
if 3.15e195 < t Initial program 96.1%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
sub-negN/A
lower--.f6487.8
Applied rewrites87.8%
Taylor expanded in z around 0
Applied rewrites59.4%
(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 92.0%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
sub-negN/A
lower--.f6445.2
Applied rewrites45.2%
Taylor expanded in z around 0
Applied rewrites22.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 2024318
(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)))))