
(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 (* 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}
Initial program 96.5%
Final simplification96.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t z))))
(if (<= z -1.4e+182)
(/ x (/ z y))
(if (<= z -2.6e+31)
t_1
(if (<= z 9.5e+15)
(* x (- (/ y z) t))
(if (<= z 3e+54)
(/ x (/ z t))
(if (<= z 7.5e+114)
(* x (* y (/ 1.0 z)))
(if (<= z 1e+165) t_1 (* x (/ y z))))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double tmp;
if (z <= -1.4e+182) {
tmp = x / (z / y);
} else if (z <= -2.6e+31) {
tmp = t_1;
} else if (z <= 9.5e+15) {
tmp = x * ((y / z) - t);
} else if (z <= 3e+54) {
tmp = x / (z / t);
} else if (z <= 7.5e+114) {
tmp = x * (y * (1.0 / z));
} else if (z <= 1e+165) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = x * (t / z)
if (z <= (-1.4d+182)) then
tmp = x / (z / y)
else if (z <= (-2.6d+31)) then
tmp = t_1
else if (z <= 9.5d+15) then
tmp = x * ((y / z) - t)
else if (z <= 3d+54) then
tmp = x / (z / t)
else if (z <= 7.5d+114) then
tmp = x * (y * (1.0d0 / z))
else if (z <= 1d+165) then
tmp = t_1
else
tmp = x * (y / z)
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 tmp;
if (z <= -1.4e+182) {
tmp = x / (z / y);
} else if (z <= -2.6e+31) {
tmp = t_1;
} else if (z <= 9.5e+15) {
tmp = x * ((y / z) - t);
} else if (z <= 3e+54) {
tmp = x / (z / t);
} else if (z <= 7.5e+114) {
tmp = x * (y * (1.0 / z));
} else if (z <= 1e+165) {
tmp = t_1;
} else {
tmp = x * (y / z);
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / z) tmp = 0 if z <= -1.4e+182: tmp = x / (z / y) elif z <= -2.6e+31: tmp = t_1 elif z <= 9.5e+15: tmp = x * ((y / z) - t) elif z <= 3e+54: tmp = x / (z / t) elif z <= 7.5e+114: tmp = x * (y * (1.0 / z)) elif z <= 1e+165: tmp = t_1 else: tmp = x * (y / z) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / z)) tmp = 0.0 if (z <= -1.4e+182) tmp = Float64(x / Float64(z / y)); elseif (z <= -2.6e+31) tmp = t_1; elseif (z <= 9.5e+15) tmp = Float64(x * Float64(Float64(y / z) - t)); elseif (z <= 3e+54) tmp = Float64(x / Float64(z / t)); elseif (z <= 7.5e+114) tmp = Float64(x * Float64(y * Float64(1.0 / z))); elseif (z <= 1e+165) tmp = t_1; else tmp = Float64(x * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / z); tmp = 0.0; if (z <= -1.4e+182) tmp = x / (z / y); elseif (z <= -2.6e+31) tmp = t_1; elseif (z <= 9.5e+15) tmp = x * ((y / z) - t); elseif (z <= 3e+54) tmp = x / (z / t); elseif (z <= 7.5e+114) tmp = x * (y * (1.0 / z)); elseif (z <= 1e+165) tmp = t_1; else tmp = x * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.4e+182], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -2.6e+31], t$95$1, If[LessEqual[z, 9.5e+15], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3e+54], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.5e+114], N[(x * N[(y * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1e+165], t$95$1, N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
\mathbf{if}\;z \leq -1.4 \cdot 10^{+182}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{elif}\;z \leq -2.6 \cdot 10^{+31}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{+15}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+54}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{+114}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{1}{z}\right)\\
\mathbf{elif}\;z \leq 10^{+165}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\end{array}
\end{array}
if z < -1.40000000000000003e182Initial program 92.3%
clear-num92.3%
associate-/r/92.4%
fma-neg92.4%
distribute-neg-frac92.4%
Applied egg-rr92.4%
Taylor expanded in z around 0 60.4%
associate-/l*70.9%
Simplified70.9%
if -1.40000000000000003e182 < z < -2.6e31 or 7.5000000000000001e114 < z < 9.99999999999999899e164Initial program 99.8%
Taylor expanded in z around inf 83.5%
associate-/l*99.8%
associate-/r/88.3%
cancel-sign-sub-inv88.3%
metadata-eval88.3%
*-lft-identity88.3%
+-commutative88.3%
Simplified88.3%
*-commutative88.3%
clear-num85.4%
un-div-inv85.5%
+-commutative85.5%
Applied egg-rr85.5%
associate-/r/99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in t around inf 69.8%
if -2.6e31 < z < 9.5e15Initial program 96.4%
Taylor expanded in z around 0 88.2%
+-commutative88.2%
associate-*r/86.7%
*-commutative86.7%
associate-*r*86.7%
neg-mul-186.7%
distribute-rgt-out93.3%
unsub-neg93.3%
Simplified93.3%
if 9.5e15 < z < 2.9999999999999999e54Initial program 99.8%
Taylor expanded in z around inf 99.6%
associate-/l*99.6%
associate-/r/85.1%
cancel-sign-sub-inv85.1%
metadata-eval85.1%
*-lft-identity85.1%
+-commutative85.1%
Simplified85.1%
*-commutative85.1%
clear-num75.8%
un-div-inv75.8%
+-commutative75.8%
Applied egg-rr75.8%
associate-/r/99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in t around inf 83.6%
*-commutative83.6%
clear-num83.6%
un-div-inv83.6%
Applied egg-rr83.6%
if 2.9999999999999999e54 < z < 7.5000000000000001e114Initial program 99.7%
Taylor expanded in y around inf 59.2%
div-inv59.1%
associate-*l*79.0%
Applied egg-rr79.0%
if 9.99999999999999899e164 < z Initial program 93.9%
Taylor expanded in y around inf 71.2%
associate-*r/74.3%
Simplified74.3%
Final simplification83.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.35e-94) (not (<= y 3.5e-14))) (/ x (/ z y)) (* x (/ t (+ z -1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.35e-94) || !(y <= 3.5e-14)) {
tmp = x / (z / y);
} 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 <= (-2.35d-94)) .or. (.not. (y <= 3.5d-14))) then
tmp = x / (z / y)
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 <= -2.35e-94) || !(y <= 3.5e-14)) {
tmp = x / (z / y);
} else {
tmp = x * (t / (z + -1.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.35e-94) or not (y <= 3.5e-14): tmp = x / (z / y) else: tmp = x * (t / (z + -1.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.35e-94) || !(y <= 3.5e-14)) tmp = Float64(x / Float64(z / y)); 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 <= -2.35e-94) || ~((y <= 3.5e-14))) tmp = x / (z / y); else tmp = x * (t / (z + -1.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.35e-94], N[Not[LessEqual[y, 3.5e-14]], $MachinePrecision]], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], N[(x * N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.35 \cdot 10^{-94} \lor \neg \left(y \leq 3.5 \cdot 10^{-14}\right):\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z + -1}\\
\end{array}
\end{array}
if y < -2.35000000000000002e-94 or 3.5000000000000002e-14 < y Initial program 96.4%
clear-num96.3%
associate-/r/96.3%
fma-neg96.3%
distribute-neg-frac96.3%
Applied egg-rr96.3%
Taylor expanded in z around 0 78.0%
associate-/l*82.5%
Simplified82.5%
if -2.35000000000000002e-94 < y < 3.5000000000000002e-14Initial program 96.7%
Taylor expanded in y around 0 71.6%
associate-*r/71.6%
associate-*r*71.6%
neg-mul-171.6%
associate-*l/76.9%
*-commutative76.9%
distribute-frac-neg76.9%
mul-1-neg76.9%
associate-*r/76.9%
*-commutative76.9%
associate-*r/76.8%
metadata-eval76.8%
associate-/r*76.8%
neg-mul-176.8%
associate-*r/76.9%
*-rgt-identity76.9%
neg-sub076.9%
associate--r-76.9%
metadata-eval76.9%
Simplified76.9%
Final simplification80.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -50000.0) (not (<= z 2.05e-32))) (* x (/ (+ y t) z)) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -50000.0) || !(z <= 2.05e-32)) {
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 <= (-50000.0d0)) .or. (.not. (z <= 2.05d-32))) 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 <= -50000.0) || !(z <= 2.05e-32)) {
tmp = x * ((y + t) / z);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -50000.0) or not (z <= 2.05e-32): tmp = x * ((y + t) / z) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -50000.0) || !(z <= 2.05e-32)) 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 <= -50000.0) || ~((z <= 2.05e-32))) 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, -50000.0], N[Not[LessEqual[z, 2.05e-32]], $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 -50000 \lor \neg \left(z \leq 2.05 \cdot 10^{-32}\right):\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -5e4 or 2.04999999999999988e-32 < z Initial program 96.9%
Taylor expanded in z around inf 96.4%
cancel-sign-sub-inv96.4%
metadata-eval96.4%
*-lft-identity96.4%
+-commutative96.4%
Simplified96.4%
if -5e4 < z < 2.04999999999999988e-32Initial program 96.0%
Taylor expanded in z around 0 90.7%
+-commutative90.7%
associate-*r/89.0%
*-commutative89.0%
associate-*r*89.0%
neg-mul-189.0%
distribute-rgt-out94.8%
unsub-neg94.8%
Simplified94.8%
Final simplification95.6%
(FPCore (x y z t) :precision binary64 (if (<= z -0.95) (/ x (/ z (+ y t))) (if (<= z 2.05e-32) (* x (- (/ y z) t)) (* x (/ (+ y t) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.95) {
tmp = x / (z / (y + t));
} else if (z <= 2.05e-32) {
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 <= (-0.95d0)) then
tmp = x / (z / (y + t))
else if (z <= 2.05d-32) 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 <= -0.95) {
tmp = x / (z / (y + t));
} else if (z <= 2.05e-32) {
tmp = x * ((y / z) - t);
} else {
tmp = x * ((y + t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -0.95: tmp = x / (z / (y + t)) elif z <= 2.05e-32: tmp = x * ((y / z) - t) else: tmp = x * ((y + t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -0.95) tmp = Float64(x / Float64(z / Float64(y + t))); elseif (z <= 2.05e-32) 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 <= -0.95) tmp = x / (z / (y + t)); elseif (z <= 2.05e-32) tmp = x * ((y / z) - t); else tmp = x * ((y + t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.95], N[(x / N[(z / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.05e-32], 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 -0.95:\\
\;\;\;\;\frac{x}{\frac{z}{y + t}}\\
\mathbf{elif}\;z \leq 2.05 \cdot 10^{-32}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\end{array}
\end{array}
if z < -0.94999999999999996Initial program 96.5%
Taylor expanded in z around inf 80.3%
associate-/l*95.8%
cancel-sign-sub-inv95.8%
metadata-eval95.8%
*-lft-identity95.8%
+-commutative95.8%
Simplified95.8%
if -0.94999999999999996 < z < 2.04999999999999988e-32Initial program 96.0%
Taylor expanded in z around 0 90.6%
+-commutative90.6%
associate-*r/88.9%
*-commutative88.9%
associate-*r*88.9%
neg-mul-188.9%
distribute-rgt-out94.8%
unsub-neg94.8%
Simplified94.8%
if 2.04999999999999988e-32 < z Initial program 97.3%
Taylor expanded in z around inf 96.9%
cancel-sign-sub-inv96.9%
metadata-eval96.9%
*-lft-identity96.9%
+-commutative96.9%
Simplified96.9%
Final simplification95.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.55e-38))) (* t (/ x z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 1.55e-38)) {
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 <= 1.55d-38))) 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 <= 1.55e-38)) {
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 <= 1.55e-38): tmp = t * (x / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.0) || !(z <= 1.55e-38)) 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 <= 1.55e-38))) 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, 1.55e-38]], $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 1.55 \cdot 10^{-38}\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -1 or 1.54999999999999991e-38 < z Initial program 97.0%
Taylor expanded in z around inf 82.4%
associate-/l*95.1%
associate-/r/83.6%
cancel-sign-sub-inv83.6%
metadata-eval83.6%
*-lft-identity83.6%
+-commutative83.6%
Simplified83.6%
Taylor expanded in t around inf 43.9%
associate-*r/44.2%
Simplified44.2%
if -1 < z < 1.54999999999999991e-38Initial program 95.9%
Taylor expanded in z around 0 90.5%
+-commutative90.5%
associate-*r/88.7%
*-commutative88.7%
associate-*r*88.7%
neg-mul-188.7%
distribute-rgt-out94.7%
unsub-neg94.7%
Simplified94.7%
Taylor expanded in y around 0 36.2%
mul-1-neg36.2%
*-commutative36.2%
distribute-rgt-neg-in36.2%
Simplified36.2%
Final simplification40.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.6e+121) (not (<= t 1.55e+231))) (* x (/ t z)) (* x (/ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.6e+121) || !(t <= 1.55e+231)) {
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+121)) .or. (.not. (t <= 1.55d+231))) 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+121) || !(t <= 1.55e+231)) {
tmp = x * (t / z);
} else {
tmp = x * (y / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3.6e+121) or not (t <= 1.55e+231): tmp = x * (t / z) else: tmp = x * (y / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3.6e+121) || !(t <= 1.55e+231)) 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+121) || ~((t <= 1.55e+231))) 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+121], N[Not[LessEqual[t, 1.55e+231]], $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^{+121} \lor \neg \left(t \leq 1.55 \cdot 10^{+231}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\end{array}
\end{array}
if t < -3.59999999999999981e121 or 1.54999999999999995e231 < t Initial program 99.9%
Taylor expanded in z around inf 62.8%
associate-/l*76.8%
associate-/r/59.2%
cancel-sign-sub-inv59.2%
metadata-eval59.2%
*-lft-identity59.2%
+-commutative59.2%
Simplified59.2%
*-commutative59.2%
clear-num56.6%
un-div-inv56.6%
+-commutative56.6%
Applied egg-rr56.6%
associate-/r/76.8%
+-commutative76.8%
Simplified76.8%
Taylor expanded in t around inf 70.9%
if -3.59999999999999981e121 < t < 1.54999999999999995e231Initial program 95.7%
Taylor expanded in y around inf 72.1%
associate-*r/75.9%
Simplified75.9%
Final simplification75.0%
(FPCore (x y z t) :precision binary64 (if (<= t -7.3e+121) (* t (/ x z)) (if (<= t 7.6e+208) (* x (/ y z)) (* x (- t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -7.3e+121) {
tmp = t * (x / z);
} else if (t <= 7.6e+208) {
tmp = x * (y / 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 <= (-7.3d+121)) then
tmp = t * (x / z)
else if (t <= 7.6d+208) then
tmp = x * (y / 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 <= -7.3e+121) {
tmp = t * (x / z);
} else if (t <= 7.6e+208) {
tmp = x * (y / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -7.3e+121: tmp = t * (x / z) elif t <= 7.6e+208: tmp = x * (y / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -7.3e+121) tmp = Float64(t * Float64(x / z)); elseif (t <= 7.6e+208) tmp = Float64(x * Float64(y / z)); else tmp = Float64(x * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -7.3e+121) tmp = t * (x / z); elseif (t <= 7.6e+208) tmp = x * (y / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -7.3e+121], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.6e+208], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.3 \cdot 10^{+121}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{elif}\;t \leq 7.6 \cdot 10^{+208}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if t < -7.3e121Initial program 99.8%
Taylor expanded in z around inf 73.1%
associate-/l*82.8%
associate-/r/63.1%
cancel-sign-sub-inv63.1%
metadata-eval63.1%
*-lft-identity63.1%
+-commutative63.1%
Simplified63.1%
Taylor expanded in t around inf 64.0%
associate-*r/57.1%
Simplified57.1%
if -7.3e121 < t < 7.6000000000000004e208Initial program 95.7%
Taylor expanded in y around inf 72.9%
associate-*r/76.8%
Simplified76.8%
if 7.6000000000000004e208 < t Initial program 100.0%
Taylor expanded in z around 0 45.7%
+-commutative45.7%
associate-*r/45.7%
*-commutative45.7%
associate-*r*45.7%
neg-mul-145.7%
distribute-rgt-out50.5%
unsub-neg50.5%
Simplified50.5%
Taylor expanded in y around 0 50.2%
mul-1-neg50.2%
*-commutative50.2%
distribute-rgt-neg-in50.2%
Simplified50.2%
Final simplification72.3%
(FPCore (x y z t) :precision binary64 (if (<= t -5.6e+121) (/ x (/ z t)) (if (<= t 7.5e+230) (* x (/ y z)) (* x (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -5.6e+121) {
tmp = x / (z / t);
} else if (t <= 7.5e+230) {
tmp = x * (y / z);
} else {
tmp = x * (t / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-5.6d+121)) then
tmp = x / (z / t)
else if (t <= 7.5d+230) then
tmp = x * (y / z)
else
tmp = x * (t / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -5.6e+121) {
tmp = x / (z / t);
} else if (t <= 7.5e+230) {
tmp = x * (y / z);
} else {
tmp = x * (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -5.6e+121: tmp = x / (z / t) elif t <= 7.5e+230: tmp = x * (y / z) else: tmp = x * (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -5.6e+121) tmp = Float64(x / Float64(z / t)); elseif (t <= 7.5e+230) tmp = Float64(x * Float64(y / z)); else tmp = Float64(x * Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -5.6e+121) tmp = x / (z / t); elseif (t <= 7.5e+230) tmp = x * (y / z); else tmp = x * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -5.6e+121], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.5e+230], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.6 \cdot 10^{+121}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\mathbf{elif}\;t \leq 7.5 \cdot 10^{+230}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\end{array}
\end{array}
if t < -5.60000000000000012e121Initial program 99.8%
Taylor expanded in z around inf 73.1%
associate-/l*82.8%
associate-/r/63.1%
cancel-sign-sub-inv63.1%
metadata-eval63.1%
*-lft-identity63.1%
+-commutative63.1%
Simplified63.1%
*-commutative63.1%
clear-num60.5%
un-div-inv60.5%
+-commutative60.5%
Applied egg-rr60.5%
associate-/r/82.7%
+-commutative82.7%
Simplified82.7%
Taylor expanded in t around inf 73.5%
*-commutative73.5%
clear-num73.5%
un-div-inv73.6%
Applied egg-rr73.6%
if -5.60000000000000012e121 < t < 7.5000000000000004e230Initial program 95.7%
Taylor expanded in y around inf 72.1%
associate-*r/75.9%
Simplified75.9%
if 7.5000000000000004e230 < t Initial program 100.0%
Taylor expanded in z around inf 44.4%
associate-/l*66.2%
associate-/r/52.3%
cancel-sign-sub-inv52.3%
metadata-eval52.3%
*-lft-identity52.3%
+-commutative52.3%
Simplified52.3%
*-commutative52.3%
clear-num49.6%
un-div-inv49.6%
+-commutative49.6%
Applied egg-rr49.6%
associate-/r/66.4%
+-commutative66.4%
Simplified66.4%
Taylor expanded in t around inf 66.4%
Final simplification75.0%
(FPCore (x y z t) :precision binary64 (if (<= t -8.2e+121) (/ x (/ z t)) (if (<= t 1.3e+233) (/ x (/ z y)) (* x (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -8.2e+121) {
tmp = x / (z / t);
} else if (t <= 1.3e+233) {
tmp = x / (z / y);
} else {
tmp = x * (t / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-8.2d+121)) then
tmp = x / (z / t)
else if (t <= 1.3d+233) then
tmp = x / (z / y)
else
tmp = x * (t / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -8.2e+121) {
tmp = x / (z / t);
} else if (t <= 1.3e+233) {
tmp = x / (z / y);
} else {
tmp = x * (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -8.2e+121: tmp = x / (z / t) elif t <= 1.3e+233: tmp = x / (z / y) else: tmp = x * (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -8.2e+121) tmp = Float64(x / Float64(z / t)); elseif (t <= 1.3e+233) tmp = Float64(x / Float64(z / y)); else tmp = Float64(x * Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -8.2e+121) tmp = x / (z / t); elseif (t <= 1.3e+233) tmp = x / (z / y); else tmp = x * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -8.2e+121], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.3e+233], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.2 \cdot 10^{+121}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\mathbf{elif}\;t \leq 1.3 \cdot 10^{+233}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\end{array}
\end{array}
if t < -8.2e121Initial program 99.8%
Taylor expanded in z around inf 73.1%
associate-/l*82.8%
associate-/r/63.1%
cancel-sign-sub-inv63.1%
metadata-eval63.1%
*-lft-identity63.1%
+-commutative63.1%
Simplified63.1%
*-commutative63.1%
clear-num60.5%
un-div-inv60.5%
+-commutative60.5%
Applied egg-rr60.5%
associate-/r/82.7%
+-commutative82.7%
Simplified82.7%
Taylor expanded in t around inf 73.5%
*-commutative73.5%
clear-num73.5%
un-div-inv73.6%
Applied egg-rr73.6%
if -8.2e121 < t < 1.30000000000000003e233Initial program 95.7%
clear-num95.7%
associate-/r/95.7%
fma-neg95.7%
distribute-neg-frac95.7%
Applied egg-rr95.7%
Taylor expanded in z around 0 72.1%
associate-/l*76.0%
Simplified76.0%
if 1.30000000000000003e233 < t Initial program 100.0%
Taylor expanded in z around inf 44.4%
associate-/l*66.2%
associate-/r/52.3%
cancel-sign-sub-inv52.3%
metadata-eval52.3%
*-lft-identity52.3%
+-commutative52.3%
Simplified52.3%
*-commutative52.3%
clear-num49.6%
un-div-inv49.6%
+-commutative49.6%
Applied egg-rr49.6%
associate-/r/66.4%
+-commutative66.4%
Simplified66.4%
Taylor expanded in t around inf 66.4%
Final simplification75.1%
(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 96.5%
Taylor expanded in z around 0 62.3%
+-commutative62.3%
associate-*r/65.2%
*-commutative65.2%
associate-*r*65.2%
neg-mul-165.2%
distribute-rgt-out68.7%
unsub-neg68.7%
Simplified68.7%
Taylor expanded in y around 0 23.4%
mul-1-neg23.4%
*-commutative23.4%
distribute-rgt-neg-in23.4%
Simplified23.4%
Final simplification23.4%
(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 2024019
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
:precision binary64
:herbie-target
(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)))))