
(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 (+ z -1.0))))) (if (<= t_1 5e+298) (* t_1 x) (* y (/ x z)))))
double code(double x, double y, double z, double t) {
double t_1 = (y / z) + (t / (z + -1.0));
double tmp;
if (t_1 <= 5e+298) {
tmp = t_1 * x;
} 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) :: t_1
real(8) :: tmp
t_1 = (y / z) + (t / (z + (-1.0d0)))
if (t_1 <= 5d+298) then
tmp = t_1 * x
else
tmp = y * (x / z)
end if
code = tmp
end function
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+298) {
tmp = t_1 * x;
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / z) + (t / (z + -1.0)) tmp = 0 if t_1 <= 5e+298: tmp = t_1 * x else: tmp = y * (x / z) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y / z) + Float64(t / Float64(z + -1.0))) tmp = 0.0 if (t_1 <= 5e+298) tmp = Float64(t_1 * x); else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y / z) + (t / (z + -1.0)); tmp = 0.0; if (t_1 <= 5e+298) tmp = t_1 * x; else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / z), $MachinePrecision] + N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+298], N[(t$95$1 * x), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} + \frac{t}{z + -1}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{+298}:\\
\;\;\;\;t\_1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 5.0000000000000003e298Initial program 98.2%
if 5.0000000000000003e298 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 48.6%
Taylor expanded in t around inf 48.6%
Taylor expanded in t around 0 99.6%
*-commutative99.6%
associate-*r/100.0%
Simplified100.0%
Final simplification98.3%
(FPCore (x y z t)
:precision binary64
(if (or (<= z -1.4e-15)
(not
(or (<= z -1.55e-215) (and (not (<= z 7.2e-269)) (<= z 35000.0)))))
(* t (/ x z))
(* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.4e-15) || !((z <= -1.55e-215) || (!(z <= 7.2e-269) && (z <= 35000.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 <= (-1.4d-15)) .or. (.not. (z <= (-1.55d-215)) .or. (.not. (z <= 7.2d-269)) .and. (z <= 35000.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 <= -1.4e-15) || !((z <= -1.55e-215) || (!(z <= 7.2e-269) && (z <= 35000.0)))) {
tmp = t * (x / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.4e-15) or not ((z <= -1.55e-215) or (not (z <= 7.2e-269) and (z <= 35000.0))): tmp = t * (x / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.4e-15) || !((z <= -1.55e-215) || (!(z <= 7.2e-269) && (z <= 35000.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 <= -1.4e-15) || ~(((z <= -1.55e-215) || (~((z <= 7.2e-269)) && (z <= 35000.0))))) tmp = t * (x / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.4e-15], N[Not[Or[LessEqual[z, -1.55e-215], And[N[Not[LessEqual[z, 7.2e-269]], $MachinePrecision], LessEqual[z, 35000.0]]]], $MachinePrecision]], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{-15} \lor \neg \left(z \leq -1.55 \cdot 10^{-215} \lor \neg \left(z \leq 7.2 \cdot 10^{-269}\right) \land z \leq 35000\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -1.40000000000000007e-15 or -1.54999999999999997e-215 < z < 7.19999999999999996e-269 or 35000 < z Initial program 98.3%
Taylor expanded in z around inf 84.4%
*-commutative84.4%
remove-double-neg84.4%
cancel-sign-sub-inv84.4%
metadata-eval84.4%
*-lft-identity84.4%
distribute-neg-out84.4%
neg-mul-184.4%
sub-neg84.4%
distribute-lft-neg-in84.4%
*-commutative84.4%
distribute-neg-frac84.4%
associate-/l*92.1%
distribute-rgt-neg-in92.1%
distribute-neg-frac92.1%
Simplified92.1%
Taylor expanded in t around inf 49.3%
associate-/l*52.4%
Simplified52.4%
if -1.40000000000000007e-15 < z < -1.54999999999999997e-215 or 7.19999999999999996e-269 < z < 35000Initial program 92.4%
Taylor expanded in z around 0 91.2%
mul-1-neg91.2%
unsub-neg91.2%
div-sub91.2%
associate-/l*91.3%
*-inverses91.3%
*-rgt-identity91.3%
Simplified91.3%
Taylor expanded in y around 0 34.1%
mul-1-neg34.1%
distribute-lft-neg-out34.1%
*-commutative34.1%
Simplified34.1%
Final simplification44.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t z))) (t_2 (* x (- t))))
(if (<= z -0.00026)
t_1
(if (<= z -2.1e-215)
t_2
(if (<= z 1.4e-268) (* t (/ x z)) (if (<= z 35000.0) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double t_2 = x * -t;
double tmp;
if (z <= -0.00026) {
tmp = t_1;
} else if (z <= -2.1e-215) {
tmp = t_2;
} else if (z <= 1.4e-268) {
tmp = t * (x / z);
} else if (z <= 35000.0) {
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 = x * (t / z)
t_2 = x * -t
if (z <= (-0.00026d0)) then
tmp = t_1
else if (z <= (-2.1d-215)) then
tmp = t_2
else if (z <= 1.4d-268) then
tmp = t * (x / z)
else if (z <= 35000.0d0) 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 = x * (t / z);
double t_2 = x * -t;
double tmp;
if (z <= -0.00026) {
tmp = t_1;
} else if (z <= -2.1e-215) {
tmp = t_2;
} else if (z <= 1.4e-268) {
tmp = t * (x / z);
} else if (z <= 35000.0) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / z) t_2 = x * -t tmp = 0 if z <= -0.00026: tmp = t_1 elif z <= -2.1e-215: tmp = t_2 elif z <= 1.4e-268: tmp = t * (x / z) elif z <= 35000.0: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / z)) t_2 = Float64(x * Float64(-t)) tmp = 0.0 if (z <= -0.00026) tmp = t_1; elseif (z <= -2.1e-215) tmp = t_2; elseif (z <= 1.4e-268) tmp = Float64(t * Float64(x / z)); elseif (z <= 35000.0) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / z); t_2 = x * -t; tmp = 0.0; if (z <= -0.00026) tmp = t_1; elseif (z <= -2.1e-215) tmp = t_2; elseif (z <= 1.4e-268) tmp = t * (x / z); elseif (z <= 35000.0) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * (-t)), $MachinePrecision]}, If[LessEqual[z, -0.00026], t$95$1, If[LessEqual[z, -2.1e-215], t$95$2, If[LessEqual[z, 1.4e-268], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 35000.0], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
t_2 := x \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -0.00026:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.1 \cdot 10^{-215}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-268}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 35000:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.59999999999999977e-4 or 35000 < z Initial program 99.5%
Taylor expanded in z around inf 88.1%
*-commutative88.1%
remove-double-neg88.1%
cancel-sign-sub-inv88.1%
metadata-eval88.1%
*-lft-identity88.1%
distribute-neg-out88.1%
neg-mul-188.1%
sub-neg88.1%
distribute-lft-neg-in88.1%
*-commutative88.1%
distribute-neg-frac88.1%
associate-/l*98.6%
distribute-rgt-neg-in98.6%
distribute-neg-frac98.6%
Simplified98.6%
Taylor expanded in t around inf 61.3%
if -2.59999999999999977e-4 < z < -2.1e-215 or 1.40000000000000008e-268 < z < 35000Initial program 92.6%
Taylor expanded in z around 0 91.4%
mul-1-neg91.4%
unsub-neg91.4%
div-sub91.4%
associate-/l*91.4%
*-inverses91.4%
*-rgt-identity91.4%
Simplified91.4%
Taylor expanded in y around 0 34.1%
mul-1-neg34.1%
distribute-lft-neg-out34.1%
*-commutative34.1%
Simplified34.1%
if -2.1e-215 < z < 1.40000000000000008e-268Initial program 92.9%
Taylor expanded in z around inf 70.9%
*-commutative70.9%
remove-double-neg70.9%
cancel-sign-sub-inv70.9%
metadata-eval70.9%
*-lft-identity70.9%
distribute-neg-out70.9%
neg-mul-170.9%
sub-neg70.9%
distribute-lft-neg-in70.9%
*-commutative70.9%
distribute-neg-frac70.9%
associate-/l*67.3%
distribute-rgt-neg-in67.3%
distribute-neg-frac67.3%
Simplified67.3%
Taylor expanded in t around inf 24.5%
associate-/l*38.4%
Simplified38.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -61000.0) (not (<= z 0.0126))) (* x (/ (+ y t) z)) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -61000.0) || !(z <= 0.0126)) {
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 <= (-61000.0d0)) .or. (.not. (z <= 0.0126d0))) 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 <= -61000.0) || !(z <= 0.0126)) {
tmp = x * ((y + t) / z);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -61000.0) or not (z <= 0.0126): tmp = x * ((y + t) / z) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -61000.0) || !(z <= 0.0126)) 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 <= -61000.0) || ~((z <= 0.0126))) 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, -61000.0], N[Not[LessEqual[z, 0.0126]], $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 -61000 \lor \neg \left(z \leq 0.0126\right):\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -61000 or 0.0126 < z Initial program 99.5%
Taylor expanded in z around inf 88.2%
*-commutative88.2%
remove-double-neg88.2%
cancel-sign-sub-inv88.2%
metadata-eval88.2%
*-lft-identity88.2%
distribute-neg-out88.2%
neg-mul-188.2%
sub-neg88.2%
distribute-lft-neg-in88.2%
*-commutative88.2%
distribute-neg-frac88.2%
associate-/l*98.7%
distribute-rgt-neg-in98.7%
distribute-neg-frac98.7%
Simplified98.7%
if -61000 < z < 0.0126Initial program 92.6%
Taylor expanded in z around 0 91.6%
mul-1-neg91.6%
unsub-neg91.6%
div-sub91.6%
associate-/l*91.6%
*-inverses91.6%
*-rgt-identity91.6%
Simplified91.6%
Final simplification94.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.8e+141) (not (<= z 5e+143))) (* x (/ t z)) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.8e+141) || !(z <= 5e+143)) {
tmp = x * (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 <= (-5.8d+141)) .or. (.not. (z <= 5d+143))) then
tmp = x * (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 <= -5.8e+141) || !(z <= 5e+143)) {
tmp = x * (t / z);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.8e+141) or not (z <= 5e+143): tmp = x * (t / z) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.8e+141) || !(z <= 5e+143)) tmp = Float64(x * Float64(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 <= -5.8e+141) || ~((z <= 5e+143))) tmp = x * (t / z); else tmp = x * ((y / z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.8e+141], N[Not[LessEqual[z, 5e+143]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+141} \lor \neg \left(z \leq 5 \cdot 10^{+143}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -5.80000000000000013e141 or 5.00000000000000012e143 < z Initial program 99.3%
Taylor expanded in z around inf 86.2%
*-commutative86.2%
remove-double-neg86.2%
cancel-sign-sub-inv86.2%
metadata-eval86.2%
*-lft-identity86.2%
distribute-neg-out86.2%
neg-mul-186.2%
sub-neg86.2%
distribute-lft-neg-in86.2%
*-commutative86.2%
distribute-neg-frac86.2%
associate-/l*99.3%
distribute-rgt-neg-in99.3%
distribute-neg-frac99.3%
Simplified99.3%
Taylor expanded in t around inf 77.3%
if -5.80000000000000013e141 < z < 5.00000000000000012e143Initial program 94.6%
Taylor expanded in z around 0 83.6%
mul-1-neg83.6%
unsub-neg83.6%
div-sub83.6%
associate-/l*83.6%
*-inverses83.6%
*-rgt-identity83.6%
Simplified83.6%
Final simplification82.3%
(FPCore (x y z t) :precision binary64 (if (<= z -61000.0) (* x (+ (/ y z) (/ t z))) (if (<= z 0.0126) (* x (- (/ y z) t)) (* x (/ (+ y t) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -61000.0) {
tmp = x * ((y / z) + (t / z));
} else if (z <= 0.0126) {
tmp = x * ((y / z) - t);
} else {
tmp = x * ((y + 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 <= (-61000.0d0)) then
tmp = x * ((y / z) + (t / z))
else if (z <= 0.0126d0) then
tmp = x * ((y / z) - t)
else
tmp = x * ((y + t) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -61000.0) {
tmp = x * ((y / z) + (t / z));
} else if (z <= 0.0126) {
tmp = x * ((y / z) - t);
} else {
tmp = x * ((y + t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -61000.0: tmp = x * ((y / z) + (t / z)) elif z <= 0.0126: tmp = x * ((y / z) - t) else: tmp = x * ((y + t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -61000.0) tmp = Float64(x * Float64(Float64(y / z) + Float64(t / z))); elseif (z <= 0.0126) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(x * Float64(Float64(y + t) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -61000.0) tmp = x * ((y / z) + (t / z)); elseif (z <= 0.0126) tmp = x * ((y / z) - t); else tmp = x * ((y + t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -61000.0], N[(x * N[(N[(y / z), $MachinePrecision] + N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.0126], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -61000:\\
\;\;\;\;x \cdot \left(\frac{y}{z} + \frac{t}{z}\right)\\
\mathbf{elif}\;z \leq 0.0126:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\end{array}
\end{array}
if z < -61000Initial program 99.4%
Taylor expanded in z around inf 98.6%
associate-*r/98.6%
neg-mul-198.6%
Simplified98.6%
if -61000 < z < 0.0126Initial program 92.6%
Taylor expanded in z around 0 91.6%
mul-1-neg91.6%
unsub-neg91.6%
div-sub91.6%
associate-/l*91.6%
*-inverses91.6%
*-rgt-identity91.6%
Simplified91.6%
if 0.0126 < z Initial program 99.7%
Taylor expanded in z around inf 88.0%
*-commutative88.0%
remove-double-neg88.0%
cancel-sign-sub-inv88.0%
metadata-eval88.0%
*-lft-identity88.0%
distribute-neg-out88.0%
neg-mul-188.0%
sub-neg88.0%
distribute-lft-neg-in88.0%
*-commutative88.0%
distribute-neg-frac88.0%
associate-/l*98.7%
distribute-rgt-neg-in98.7%
distribute-neg-frac98.7%
Simplified98.7%
Final simplification94.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -8e+146) (not (<= z 6.4e+216))) (* x (/ t z)) (* y (/ x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8e+146) || !(z <= 6.4e+216)) {
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 <= (-8d+146)) .or. (.not. (z <= 6.4d+216))) 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 <= -8e+146) || !(z <= 6.4e+216)) {
tmp = x * (t / z);
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -8e+146) or not (z <= 6.4e+216): tmp = x * (t / z) else: tmp = y * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -8e+146) || !(z <= 6.4e+216)) 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 <= -8e+146) || ~((z <= 6.4e+216))) tmp = x * (t / z); else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -8e+146], N[Not[LessEqual[z, 6.4e+216]], $MachinePrecision]], 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 \cdot 10^{+146} \lor \neg \left(z \leq 6.4 \cdot 10^{+216}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if z < -7.99999999999999947e146 or 6.3999999999999994e216 < z Initial program 99.3%
Taylor expanded in z around inf 85.9%
*-commutative85.9%
remove-double-neg85.9%
cancel-sign-sub-inv85.9%
metadata-eval85.9%
*-lft-identity85.9%
distribute-neg-out85.9%
neg-mul-185.9%
sub-neg85.9%
distribute-lft-neg-in85.9%
*-commutative85.9%
distribute-neg-frac85.9%
associate-/l*99.2%
distribute-rgt-neg-in99.2%
distribute-neg-frac99.2%
Simplified99.2%
Taylor expanded in t around inf 79.7%
if -7.99999999999999947e146 < z < 6.3999999999999994e216Initial program 94.8%
Taylor expanded in t around inf 81.3%
Taylor expanded in t around 0 69.7%
*-commutative69.7%
associate-*r/72.4%
Simplified72.4%
Final simplification73.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -7.2e+116) (not (<= t 1.38e+72))) (* x (/ t z)) (* (/ y z) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7.2e+116) || !(t <= 1.38e+72)) {
tmp = x * (t / z);
} else {
tmp = (y / z) * 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 <= (-7.2d+116)) .or. (.not. (t <= 1.38d+72))) then
tmp = x * (t / z)
else
tmp = (y / z) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7.2e+116) || !(t <= 1.38e+72)) {
tmp = x * (t / z);
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -7.2e+116) or not (t <= 1.38e+72): tmp = x * (t / z) else: tmp = (y / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -7.2e+116) || !(t <= 1.38e+72)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(Float64(y / z) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -7.2e+116) || ~((t <= 1.38e+72))) tmp = x * (t / z); else tmp = (y / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -7.2e+116], N[Not[LessEqual[t, 1.38e+72]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.2 \cdot 10^{+116} \lor \neg \left(t \leq 1.38 \cdot 10^{+72}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if t < -7.19999999999999941e116 or 1.37999999999999995e72 < t Initial program 95.5%
Taylor expanded in z around inf 52.4%
*-commutative52.4%
remove-double-neg52.4%
cancel-sign-sub-inv52.4%
metadata-eval52.4%
*-lft-identity52.4%
distribute-neg-out52.4%
neg-mul-152.4%
sub-neg52.4%
distribute-lft-neg-in52.4%
*-commutative52.4%
distribute-neg-frac52.4%
associate-/l*57.9%
distribute-rgt-neg-in57.9%
distribute-neg-frac57.9%
Simplified57.9%
Taylor expanded in t around inf 48.2%
if -7.19999999999999941e116 < t < 1.37999999999999995e72Initial program 95.7%
Taylor expanded in y around inf 81.0%
associate-*r/83.2%
Simplified83.2%
Final simplification71.3%
(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 95.7%
Taylor expanded in z around 0 71.1%
mul-1-neg71.1%
unsub-neg71.1%
div-sub71.1%
associate-/l*71.2%
*-inverses71.2%
*-rgt-identity71.2%
Simplified71.2%
Taylor expanded in y around 0 23.8%
mul-1-neg23.8%
distribute-lft-neg-out23.8%
*-commutative23.8%
Simplified23.8%
(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 2024101
(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)))))