
(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 (<= 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 <= -((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 <= -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 <= -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 <= Float64(-Inf)) tmp = Float64(Float64(y * 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 <= -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[LessEqual[t$95$1, (-Infinity)], N[(N[(y * x), $MachinePrecision] / z), $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 -\infty:\\
\;\;\;\;\frac{y \cdot 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))) < -inf.0Initial program 63.4%
Taylor expanded in y around inf 100.0%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 96.8%
Final simplification97.1%
(FPCore (x y z t)
:precision binary64
(if (<= z -4.5e+116)
(* (/ y z) x)
(if (<= z -4.8e+14)
(* x (/ t z))
(if (<= z 7.5e-6) (* x (- (/ y z) t)) (/ x (/ z y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.5e+116) {
tmp = (y / z) * x;
} else if (z <= -4.8e+14) {
tmp = x * (t / z);
} else if (z <= 7.5e-6) {
tmp = x * ((y / z) - t);
} 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 (z <= (-4.5d+116)) then
tmp = (y / z) * x
else if (z <= (-4.8d+14)) then
tmp = x * (t / z)
else if (z <= 7.5d-6) then
tmp = x * ((y / z) - t)
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 (z <= -4.5e+116) {
tmp = (y / z) * x;
} else if (z <= -4.8e+14) {
tmp = x * (t / z);
} else if (z <= 7.5e-6) {
tmp = x * ((y / z) - t);
} else {
tmp = x / (z / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.5e+116: tmp = (y / z) * x elif z <= -4.8e+14: tmp = x * (t / z) elif z <= 7.5e-6: tmp = x * ((y / z) - t) else: tmp = x / (z / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.5e+116) tmp = Float64(Float64(y / z) * x); elseif (z <= -4.8e+14) tmp = Float64(x * Float64(t / z)); elseif (z <= 7.5e-6) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(x / Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4.5e+116) tmp = (y / z) * x; elseif (z <= -4.8e+14) tmp = x * (t / z); elseif (z <= 7.5e-6) tmp = x * ((y / z) - t); else tmp = x / (z / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.5e+116], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, -4.8e+14], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.5e-6], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{+116}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{elif}\;z \leq -4.8 \cdot 10^{+14}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{-6}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\end{array}
\end{array}
if z < -4.50000000000000016e116Initial program 97.6%
Taylor expanded in y around inf 54.8%
associate-*r/64.3%
Simplified64.3%
if -4.50000000000000016e116 < z < -4.8e14Initial program 99.7%
clear-num99.7%
associate-/r/99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 99.5%
associate-/l*99.7%
sub-neg99.7%
neg-mul-199.7%
remove-double-neg99.7%
Simplified99.7%
Taylor expanded in y around 0 71.5%
*-commutative71.5%
associate-*r/71.6%
Simplified71.6%
if -4.8e14 < z < 7.50000000000000019e-6Initial program 92.1%
Taylor expanded in z around 0 91.1%
if 7.50000000000000019e-6 < z Initial program 96.0%
Taylor expanded in y around inf 58.5%
associate-*r/59.5%
Simplified59.5%
clear-num59.4%
un-div-inv59.6%
Applied egg-rr59.6%
Final simplification77.6%
(FPCore (x y z t) :precision binary64 (if (<= t -1.55e+115) (* x (/ t z)) (if (or (<= t 5.4e-267) (not (<= t 1e+138))) (* y (/ x z)) (* (/ y z) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.55e+115) {
tmp = x * (t / z);
} else if ((t <= 5.4e-267) || !(t <= 1e+138)) {
tmp = y * (x / 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 <= (-1.55d+115)) then
tmp = x * (t / z)
else if ((t <= 5.4d-267) .or. (.not. (t <= 1d+138))) then
tmp = y * (x / 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 <= -1.55e+115) {
tmp = x * (t / z);
} else if ((t <= 5.4e-267) || !(t <= 1e+138)) {
tmp = y * (x / z);
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.55e+115: tmp = x * (t / z) elif (t <= 5.4e-267) or not (t <= 1e+138): tmp = y * (x / z) else: tmp = (y / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.55e+115) tmp = Float64(x * Float64(t / z)); elseif ((t <= 5.4e-267) || !(t <= 1e+138)) tmp = Float64(y * Float64(x / 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 <= -1.55e+115) tmp = x * (t / z); elseif ((t <= 5.4e-267) || ~((t <= 1e+138))) tmp = y * (x / z); else tmp = (y / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.55e+115], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t, 5.4e-267], N[Not[LessEqual[t, 1e+138]], $MachinePrecision]], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.55 \cdot 10^{+115}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{elif}\;t \leq 5.4 \cdot 10^{-267} \lor \neg \left(t \leq 10^{+138}\right):\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if t < -1.55000000000000002e115Initial program 95.0%
clear-num95.0%
associate-/r/94.8%
Applied egg-rr94.8%
Taylor expanded in z around inf 56.7%
associate-/l*70.2%
sub-neg70.2%
neg-mul-170.2%
remove-double-neg70.2%
Simplified70.2%
Taylor expanded in y around 0 46.7%
*-commutative46.7%
associate-*r/60.6%
Simplified60.6%
if -1.55000000000000002e115 < t < 5.39999999999999975e-267 or 1e138 < t Initial program 91.5%
Taylor expanded in y around inf 85.1%
mul-1-neg85.1%
distribute-neg-frac285.1%
distribute-rgt-neg-in85.1%
neg-sub085.1%
associate--r-85.1%
metadata-eval85.1%
Simplified85.1%
Taylor expanded in t around 0 72.2%
if 5.39999999999999975e-267 < t < 1e138Initial program 99.7%
Taylor expanded in y around inf 74.0%
associate-*r/79.0%
Simplified79.0%
Final simplification72.4%
(FPCore (x y z t) :precision binary64 (if (<= t -2.5e+115) (* x (/ t z)) (if (or (<= t 4.8e-269) (not (<= t 6e+139))) (* y (/ x z)) (/ x (/ z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.5e+115) {
tmp = x * (t / z);
} else if ((t <= 4.8e-269) || !(t <= 6e+139)) {
tmp = y * (x / 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 <= (-2.5d+115)) then
tmp = x * (t / z)
else if ((t <= 4.8d-269) .or. (.not. (t <= 6d+139))) then
tmp = y * (x / 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 <= -2.5e+115) {
tmp = x * (t / z);
} else if ((t <= 4.8e-269) || !(t <= 6e+139)) {
tmp = y * (x / z);
} else {
tmp = x / (z / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.5e+115: tmp = x * (t / z) elif (t <= 4.8e-269) or not (t <= 6e+139): tmp = y * (x / z) else: tmp = x / (z / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.5e+115) tmp = Float64(x * Float64(t / z)); elseif ((t <= 4.8e-269) || !(t <= 6e+139)) tmp = Float64(y * Float64(x / 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 <= -2.5e+115) tmp = x * (t / z); elseif ((t <= 4.8e-269) || ~((t <= 6e+139))) tmp = y * (x / z); else tmp = x / (z / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.5e+115], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t, 4.8e-269], N[Not[LessEqual[t, 6e+139]], $MachinePrecision]], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.5 \cdot 10^{+115}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{elif}\;t \leq 4.8 \cdot 10^{-269} \lor \neg \left(t \leq 6 \cdot 10^{+139}\right):\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\end{array}
\end{array}
if t < -2.50000000000000004e115Initial program 95.0%
clear-num95.0%
associate-/r/94.8%
Applied egg-rr94.8%
Taylor expanded in z around inf 56.7%
associate-/l*70.2%
sub-neg70.2%
neg-mul-170.2%
remove-double-neg70.2%
Simplified70.2%
Taylor expanded in y around 0 46.7%
*-commutative46.7%
associate-*r/60.6%
Simplified60.6%
if -2.50000000000000004e115 < t < 4.8000000000000002e-269 or 5.9999999999999999e139 < t Initial program 91.5%
Taylor expanded in y around inf 85.1%
mul-1-neg85.1%
distribute-neg-frac285.1%
distribute-rgt-neg-in85.1%
neg-sub085.1%
associate--r-85.1%
metadata-eval85.1%
Simplified85.1%
Taylor expanded in t around 0 72.2%
if 4.8000000000000002e-269 < t < 5.9999999999999999e139Initial program 99.7%
Taylor expanded in y around inf 74.0%
associate-*r/79.0%
Simplified79.0%
clear-num78.8%
un-div-inv79.0%
Applied egg-rr79.0%
Final simplification72.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -550000000000.0) (not (<= z 7.5e-6))) (* x (/ (+ y t) z)) (* (/ x z) (- y (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -550000000000.0) || !(z <= 7.5e-6)) {
tmp = x * ((y + t) / z);
} else {
tmp = (x / z) * (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 <= (-550000000000.0d0)) .or. (.not. (z <= 7.5d-6))) then
tmp = x * ((y + t) / z)
else
tmp = (x / z) * (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 <= -550000000000.0) || !(z <= 7.5e-6)) {
tmp = x * ((y + t) / z);
} else {
tmp = (x / z) * (y - (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -550000000000.0) or not (z <= 7.5e-6): tmp = x * ((y + t) / z) else: tmp = (x / z) * (y - (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -550000000000.0) || !(z <= 7.5e-6)) tmp = Float64(x * Float64(Float64(y + t) / z)); else tmp = Float64(Float64(x / z) * Float64(y - Float64(z * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -550000000000.0) || ~((z <= 7.5e-6))) tmp = x * ((y + t) / z); else tmp = (x / z) * (y - (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -550000000000.0], N[Not[LessEqual[z, 7.5e-6]], $MachinePrecision]], N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -550000000000 \lor \neg \left(z \leq 7.5 \cdot 10^{-6}\right):\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \left(y - z \cdot t\right)\\
\end{array}
\end{array}
if z < -5.5e11 or 7.50000000000000019e-6 < z Initial program 97.1%
Taylor expanded in z around inf 86.1%
*-commutative86.1%
remove-double-neg86.1%
cancel-sign-sub-inv86.1%
metadata-eval86.1%
*-lft-identity86.1%
distribute-neg-out86.1%
neg-mul-186.1%
sub-neg86.1%
distribute-lft-neg-in86.1%
*-commutative86.1%
distribute-neg-frac86.1%
associate-/l*96.8%
distribute-rgt-neg-in96.8%
distribute-neg-frac96.8%
Simplified96.8%
if -5.5e11 < z < 7.50000000000000019e-6Initial program 92.1%
clear-num92.1%
associate-/r/92.1%
Applied egg-rr92.1%
Taylor expanded in z around 0 91.1%
mul-1-neg91.1%
unsub-neg91.1%
*-commutative91.1%
Simplified91.1%
Taylor expanded in x around 0 89.8%
*-commutative89.8%
*-commutative89.8%
*-commutative89.8%
associate-*l/91.7%
*-commutative91.7%
Simplified91.7%
Final simplification94.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -550000000000.0) (not (<= z 7.5e-6))) (* x (/ (+ y t) z)) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -550000000000.0) || !(z <= 7.5e-6)) {
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 <= (-550000000000.0d0)) .or. (.not. (z <= 7.5d-6))) 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 <= -550000000000.0) || !(z <= 7.5e-6)) {
tmp = x * ((y + t) / z);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -550000000000.0) or not (z <= 7.5e-6): tmp = x * ((y + t) / z) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -550000000000.0) || !(z <= 7.5e-6)) 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 <= -550000000000.0) || ~((z <= 7.5e-6))) 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, -550000000000.0], N[Not[LessEqual[z, 7.5e-6]], $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 -550000000000 \lor \neg \left(z \leq 7.5 \cdot 10^{-6}\right):\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -5.5e11 or 7.50000000000000019e-6 < z Initial program 97.1%
Taylor expanded in z around inf 86.1%
*-commutative86.1%
remove-double-neg86.1%
cancel-sign-sub-inv86.1%
metadata-eval86.1%
*-lft-identity86.1%
distribute-neg-out86.1%
neg-mul-186.1%
sub-neg86.1%
distribute-lft-neg-in86.1%
*-commutative86.1%
distribute-neg-frac86.1%
associate-/l*96.8%
distribute-rgt-neg-in96.8%
distribute-neg-frac96.8%
Simplified96.8%
if -5.5e11 < z < 7.50000000000000019e-6Initial program 92.1%
Taylor expanded in z around 0 91.1%
Final simplification93.8%
(FPCore (x y z t) :precision binary64 (if (<= y -1.3e-144) (* y (/ x z)) (if (<= y 1.35e-156) (* t (/ x (+ z -1.0))) (* (/ y z) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.3e-144) {
tmp = y * (x / z);
} else if (y <= 1.35e-156) {
tmp = t * (x / (z + -1.0));
} 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 (y <= (-1.3d-144)) then
tmp = y * (x / z)
else if (y <= 1.35d-156) then
tmp = t * (x / (z + (-1.0d0)))
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 (y <= -1.3e-144) {
tmp = y * (x / z);
} else if (y <= 1.35e-156) {
tmp = t * (x / (z + -1.0));
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.3e-144: tmp = y * (x / z) elif y <= 1.35e-156: tmp = t * (x / (z + -1.0)) else: tmp = (y / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.3e-144) tmp = Float64(y * Float64(x / z)); elseif (y <= 1.35e-156) tmp = Float64(t * Float64(x / Float64(z + -1.0))); else tmp = Float64(Float64(y / z) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.3e-144) tmp = y * (x / z); elseif (y <= 1.35e-156) tmp = t * (x / (z + -1.0)); else tmp = (y / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.3e-144], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e-156], N[(t * N[(x / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{-144}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{-156}:\\
\;\;\;\;t \cdot \frac{x}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if y < -1.3e-144Initial program 92.3%
Taylor expanded in y around inf 81.9%
mul-1-neg81.9%
distribute-neg-frac281.9%
distribute-rgt-neg-in81.9%
neg-sub081.9%
associate--r-81.9%
metadata-eval81.9%
Simplified81.9%
Taylor expanded in t around 0 72.8%
if -1.3e-144 < y < 1.35000000000000006e-156Initial program 95.7%
Taylor expanded in y around 0 71.3%
mul-1-neg71.3%
associate-/l*72.7%
distribute-rgt-neg-in72.7%
distribute-neg-frac272.7%
neg-sub072.7%
associate--r-72.7%
metadata-eval72.7%
Simplified72.7%
if 1.35000000000000006e-156 < y Initial program 96.3%
Taylor expanded in y around inf 78.5%
associate-*r/81.0%
Simplified81.0%
Final simplification75.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.15e-54) (not (<= z 7.5e-6))) (* t (/ x z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.15e-54) || !(z <= 7.5e-6)) {
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.15d-54)) .or. (.not. (z <= 7.5d-6))) 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.15e-54) || !(z <= 7.5e-6)) {
tmp = t * (x / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.15e-54) or not (z <= 7.5e-6): tmp = t * (x / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.15e-54) || !(z <= 7.5e-6)) 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.15e-54) || ~((z <= 7.5e-6))) tmp = t * (x / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.15e-54], N[Not[LessEqual[z, 7.5e-6]], $MachinePrecision]], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{-54} \lor \neg \left(z \leq 7.5 \cdot 10^{-6}\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -1.1499999999999999e-54 or 7.50000000000000019e-6 < z Initial program 96.5%
Taylor expanded in z around inf 86.8%
*-commutative86.8%
associate-/l*85.8%
cancel-sign-sub-inv85.8%
metadata-eval85.8%
*-lft-identity85.8%
+-commutative85.8%
Simplified85.8%
Taylor expanded in t around inf 46.4%
associate-*r/47.1%
Simplified47.1%
if -1.1499999999999999e-54 < z < 7.50000000000000019e-6Initial program 92.5%
Taylor expanded in z around 0 91.4%
Taylor expanded in y around 0 29.6%
associate-*r*29.6%
neg-mul-129.6%
*-commutative29.6%
Simplified29.6%
Final simplification38.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.15e-54) (not (<= z 7.5e-6))) (* x (/ t z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.15e-54) || !(z <= 7.5e-6)) {
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.15d-54)) .or. (.not. (z <= 7.5d-6))) 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.15e-54) || !(z <= 7.5e-6)) {
tmp = x * (t / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.15e-54) or not (z <= 7.5e-6): tmp = x * (t / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.15e-54) || !(z <= 7.5e-6)) 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.15e-54) || ~((z <= 7.5e-6))) tmp = x * (t / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.15e-54], N[Not[LessEqual[z, 7.5e-6]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{-54} \lor \neg \left(z \leq 7.5 \cdot 10^{-6}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -1.1499999999999999e-54 or 7.50000000000000019e-6 < z Initial program 96.5%
clear-num96.4%
associate-/r/96.4%
Applied egg-rr96.4%
Taylor expanded in z around inf 86.8%
associate-/l*96.2%
sub-neg96.2%
neg-mul-196.2%
remove-double-neg96.2%
Simplified96.2%
Taylor expanded in y around 0 46.4%
*-commutative46.4%
associate-*r/52.4%
Simplified52.4%
if -1.1499999999999999e-54 < z < 7.50000000000000019e-6Initial program 92.5%
Taylor expanded in z around 0 91.4%
Taylor expanded in y around 0 29.6%
associate-*r*29.6%
neg-mul-129.6%
*-commutative29.6%
Simplified29.6%
Final simplification41.0%
(FPCore (x y z t) :precision binary64 (if (<= t -6.8e+115) (* x (/ t z)) (if (<= t 4.6e+249) (* (/ y z) x) (* t (/ x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -6.8e+115) {
tmp = x * (t / z);
} else if (t <= 4.6e+249) {
tmp = (y / z) * x;
} else {
tmp = t * (x / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-6.8d+115)) then
tmp = x * (t / z)
else if (t <= 4.6d+249) then
tmp = (y / z) * x
else
tmp = t * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -6.8e+115) {
tmp = x * (t / z);
} else if (t <= 4.6e+249) {
tmp = (y / z) * x;
} else {
tmp = t * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -6.8e+115: tmp = x * (t / z) elif t <= 4.6e+249: tmp = (y / z) * x else: tmp = t * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -6.8e+115) tmp = Float64(x * Float64(t / z)); elseif (t <= 4.6e+249) tmp = Float64(Float64(y / z) * x); else tmp = Float64(t * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -6.8e+115) tmp = x * (t / z); elseif (t <= 4.6e+249) tmp = (y / z) * x; else tmp = t * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -6.8e+115], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.6e+249], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.8 \cdot 10^{+115}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{elif}\;t \leq 4.6 \cdot 10^{+249}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\end{array}
\end{array}
if t < -6.8000000000000001e115Initial program 95.0%
clear-num95.0%
associate-/r/94.8%
Applied egg-rr94.8%
Taylor expanded in z around inf 56.7%
associate-/l*70.2%
sub-neg70.2%
neg-mul-170.2%
remove-double-neg70.2%
Simplified70.2%
Taylor expanded in y around 0 46.7%
*-commutative46.7%
associate-*r/60.6%
Simplified60.6%
if -6.8000000000000001e115 < t < 4.5999999999999996e249Initial program 94.0%
Taylor expanded in y around inf 71.6%
associate-*r/73.1%
Simplified73.1%
if 4.5999999999999996e249 < t Initial program 99.9%
Taylor expanded in z around inf 54.9%
*-commutative54.9%
associate-/l*69.7%
cancel-sign-sub-inv69.7%
metadata-eval69.7%
*-lft-identity69.7%
+-commutative69.7%
Simplified69.7%
Taylor expanded in t around inf 47.2%
associate-*r/62.0%
Simplified62.0%
Final simplification70.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 94.5%
Taylor expanded in z around 0 65.5%
Taylor expanded in y around 0 21.0%
associate-*r*21.0%
neg-mul-121.0%
*-commutative21.0%
Simplified21.0%
Final simplification21.0%
(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 2024071
(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)))))