
(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 10 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 94.6%
Final simplification94.6%
(FPCore (x y z t)
:precision binary64
(if (<= t -5.6e+142)
(* x (/ t z))
(if (<= t 1.9e-64)
(/ (* x y) z)
(if (<= t 4.4e+210) (* y (/ x z)) (/ x (/ z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -5.6e+142) {
tmp = x * (t / z);
} else if (t <= 1.9e-64) {
tmp = (x * y) / z;
} else if (t <= 4.4e+210) {
tmp = y * (x / z);
} else {
tmp = x / (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 (t <= (-5.6d+142)) then
tmp = x * (t / z)
else if (t <= 1.9d-64) then
tmp = (x * y) / z
else if (t <= 4.4d+210) then
tmp = y * (x / z)
else
tmp = x / (z / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -5.6e+142) {
tmp = x * (t / z);
} else if (t <= 1.9e-64) {
tmp = (x * y) / z;
} else if (t <= 4.4e+210) {
tmp = y * (x / z);
} else {
tmp = x / (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -5.6e+142: tmp = x * (t / z) elif t <= 1.9e-64: tmp = (x * y) / z elif t <= 4.4e+210: tmp = y * (x / z) else: tmp = x / (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -5.6e+142) tmp = Float64(x * Float64(t / z)); elseif (t <= 1.9e-64) tmp = Float64(Float64(x * y) / z); elseif (t <= 4.4e+210) tmp = Float64(y * Float64(x / z)); else tmp = Float64(x / Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -5.6e+142) tmp = x * (t / z); elseif (t <= 1.9e-64) tmp = (x * y) / z; elseif (t <= 4.4e+210) tmp = y * (x / z); else tmp = x / (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -5.6e+142], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.9e-64], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t, 4.4e+210], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.6 \cdot 10^{+142}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{elif}\;t \leq 1.9 \cdot 10^{-64}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{elif}\;t \leq 4.4 \cdot 10^{+210}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\end{array}
\end{array}
if t < -5.6e142Initial program 99.9%
Taylor expanded in z around inf 69.3%
sub-neg69.3%
remove-double-neg69.3%
neg-mul-169.3%
distribute-neg-in69.3%
neg-mul-169.3%
sub-neg69.3%
distribute-lft-neg-in69.3%
distribute-neg-frac69.3%
associate-/l*71.9%
associate-/r/83.3%
distribute-lft-neg-in83.3%
Simplified83.3%
Taylor expanded in y around 0 62.1%
associate-/l*64.6%
associate-/r/73.8%
Simplified73.8%
if -5.6e142 < t < 1.9000000000000001e-64Initial program 92.6%
Taylor expanded in y around inf 84.4%
if 1.9000000000000001e-64 < t < 4.39999999999999974e210Initial program 94.0%
Taylor expanded in z around inf 61.9%
*-commutative61.9%
associate-/l*69.5%
neg-mul-169.5%
Simplified69.5%
Taylor expanded in y around inf 55.1%
associate-*r/67.7%
Simplified67.7%
if 4.39999999999999974e210 < t Initial program 99.8%
Taylor expanded in z around inf 59.0%
*-commutative59.0%
associate-/l*69.0%
neg-mul-169.0%
Simplified69.0%
Taylor expanded in y around 0 58.5%
Final simplification77.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -27.0) (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 <= -27.0) || !(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 <= (-27.0d0)) .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 <= -27.0) || !(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 <= -27.0) 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 <= -27.0) || !(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 <= -27.0) || ~((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, -27.0], 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 -27 \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 < -27 or 1 < z Initial program 95.5%
frac-2neg95.5%
div-inv95.4%
fma-neg95.4%
distribute-neg-frac95.4%
Applied egg-rr95.4%
distribute-frac-neg95.4%
fma-neg95.4%
neg-mul-195.4%
associate-/r*95.4%
metadata-eval95.4%
Simplified95.4%
Taylor expanded in z around inf 87.5%
associate-/l*86.2%
cancel-sign-sub-inv86.2%
metadata-eval86.2%
*-lft-identity86.2%
associate-/l*87.5%
associate-*r/87.2%
Simplified87.2%
if -27 < z < 1Initial program 93.6%
Taylor expanded in z around 0 94.0%
associate-*l/90.4%
associate-*r*90.4%
neg-mul-190.4%
distribute-rgt-out93.6%
unsub-neg93.6%
Simplified93.6%
Final simplification90.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -27.0) (not (<= z 2.4e-12))) (* x (/ (+ y t) z)) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -27.0) || !(z <= 2.4e-12)) {
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 <= (-27.0d0)) .or. (.not. (z <= 2.4d-12))) 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 <= -27.0) || !(z <= 2.4e-12)) {
tmp = x * ((y + t) / z);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -27.0) or not (z <= 2.4e-12): tmp = x * ((y + t) / z) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -27.0) || !(z <= 2.4e-12)) 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 <= -27.0) || ~((z <= 2.4e-12))) 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, -27.0], N[Not[LessEqual[z, 2.4e-12]], $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 -27 \lor \neg \left(z \leq 2.4 \cdot 10^{-12}\right):\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -27 or 2.39999999999999987e-12 < z Initial program 95.5%
Taylor expanded in z around inf 87.6%
sub-neg87.6%
remove-double-neg87.6%
neg-mul-187.6%
distribute-neg-in87.6%
neg-mul-187.6%
sub-neg87.6%
distribute-lft-neg-in87.6%
distribute-neg-frac87.6%
associate-/l*86.3%
associate-/r/95.3%
distribute-lft-neg-in95.3%
Simplified95.3%
if -27 < z < 2.39999999999999987e-12Initial program 93.6%
Taylor expanded in z around 0 93.9%
associate-*l/90.3%
associate-*r*90.3%
neg-mul-190.3%
distribute-rgt-out93.6%
unsub-neg93.6%
Simplified93.6%
Final simplification94.5%
(FPCore (x y z t) :precision binary64 (if (<= t -4.4e+142) (* x (/ t z)) (if (<= t 4.4e-87) (/ (* x y) z) (* x (- (/ y z) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -4.4e+142) {
tmp = x * (t / z);
} else if (t <= 4.4e-87) {
tmp = (x * y) / z;
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-4.4d+142)) then
tmp = x * (t / z)
else if (t <= 4.4d-87) then
tmp = (x * y) / z
else
tmp = x * ((y / z) - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -4.4e+142) {
tmp = x * (t / z);
} else if (t <= 4.4e-87) {
tmp = (x * y) / z;
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -4.4e+142: tmp = x * (t / z) elif t <= 4.4e-87: tmp = (x * y) / z else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -4.4e+142) tmp = Float64(x * Float64(t / z)); elseif (t <= 4.4e-87) tmp = Float64(Float64(x * y) / z); else tmp = Float64(x * Float64(Float64(y / z) - t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -4.4e+142) tmp = x * (t / z); elseif (t <= 4.4e-87) tmp = (x * y) / z; else tmp = x * ((y / z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -4.4e+142], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.4e-87], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.4 \cdot 10^{+142}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{elif}\;t \leq 4.4 \cdot 10^{-87}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if t < -4.39999999999999974e142Initial program 99.9%
Taylor expanded in z around inf 69.3%
sub-neg69.3%
remove-double-neg69.3%
neg-mul-169.3%
distribute-neg-in69.3%
neg-mul-169.3%
sub-neg69.3%
distribute-lft-neg-in69.3%
distribute-neg-frac69.3%
associate-/l*71.9%
associate-/r/83.3%
distribute-lft-neg-in83.3%
Simplified83.3%
Taylor expanded in y around 0 62.1%
associate-/l*64.6%
associate-/r/73.8%
Simplified73.8%
if -4.39999999999999974e142 < t < 4.39999999999999976e-87Initial program 92.3%
Taylor expanded in y around inf 85.7%
if 4.39999999999999976e-87 < t Initial program 96.0%
Taylor expanded in z around 0 61.5%
associate-*l/61.3%
associate-*r*61.3%
neg-mul-161.3%
distribute-rgt-out64.0%
unsub-neg64.0%
Simplified64.0%
Final simplification77.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -5.2e+142) (not (<= t 4.4e+210))) (* x (/ t z)) (* y (/ x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.2e+142) || !(t <= 4.4e+210)) {
tmp = x * (t / z);
} else {
tmp = y * (x / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-5.2d+142)) .or. (.not. (t <= 4.4d+210))) then
tmp = x * (t / z)
else
tmp = y * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.2e+142) || !(t <= 4.4e+210)) {
tmp = x * (t / z);
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -5.2e+142) or not (t <= 4.4e+210): tmp = x * (t / z) else: tmp = y * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -5.2e+142) || !(t <= 4.4e+210)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -5.2e+142) || ~((t <= 4.4e+210))) tmp = x * (t / z); else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -5.2e+142], N[Not[LessEqual[t, 4.4e+210]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.2 \cdot 10^{+142} \lor \neg \left(t \leq 4.4 \cdot 10^{+210}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if t < -5.20000000000000043e142 or 4.39999999999999974e210 < t Initial program 99.9%
Taylor expanded in z around inf 66.1%
sub-neg66.1%
remove-double-neg66.1%
neg-mul-166.1%
distribute-neg-in66.1%
neg-mul-166.1%
sub-neg66.1%
distribute-lft-neg-in66.1%
distribute-neg-frac66.1%
associate-/l*69.3%
associate-/r/78.8%
distribute-lft-neg-in78.8%
Simplified78.8%
Taylor expanded in y around 0 57.8%
associate-/l*61.1%
associate-/r/68.9%
Simplified68.9%
if -5.20000000000000043e142 < t < 4.39999999999999974e210Initial program 93.0%
Taylor expanded in z around inf 80.6%
*-commutative80.6%
associate-/l*79.1%
neg-mul-179.1%
Simplified79.1%
Taylor expanded in y around inf 77.1%
associate-*r/75.6%
Simplified75.6%
Final simplification74.0%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.9e+142) (not (<= t 4.4e+210))) (* x (/ t z)) (* x (/ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.9e+142) || !(t <= 4.4e+210)) {
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.9d+142)) .or. (.not. (t <= 4.4d+210))) 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.9e+142) || !(t <= 4.4e+210)) {
tmp = x * (t / z);
} else {
tmp = x * (y / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3.9e+142) or not (t <= 4.4e+210): tmp = x * (t / z) else: tmp = x * (y / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3.9e+142) || !(t <= 4.4e+210)) 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.9e+142) || ~((t <= 4.4e+210))) tmp = x * (t / z); else tmp = x * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3.9e+142], N[Not[LessEqual[t, 4.4e+210]], $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.9 \cdot 10^{+142} \lor \neg \left(t \leq 4.4 \cdot 10^{+210}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\end{array}
\end{array}
if t < -3.9e142 or 4.39999999999999974e210 < t Initial program 99.9%
Taylor expanded in z around inf 66.1%
sub-neg66.1%
remove-double-neg66.1%
neg-mul-166.1%
distribute-neg-in66.1%
neg-mul-166.1%
sub-neg66.1%
distribute-lft-neg-in66.1%
distribute-neg-frac66.1%
associate-/l*69.3%
associate-/r/78.8%
distribute-lft-neg-in78.8%
Simplified78.8%
Taylor expanded in y around 0 57.8%
associate-/l*61.1%
associate-/r/68.9%
Simplified68.9%
if -3.9e142 < t < 4.39999999999999974e210Initial program 93.0%
Taylor expanded in y around inf 77.1%
associate-*l/76.4%
Simplified76.4%
Final simplification74.7%
(FPCore (x y z t) :precision binary64 (if (<= t -5.5e+142) (* x (/ t z)) (if (<= t 9.5e+211) (* x (/ y z)) (/ x (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -5.5e+142) {
tmp = x * (t / z);
} else if (t <= 9.5e+211) {
tmp = x * (y / z);
} else {
tmp = x / (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 (t <= (-5.5d+142)) then
tmp = x * (t / z)
else if (t <= 9.5d+211) then
tmp = x * (y / z)
else
tmp = x / (z / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -5.5e+142) {
tmp = x * (t / z);
} else if (t <= 9.5e+211) {
tmp = x * (y / z);
} else {
tmp = x / (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -5.5e+142: tmp = x * (t / z) elif t <= 9.5e+211: tmp = x * (y / z) else: tmp = x / (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -5.5e+142) tmp = Float64(x * Float64(t / z)); elseif (t <= 9.5e+211) tmp = Float64(x * Float64(y / z)); else tmp = Float64(x / Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -5.5e+142) tmp = x * (t / z); elseif (t <= 9.5e+211) tmp = x * (y / z); else tmp = x / (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -5.5e+142], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 9.5e+211], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.5 \cdot 10^{+142}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{elif}\;t \leq 9.5 \cdot 10^{+211}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\end{array}
\end{array}
if t < -5.50000000000000035e142Initial program 99.9%
Taylor expanded in z around inf 69.3%
sub-neg69.3%
remove-double-neg69.3%
neg-mul-169.3%
distribute-neg-in69.3%
neg-mul-169.3%
sub-neg69.3%
distribute-lft-neg-in69.3%
distribute-neg-frac69.3%
associate-/l*71.9%
associate-/r/83.3%
distribute-lft-neg-in83.3%
Simplified83.3%
Taylor expanded in y around 0 62.1%
associate-/l*64.6%
associate-/r/73.8%
Simplified73.8%
if -5.50000000000000035e142 < t < 9.4999999999999997e211Initial program 93.0%
Taylor expanded in y around inf 77.1%
associate-*l/76.4%
Simplified76.4%
if 9.4999999999999997e211 < t Initial program 99.8%
Taylor expanded in z around inf 59.0%
*-commutative59.0%
associate-/l*69.0%
neg-mul-169.0%
Simplified69.0%
Taylor expanded in y around 0 58.5%
Final simplification74.7%
(FPCore (x y z t) :precision binary64 (if (<= t -7e+142) (* x (/ t z)) (if (<= t 4.4e+210) (/ x (/ z y)) (/ x (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -7e+142) {
tmp = x * (t / z);
} else if (t <= 4.4e+210) {
tmp = x / (z / y);
} else {
tmp = x / (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 (t <= (-7d+142)) then
tmp = x * (t / z)
else if (t <= 4.4d+210) then
tmp = x / (z / y)
else
tmp = x / (z / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -7e+142) {
tmp = x * (t / z);
} else if (t <= 4.4e+210) {
tmp = x / (z / y);
} else {
tmp = x / (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -7e+142: tmp = x * (t / z) elif t <= 4.4e+210: tmp = x / (z / y) else: tmp = x / (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -7e+142) tmp = Float64(x * Float64(t / z)); elseif (t <= 4.4e+210) tmp = Float64(x / Float64(z / y)); else tmp = Float64(x / Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -7e+142) tmp = x * (t / z); elseif (t <= 4.4e+210) tmp = x / (z / y); else tmp = x / (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -7e+142], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.4e+210], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7 \cdot 10^{+142}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{elif}\;t \leq 4.4 \cdot 10^{+210}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\end{array}
\end{array}
if t < -6.99999999999999995e142Initial program 99.9%
Taylor expanded in z around inf 69.3%
sub-neg69.3%
remove-double-neg69.3%
neg-mul-169.3%
distribute-neg-in69.3%
neg-mul-169.3%
sub-neg69.3%
distribute-lft-neg-in69.3%
distribute-neg-frac69.3%
associate-/l*71.9%
associate-/r/83.3%
distribute-lft-neg-in83.3%
Simplified83.3%
Taylor expanded in y around 0 62.1%
associate-/l*64.6%
associate-/r/73.8%
Simplified73.8%
if -6.99999999999999995e142 < t < 4.39999999999999974e210Initial program 93.0%
Taylor expanded in z around inf 80.6%
*-commutative80.6%
associate-/l*79.1%
neg-mul-179.1%
Simplified79.1%
Taylor expanded in y around inf 76.7%
if 4.39999999999999974e210 < t Initial program 99.8%
Taylor expanded in z around inf 59.0%
*-commutative59.0%
associate-/l*69.0%
neg-mul-169.0%
Simplified69.0%
Taylor expanded in y around 0 58.5%
Final simplification74.9%
(FPCore (x y z t) :precision binary64 (* y (/ x z)))
double code(double x, double y, double z, double t) {
return y * (x / 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 = y * (x / z)
end function
public static double code(double x, double y, double z, double t) {
return y * (x / z);
}
def code(x, y, z, t): return y * (x / z)
function code(x, y, z, t) return Float64(y * Float64(x / z)) end
function tmp = code(x, y, z, t) tmp = y * (x / z); end
code[x_, y_, z_, t_] := N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \frac{x}{z}
\end{array}
Initial program 94.6%
Taylor expanded in z around inf 77.2%
*-commutative77.2%
associate-/l*79.0%
neg-mul-179.0%
Simplified79.0%
Taylor expanded in y around inf 64.2%
associate-*r/63.4%
Simplified63.4%
Final simplification63.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 2023171
(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)))))