
(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 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * ((y / z) - (t / (1.0d0 - z)))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
def code(x, y, z, t): return x * ((y / z) - (t / (1.0 - z)))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) - (t / (1.0 - z))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\end{array}
(FPCore (x y z t) :precision binary64 (if (<= y 3.4e+212) (* x (- (/ y z) (/ t (- 1.0 z)))) (- (/ (* y x) z) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3.4e+212) {
tmp = x * ((y / z) - (t / (1.0 - z)));
} else {
tmp = ((y * x) / z) - (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 (y <= 3.4d+212) then
tmp = x * ((y / z) - (t / (1.0d0 - z)))
else
tmp = ((y * x) / z) - (x * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 3.4e+212) {
tmp = x * ((y / z) - (t / (1.0 - z)));
} else {
tmp = ((y * x) / z) - (x * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 3.4e+212: tmp = x * ((y / z) - (t / (1.0 - z))) else: tmp = ((y * x) / z) - (x * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 3.4e+212) tmp = Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))); else tmp = Float64(Float64(Float64(y * x) / z) - Float64(x * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 3.4e+212) tmp = x * ((y / z) - (t / (1.0 - z))); else tmp = ((y * x) / z) - (x * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 3.4e+212], N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision] - N[(x * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.4 \cdot 10^{+212}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{z} - x \cdot t\\
\end{array}
\end{array}
if y < 3.40000000000000037e212Initial program 95.9%
if 3.40000000000000037e212 < y Initial program 68.9%
Taylor expanded in z around 0 99.7%
Final simplification96.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.05) (not (<= z 1.0))) (/ x (/ z (+ y t))) (* (/ x z) (- y (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.05) || !(z <= 1.0)) {
tmp = x / (z / (y + t));
} 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 <= (-1.05d0)) .or. (.not. (z <= 1.0d0))) then
tmp = x / (z / (y + t))
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 <= -1.05) || !(z <= 1.0)) {
tmp = x / (z / (y + t));
} else {
tmp = (x / z) * (y - (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.05) or not (z <= 1.0): tmp = x / (z / (y + t)) else: tmp = (x / z) * (y - (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.05) || !(z <= 1.0)) tmp = Float64(x / Float64(z / Float64(y + t))); 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 <= -1.05) || ~((z <= 1.0))) tmp = x / (z / (y + t)); else tmp = (x / z) * (y - (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.05], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(x / N[(z / N[(y + t), $MachinePrecision]), $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 -1.05 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{x}{\frac{z}{y + t}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \left(y - z \cdot t\right)\\
\end{array}
\end{array}
if z < -1.05000000000000004 or 1 < z Initial program 95.7%
Taylor expanded in z around inf 87.6%
associate-/l*94.3%
cancel-sign-sub-inv94.3%
metadata-eval94.3%
*-lft-identity94.3%
+-commutative94.3%
Simplified94.3%
if -1.05000000000000004 < z < 1Initial program 92.6%
*-commutative92.6%
frac-sub92.5%
associate-*l/97.9%
Applied egg-rr97.9%
Taylor expanded in x around 0 97.9%
times-frac94.4%
*-commutative94.4%
Simplified94.4%
Taylor expanded in z around 0 92.2%
mul-1-neg92.2%
*-commutative92.2%
unsub-neg92.2%
*-commutative92.2%
Simplified92.2%
Final simplification93.2%
(FPCore (x y z t) :precision binary64 (if (<= y 1.3e+216) (* x (- (/ y z) (/ t (- 1.0 z)))) (/ (* y x) z)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.3e+216) {
tmp = x * ((y / z) - (t / (1.0 - 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 (y <= 1.3d+216) then
tmp = x * ((y / z) - (t / (1.0d0 - 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 (y <= 1.3e+216) {
tmp = x * ((y / z) - (t / (1.0 - z)));
} else {
tmp = (y * x) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 1.3e+216: tmp = x * ((y / z) - (t / (1.0 - z))) else: tmp = (y * x) / z return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 1.3e+216) tmp = Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))); else tmp = Float64(Float64(y * x) / z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 1.3e+216) tmp = x * ((y / z) - (t / (1.0 - z))); else tmp = (y * x) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 1.3e+216], N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.3 \cdot 10^{+216}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\end{array}
\end{array}
if y < 1.2999999999999999e216Initial program 95.9%
if 1.2999999999999999e216 < y Initial program 67.1%
Taylor expanded in y around inf 99.7%
Final simplification96.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -8.5e+218) (not (<= z 12000.0))) (* x (/ t z)) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8.5e+218) || !(z <= 12000.0)) {
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 <= (-8.5d+218)) .or. (.not. (z <= 12000.0d0))) 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 <= -8.5e+218) || !(z <= 12000.0)) {
tmp = x * (t / z);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -8.5e+218) or not (z <= 12000.0): tmp = x * (t / z) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -8.5e+218) || !(z <= 12000.0)) 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 <= -8.5e+218) || ~((z <= 12000.0))) tmp = x * (t / z); else tmp = x * ((y / z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -8.5e+218], N[Not[LessEqual[z, 12000.0]], $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 -8.5 \cdot 10^{+218} \lor \neg \left(z \leq 12000\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -8.50000000000000041e218 or 12000 < z Initial program 94.0%
Taylor expanded in y around 0 68.4%
associate-*r/68.4%
associate-*r*68.4%
neg-mul-168.4%
associate-*l/72.0%
*-commutative72.0%
neg-mul-172.0%
*-commutative72.0%
associate-*r/71.9%
metadata-eval71.9%
associate-/r*71.9%
neg-mul-171.9%
associate-*r/72.0%
*-rgt-identity72.0%
neg-sub072.0%
associate--r-72.0%
metadata-eval72.0%
Simplified72.0%
Taylor expanded in z around inf 70.9%
if -8.50000000000000041e218 < z < 12000Initial program 94.0%
Taylor expanded in z around 0 86.6%
+-commutative86.6%
associate-*r/81.8%
*-commutative81.8%
associate-*r*81.8%
neg-mul-181.8%
distribute-rgt-out85.8%
unsub-neg85.8%
Simplified85.8%
Final simplification81.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -0.95) (not (<= z 1.0))) (* (+ y t) (/ x z)) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.95) || !(z <= 1.0)) {
tmp = (y + t) * (x / z);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-0.95d0)) .or. (.not. (z <= 1.0d0))) then
tmp = (y + t) * (x / z)
else
tmp = x * ((y / z) - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.95) || !(z <= 1.0)) {
tmp = (y + t) * (x / z);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -0.95) or not (z <= 1.0): tmp = (y + t) * (x / z) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -0.95) || !(z <= 1.0)) tmp = Float64(Float64(y + t) * Float64(x / z)); else tmp = Float64(x * Float64(Float64(y / z) - t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -0.95) || ~((z <= 1.0))) tmp = (y + t) * (x / z); else tmp = x * ((y / z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -0.95], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(N[(y + t), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.95 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\left(y + t\right) \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -0.94999999999999996 or 1 < z Initial program 95.7%
Taylor expanded in z around inf 87.6%
associate-/l*94.3%
associate-/r/85.1%
cancel-sign-sub-inv85.1%
metadata-eval85.1%
*-lft-identity85.1%
+-commutative85.1%
Simplified85.1%
if -0.94999999999999996 < z < 1Initial program 92.6%
Taylor expanded in z around 0 91.3%
+-commutative91.3%
associate-*r/85.4%
*-commutative85.4%
associate-*r*85.4%
neg-mul-185.4%
distribute-rgt-out90.4%
unsub-neg90.4%
Simplified90.4%
Final simplification88.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.0))) (/ x (/ z (+ y t))) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = x / (z / (y + t));
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.0d0)) .or. (.not. (z <= 1.0d0))) then
tmp = x / (z / (y + t))
else
tmp = x * ((y / z) - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = x / (z / (y + t));
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.0) or not (z <= 1.0): tmp = x / (z / (y + t)) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.0) || !(z <= 1.0)) tmp = Float64(x / Float64(z / Float64(y + t))); else tmp = Float64(x * Float64(Float64(y / z) - t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.0) || ~((z <= 1.0))) tmp = x / (z / (y + t)); else tmp = x * ((y / z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(x / N[(z / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{x}{\frac{z}{y + t}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 95.7%
Taylor expanded in z around inf 87.6%
associate-/l*94.3%
cancel-sign-sub-inv94.3%
metadata-eval94.3%
*-lft-identity94.3%
+-commutative94.3%
Simplified94.3%
if -1 < z < 1Initial program 92.6%
Taylor expanded in z around 0 91.3%
+-commutative91.3%
associate-*r/85.4%
*-commutative85.4%
associate-*r*85.4%
neg-mul-185.4%
distribute-rgt-out90.4%
unsub-neg90.4%
Simplified90.4%
Final simplification92.1%
(FPCore (x y z t) :precision binary64 (if (<= z -8.5e+218) (* x (/ t z)) (if (<= z 7e-7) (* x (- (/ y z) t)) (* x (/ t (+ z -1.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -8.5e+218) {
tmp = x * (t / z);
} else if (z <= 7e-7) {
tmp = x * ((y / z) - t);
} 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 (z <= (-8.5d+218)) then
tmp = x * (t / z)
else if (z <= 7d-7) then
tmp = x * ((y / z) - t)
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 (z <= -8.5e+218) {
tmp = x * (t / z);
} else if (z <= 7e-7) {
tmp = x * ((y / z) - t);
} else {
tmp = x * (t / (z + -1.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -8.5e+218: tmp = x * (t / z) elif z <= 7e-7: tmp = x * ((y / z) - t) else: tmp = x * (t / (z + -1.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -8.5e+218) tmp = Float64(x * Float64(t / z)); elseif (z <= 7e-7) tmp = Float64(x * Float64(Float64(y / z) - t)); 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 (z <= -8.5e+218) tmp = x * (t / z); elseif (z <= 7e-7) tmp = x * ((y / z) - t); else tmp = x * (t / (z + -1.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -8.5e+218], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7e-7], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(x * N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{+218}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{elif}\;z \leq 7 \cdot 10^{-7}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z + -1}\\
\end{array}
\end{array}
if z < -8.50000000000000041e218Initial program 93.6%
Taylor expanded in y around 0 68.2%
associate-*r/68.2%
associate-*r*68.2%
neg-mul-168.2%
associate-*l/68.4%
*-commutative68.4%
neg-mul-168.4%
*-commutative68.4%
associate-*r/68.3%
metadata-eval68.3%
associate-/r*68.3%
neg-mul-168.3%
associate-*r/68.4%
*-rgt-identity68.4%
neg-sub068.4%
associate--r-68.4%
metadata-eval68.4%
Simplified68.4%
Taylor expanded in z around inf 68.4%
if -8.50000000000000041e218 < z < 6.99999999999999968e-7Initial program 93.9%
Taylor expanded in z around 0 86.8%
+-commutative86.8%
associate-*r/82.0%
*-commutative82.0%
associate-*r*82.0%
neg-mul-182.0%
distribute-rgt-out86.0%
unsub-neg86.0%
Simplified86.0%
if 6.99999999999999968e-7 < z Initial program 94.2%
Taylor expanded in y around 0 68.9%
associate-*r/68.9%
associate-*r*68.9%
neg-mul-168.9%
associate-*l/73.1%
*-commutative73.1%
neg-mul-173.1%
*-commutative73.1%
associate-*r/73.1%
metadata-eval73.1%
associate-/r*73.1%
neg-mul-173.1%
associate-*r/73.1%
*-rgt-identity73.1%
neg-sub073.1%
associate--r-73.1%
metadata-eval73.1%
Simplified73.1%
Final simplification81.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.0))) (* t (/ x z)) (* t (- x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = t * (x / z);
} else {
tmp = t * -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 ((z <= (-1.0d0)) .or. (.not. (z <= 1.0d0))) then
tmp = t * (x / z)
else
tmp = t * -x
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.0)) {
tmp = t * (x / z);
} else {
tmp = t * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.0) or not (z <= 1.0): tmp = t * (x / z) else: tmp = t * -x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.0) || !(z <= 1.0)) tmp = Float64(t * Float64(x / z)); else tmp = Float64(t * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.0) || ~((z <= 1.0))) tmp = t * (x / z); else tmp = t * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(t * (-x)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(-x\right)\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 95.7%
Taylor expanded in z around inf 87.6%
associate-/l*94.3%
associate-/r/85.1%
cancel-sign-sub-inv85.1%
metadata-eval85.1%
*-lft-identity85.1%
+-commutative85.1%
Simplified85.1%
Taylor expanded in t around inf 57.0%
associate-*r/59.4%
Simplified59.4%
if -1 < z < 1Initial program 92.6%
Taylor expanded in y around 0 35.9%
associate-*r/35.9%
associate-*r*35.9%
neg-mul-135.9%
associate-*l/35.9%
*-commutative35.9%
neg-mul-135.9%
*-commutative35.9%
associate-*r/35.9%
metadata-eval35.9%
associate-/r*35.9%
neg-mul-135.9%
associate-*r/35.9%
*-rgt-identity35.9%
neg-sub035.9%
associate--r-35.9%
metadata-eval35.9%
Simplified35.9%
Taylor expanded in z around 0 33.9%
neg-mul-133.9%
Simplified33.9%
Final simplification45.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.0))) (* x (/ t z)) (* t (- x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = x * (t / z);
} else {
tmp = t * -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 ((z <= (-1.0d0)) .or. (.not. (z <= 1.0d0))) then
tmp = x * (t / z)
else
tmp = t * -x
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.0)) {
tmp = x * (t / z);
} else {
tmp = t * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.0) or not (z <= 1.0): tmp = x * (t / z) else: tmp = t * -x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.0) || !(z <= 1.0)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(t * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.0) || ~((z <= 1.0))) tmp = x * (t / z); else tmp = t * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(t * (-x)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(-x\right)\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 95.7%
Taylor expanded in y around 0 58.4%
associate-*r/58.4%
associate-*r*58.4%
neg-mul-158.4%
associate-*l/62.6%
*-commutative62.6%
neg-mul-162.6%
*-commutative62.6%
associate-*r/62.5%
metadata-eval62.5%
associate-/r*62.5%
neg-mul-162.5%
associate-*r/62.6%
*-rgt-identity62.6%
neg-sub062.6%
associate--r-62.6%
metadata-eval62.6%
Simplified62.6%
Taylor expanded in z around inf 61.1%
if -1 < z < 1Initial program 92.6%
Taylor expanded in y around 0 35.9%
associate-*r/35.9%
associate-*r*35.9%
neg-mul-135.9%
associate-*l/35.9%
*-commutative35.9%
neg-mul-135.9%
*-commutative35.9%
associate-*r/35.9%
metadata-eval35.9%
associate-/r*35.9%
neg-mul-135.9%
associate-*r/35.9%
*-rgt-identity35.9%
neg-sub035.9%
associate--r-35.9%
metadata-eval35.9%
Simplified35.9%
Taylor expanded in z around 0 33.9%
neg-mul-133.9%
Simplified33.9%
Final simplification46.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -4.3e+178) (not (<= t 1.65e+159))) (* x (/ t z)) (* x (/ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.3e+178) || !(t <= 1.65e+159)) {
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 <= (-4.3d+178)) .or. (.not. (t <= 1.65d+159))) 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 <= -4.3e+178) || !(t <= 1.65e+159)) {
tmp = x * (t / z);
} else {
tmp = x * (y / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -4.3e+178) or not (t <= 1.65e+159): tmp = x * (t / z) else: tmp = x * (y / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -4.3e+178) || !(t <= 1.65e+159)) 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 <= -4.3e+178) || ~((t <= 1.65e+159))) tmp = x * (t / z); else tmp = x * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -4.3e+178], N[Not[LessEqual[t, 1.65e+159]], $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 -4.3 \cdot 10^{+178} \lor \neg \left(t \leq 1.65 \cdot 10^{+159}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\end{array}
\end{array}
if t < -4.3000000000000002e178 or 1.6499999999999999e159 < t Initial program 93.2%
Taylor expanded in y around 0 72.2%
associate-*r/72.2%
associate-*r*72.2%
neg-mul-172.2%
associate-*l/84.4%
*-commutative84.4%
neg-mul-184.4%
*-commutative84.4%
associate-*r/84.4%
metadata-eval84.4%
associate-/r*84.4%
neg-mul-184.4%
associate-*r/84.4%
*-rgt-identity84.4%
neg-sub084.4%
associate--r-84.4%
metadata-eval84.4%
Simplified84.4%
Taylor expanded in z around inf 56.4%
if -4.3000000000000002e178 < t < 1.6499999999999999e159Initial program 94.3%
Taylor expanded in y around inf 77.5%
associate-*r/76.6%
Simplified76.6%
Final simplification71.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.7e-171) (not (<= y 1.05e-148))) (/ (* y x) z) (/ (* x t) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.7e-171) || !(y <= 1.05e-148)) {
tmp = (y * x) / 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 ((y <= (-3.7d-171)) .or. (.not. (y <= 1.05d-148))) then
tmp = (y * x) / 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 ((y <= -3.7e-171) || !(y <= 1.05e-148)) {
tmp = (y * x) / z;
} else {
tmp = (x * t) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.7e-171) or not (y <= 1.05e-148): tmp = (y * x) / z else: tmp = (x * t) / z return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.7e-171) || !(y <= 1.05e-148)) tmp = Float64(Float64(y * x) / z); else tmp = Float64(Float64(x * t) / z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3.7e-171) || ~((y <= 1.05e-148))) tmp = (y * x) / z; else tmp = (x * t) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.7e-171], N[Not[LessEqual[y, 1.05e-148]], $MachinePrecision]], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision], N[(N[(x * t), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.7 \cdot 10^{-171} \lor \neg \left(y \leq 1.05 \cdot 10^{-148}\right):\\
\;\;\;\;\frac{y \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot t}{z}\\
\end{array}
\end{array}
if y < -3.70000000000000012e-171 or 1.05e-148 < y Initial program 94.4%
Taylor expanded in y around inf 74.3%
if -3.70000000000000012e-171 < y < 1.05e-148Initial program 92.9%
Taylor expanded in z around inf 63.0%
associate-/l*61.6%
associate-/r/62.9%
cancel-sign-sub-inv62.9%
metadata-eval62.9%
*-lft-identity62.9%
+-commutative62.9%
Simplified62.9%
Taylor expanded in t around inf 57.3%
Final simplification69.9%
(FPCore (x y z t) :precision binary64 (if (<= z 1.9e-71) (/ x (/ z y)) (if (<= z 1.0) (* t (- x)) (* x (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.9e-71) {
tmp = x / (z / y);
} else if (z <= 1.0) {
tmp = t * -x;
} 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 (z <= 1.9d-71) then
tmp = x / (z / y)
else if (z <= 1.0d0) then
tmp = t * -x
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 (z <= 1.9e-71) {
tmp = x / (z / y);
} else if (z <= 1.0) {
tmp = t * -x;
} else {
tmp = x * (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 1.9e-71: tmp = x / (z / y) elif z <= 1.0: tmp = t * -x else: tmp = x * (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 1.9e-71) tmp = Float64(x / Float64(z / y)); elseif (z <= 1.0) tmp = Float64(t * Float64(-x)); else tmp = Float64(x * Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 1.9e-71) tmp = x / (z / y); elseif (z <= 1.0) tmp = t * -x; else tmp = x * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 1.9e-71], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(t * (-x)), $MachinePrecision], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.9 \cdot 10^{-71}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;t \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\end{array}
\end{array}
if z < 1.89999999999999996e-71Initial program 93.9%
Taylor expanded in y around inf 71.3%
associate-*r/67.9%
Simplified67.9%
associate-*r/71.3%
associate-/l*69.1%
Applied egg-rr69.1%
if 1.89999999999999996e-71 < z < 1Initial program 94.6%
Taylor expanded in y around 0 66.7%
associate-*r/66.7%
associate-*r*66.7%
neg-mul-166.7%
associate-*l/66.7%
*-commutative66.7%
neg-mul-166.7%
*-commutative66.7%
associate-*r/66.6%
metadata-eval66.6%
associate-/r*66.6%
neg-mul-166.6%
associate-*r/66.7%
*-rgt-identity66.7%
neg-sub066.7%
associate--r-66.7%
metadata-eval66.7%
Simplified66.7%
Taylor expanded in z around 0 60.5%
neg-mul-160.5%
Simplified60.5%
if 1 < z Initial program 94.1%
Taylor expanded in y around 0 68.5%
associate-*r/68.5%
associate-*r*68.5%
neg-mul-168.5%
associate-*l/72.7%
*-commutative72.7%
neg-mul-172.7%
*-commutative72.7%
associate-*r/72.7%
metadata-eval72.7%
associate-/r*72.7%
neg-mul-172.7%
associate-*r/72.7%
*-rgt-identity72.7%
neg-sub072.7%
associate--r-72.7%
metadata-eval72.7%
Simplified72.7%
Taylor expanded in z around inf 71.5%
Final simplification69.1%
(FPCore (x y z t) :precision binary64 (* t (- x)))
double code(double x, double y, double z, double t) {
return t * -x;
}
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 = t * -x
end function
public static double code(double x, double y, double z, double t) {
return t * -x;
}
def code(x, y, z, t): return t * -x
function code(x, y, z, t) return Float64(t * Float64(-x)) end
function tmp = code(x, y, z, t) tmp = t * -x; end
code[x_, y_, z_, t_] := N[(t * (-x)), $MachinePrecision]
\begin{array}{l}
\\
t \cdot \left(-x\right)
\end{array}
Initial program 94.0%
Taylor expanded in y around 0 46.1%
associate-*r/46.1%
associate-*r*46.1%
neg-mul-146.1%
associate-*l/48.0%
*-commutative48.0%
neg-mul-148.0%
*-commutative48.0%
associate-*r/48.0%
metadata-eval48.0%
associate-/r*48.0%
neg-mul-148.0%
associate-*r/48.0%
*-rgt-identity48.0%
neg-sub048.0%
associate--r-48.0%
metadata-eval48.0%
Simplified48.0%
Taylor expanded in z around 0 24.3%
neg-mul-124.3%
Simplified24.3%
Final simplification24.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z))))))
(t_2 (* x (- (/ y z) (/ t (- 1.0 z))))))
(if (< t_2 -7.623226303312042e-196)
t_1
(if (< t_2 1.4133944927702302e-211)
(+ (/ (* y x) z) (- (/ (* t x) (- 1.0 z))))
t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
double t_2 = x * ((y / z) - (t / (1.0 - z)));
double tmp;
if (t_2 < -7.623226303312042e-196) {
tmp = t_1;
} else if (t_2 < 1.4133944927702302e-211) {
tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x * ((y / z) - (t * (1.0d0 / (1.0d0 - z))))
t_2 = x * ((y / z) - (t / (1.0d0 - z)))
if (t_2 < (-7.623226303312042d-196)) then
tmp = t_1
else if (t_2 < 1.4133944927702302d-211) then
tmp = ((y * x) / z) + -((t * x) / (1.0d0 - z))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
double t_2 = x * ((y / z) - (t / (1.0 - z)));
double tmp;
if (t_2 < -7.623226303312042e-196) {
tmp = t_1;
} else if (t_2 < 1.4133944927702302e-211) {
tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z)))) t_2 = x * ((y / z) - (t / (1.0 - z))) tmp = 0 if t_2 < -7.623226303312042e-196: tmp = t_1 elif t_2 < 1.4133944927702302e-211: tmp = ((y * x) / z) + -((t * x) / (1.0 - z)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(y / z) - Float64(t * Float64(1.0 / Float64(1.0 - z))))) t_2 = Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) tmp = 0.0 if (t_2 < -7.623226303312042e-196) tmp = t_1; elseif (t_2 < 1.4133944927702302e-211) tmp = Float64(Float64(Float64(y * x) / z) + Float64(-Float64(Float64(t * x) / Float64(1.0 - z)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z)))); t_2 = x * ((y / z) - (t / (1.0 - z))); tmp = 0.0; if (t_2 < -7.623226303312042e-196) tmp = t_1; elseif (t_2 < 1.4133944927702302e-211) tmp = ((y * x) / z) + -((t * x) / (1.0 - z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t * N[(1.0 / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -7.623226303312042e-196], t$95$1, If[Less[t$95$2, 1.4133944927702302e-211], N[(N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision] + (-N[(N[(t * x), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1 - z}\right)\\
t_2 := x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\
\mathbf{if}\;t_2 < -7.623226303312042 \cdot 10^{-196}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_2 < 1.4133944927702302 \cdot 10^{-211}:\\
\;\;\;\;\frac{y \cdot x}{z} + \left(-\frac{t \cdot x}{1 - z}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2023308
(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)))))