
(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 (let* ((t_1 (- (/ y z) (/ t (- 1.0 z))))) (if (<= t_1 1e+270) (* t_1 x) (* y (/ x z)))))
double code(double x, double y, double z, double t) {
double t_1 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_1 <= 1e+270) {
tmp = t_1 * x;
} else {
tmp = y * (x / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (y / z) - (t / (1.0d0 - z))
if (t_1 <= 1d+270) then
tmp = t_1 * x
else
tmp = y * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_1 <= 1e+270) {
tmp = t_1 * x;
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / z) - (t / (1.0 - z)) tmp = 0 if t_1 <= 1e+270: tmp = t_1 * x else: tmp = y * (x / z) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y / z) - Float64(t / Float64(1.0 - z))) tmp = 0.0 if (t_1 <= 1e+270) tmp = Float64(t_1 * x); else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y / z) - (t / (1.0 - z)); tmp = 0.0; if (t_1 <= 1e+270) tmp = t_1 * x; else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e+270], N[(t$95$1 * x), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} - \frac{t}{1 - z}\\
\mathbf{if}\;t_1 \leq 10^{+270}:\\
\;\;\;\;t_1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 1e270Initial program 97.0%
if 1e270 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) Initial program 65.5%
Taylor expanded in y around inf 95.0%
associate-/l*63.6%
associate-/r/100.0%
Simplified100.0%
Final simplification97.2%
(FPCore (x y z t)
:precision binary64
(if (<= z -3.2e+92)
(/ x (/ z t))
(if (<= z 2.9e+44)
(* x (- (/ y z) t))
(if (or (<= z 9.5e+227) (not (<= z 4.8e+263)))
(/ (* t x) z)
(/ x (/ z y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.2e+92) {
tmp = x / (z / t);
} else if (z <= 2.9e+44) {
tmp = x * ((y / z) - t);
} else if ((z <= 9.5e+227) || !(z <= 4.8e+263)) {
tmp = (t * x) / z;
} else {
tmp = x / (z / y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-3.2d+92)) then
tmp = x / (z / t)
else if (z <= 2.9d+44) then
tmp = x * ((y / z) - t)
else if ((z <= 9.5d+227) .or. (.not. (z <= 4.8d+263))) then
tmp = (t * x) / z
else
tmp = x / (z / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.2e+92) {
tmp = x / (z / t);
} else if (z <= 2.9e+44) {
tmp = x * ((y / z) - t);
} else if ((z <= 9.5e+227) || !(z <= 4.8e+263)) {
tmp = (t * x) / z;
} else {
tmp = x / (z / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3.2e+92: tmp = x / (z / t) elif z <= 2.9e+44: tmp = x * ((y / z) - t) elif (z <= 9.5e+227) or not (z <= 4.8e+263): tmp = (t * x) / z else: tmp = x / (z / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3.2e+92) tmp = Float64(x / Float64(z / t)); elseif (z <= 2.9e+44) tmp = Float64(x * Float64(Float64(y / z) - t)); elseif ((z <= 9.5e+227) || !(z <= 4.8e+263)) tmp = Float64(Float64(t * x) / z); else tmp = Float64(x / Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3.2e+92) tmp = x / (z / t); elseif (z <= 2.9e+44) tmp = x * ((y / z) - t); elseif ((z <= 9.5e+227) || ~((z <= 4.8e+263))) tmp = (t * x) / z; else tmp = x / (z / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.2e+92], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.9e+44], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 9.5e+227], N[Not[LessEqual[z, 4.8e+263]], $MachinePrecision]], N[(N[(t * x), $MachinePrecision] / z), $MachinePrecision], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{+92}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+44}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{+227} \lor \neg \left(z \leq 4.8 \cdot 10^{+263}\right):\\
\;\;\;\;\frac{t \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\end{array}
\end{array}
if z < -3.20000000000000025e92Initial program 94.3%
Taylor expanded in z around inf 81.5%
associate-/l*94.3%
cancel-sign-sub-inv94.3%
metadata-eval94.3%
*-lft-identity94.3%
+-commutative94.3%
Simplified94.3%
Taylor expanded in t around inf 63.9%
if -3.20000000000000025e92 < z < 2.9000000000000002e44Initial program 93.4%
Taylor expanded in z around 0 85.1%
+-commutative85.1%
associate-*r/84.9%
*-commutative84.9%
associate-*r*84.9%
neg-mul-184.9%
distribute-rgt-out86.9%
unsub-neg86.9%
Simplified86.9%
if 2.9000000000000002e44 < z < 9.5000000000000005e227 or 4.8000000000000001e263 < z Initial program 97.8%
Taylor expanded in z around inf 93.9%
associate-/l*97.8%
cancel-sign-sub-inv97.8%
metadata-eval97.8%
*-lft-identity97.8%
+-commutative97.8%
Simplified97.8%
Taylor expanded in t around inf 68.5%
if 9.5000000000000005e227 < z < 4.8000000000000001e263Initial program 99.3%
Taylor expanded in z around inf 88.8%
associate-/l*99.8%
cancel-sign-sub-inv99.8%
metadata-eval99.8%
*-lft-identity99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in t around 0 88.4%
Final simplification78.8%
(FPCore (x y z t)
:precision binary64
(if (<= y -3.3e-84)
(* y (/ x z))
(if (<= y 4.8e-150)
(* x (/ t (+ z -1.0)))
(if (<= y 1.6e+54) (* x (- (/ y z) t)) (/ x (/ z y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.3e-84) {
tmp = y * (x / z);
} else if (y <= 4.8e-150) {
tmp = x * (t / (z + -1.0));
} else if (y <= 1.6e+54) {
tmp = x * ((y / z) - t);
} else {
tmp = x / (z / y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-3.3d-84)) then
tmp = y * (x / z)
else if (y <= 4.8d-150) then
tmp = x * (t / (z + (-1.0d0)))
else if (y <= 1.6d+54) then
tmp = x * ((y / z) - t)
else
tmp = x / (z / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.3e-84) {
tmp = y * (x / z);
} else if (y <= 4.8e-150) {
tmp = x * (t / (z + -1.0));
} else if (y <= 1.6e+54) {
tmp = x * ((y / z) - t);
} else {
tmp = x / (z / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.3e-84: tmp = y * (x / z) elif y <= 4.8e-150: tmp = x * (t / (z + -1.0)) elif y <= 1.6e+54: tmp = x * ((y / z) - t) else: tmp = x / (z / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.3e-84) tmp = Float64(y * Float64(x / z)); elseif (y <= 4.8e-150) tmp = Float64(x * Float64(t / Float64(z + -1.0))); elseif (y <= 1.6e+54) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(x / Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -3.3e-84) tmp = y * (x / z); elseif (y <= 4.8e-150) tmp = x * (t / (z + -1.0)); elseif (y <= 1.6e+54) tmp = x * ((y / z) - t); else tmp = x / (z / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.3e-84], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.8e-150], N[(x * N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.6e+54], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.3 \cdot 10^{-84}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{-150}:\\
\;\;\;\;x \cdot \frac{t}{z + -1}\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+54}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\end{array}
\end{array}
if y < -3.29999999999999984e-84Initial program 91.3%
Taylor expanded in y around inf 75.6%
associate-/l*75.8%
associate-/r/76.9%
Simplified76.9%
if -3.29999999999999984e-84 < y < 4.8e-150Initial program 97.6%
Taylor expanded in y around 0 74.4%
associate-*r/74.4%
associate-*r*74.4%
neg-mul-174.4%
associate-*l/77.6%
*-commutative77.6%
neg-mul-177.6%
*-commutative77.6%
associate-*r/77.5%
metadata-eval77.5%
associate-/r*77.5%
neg-mul-177.5%
associate-*r/77.6%
*-rgt-identity77.6%
neg-sub077.6%
associate--r-77.6%
metadata-eval77.6%
Simplified77.6%
if 4.8e-150 < y < 1.6e54Initial program 97.4%
Taylor expanded in z around 0 70.4%
+-commutative70.4%
associate-*r/72.8%
*-commutative72.8%
associate-*r*72.8%
neg-mul-172.8%
distribute-rgt-out72.8%
unsub-neg72.8%
Simplified72.8%
if 1.6e54 < y Initial program 92.4%
Taylor expanded in z around inf 86.4%
associate-/l*91.2%
cancel-sign-sub-inv91.2%
metadata-eval91.2%
*-lft-identity91.2%
+-commutative91.2%
Simplified91.2%
Taylor expanded in t around 0 81.8%
Final simplification77.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.15) (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.15) || !(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.15d0)) .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.15) || !(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.15) 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.15) || !(z <= 1.0)) tmp = Float64(Float64(x / 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.15) || ~((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.15], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] * N[(y + t), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{x}{z} \cdot \left(y + t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -1.1499999999999999 or 1 < z Initial program 96.9%
Taylor expanded in z around inf 88.3%
associate-/l*96.5%
associate-/r/88.2%
cancel-sign-sub-inv88.2%
metadata-eval88.2%
*-lft-identity88.2%
+-commutative88.2%
Simplified88.2%
if -1.1499999999999999 < z < 1Initial program 91.9%
Taylor expanded in z around 0 91.2%
+-commutative91.2%
associate-*r/89.3%
*-commutative89.3%
associate-*r*89.3%
neg-mul-189.3%
distribute-rgt-out91.8%
unsub-neg91.8%
Simplified91.8%
Final simplification89.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.05) (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.05) || !(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.05d0)) .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.05) || !(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.05) 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.05) || !(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.05) || ~((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.05], 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.05 \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.05000000000000004 or 1 < z Initial program 96.9%
Taylor expanded in z around inf 88.3%
associate-/l*96.5%
cancel-sign-sub-inv96.5%
metadata-eval96.5%
*-lft-identity96.5%
+-commutative96.5%
Simplified96.5%
if -1.05000000000000004 < z < 1Initial program 91.9%
Taylor expanded in z around 0 91.2%
+-commutative91.2%
associate-*r/89.3%
*-commutative89.3%
associate-*r*89.3%
neg-mul-189.3%
distribute-rgt-out91.8%
unsub-neg91.8%
Simplified91.8%
Final simplification94.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -5e+153) (not (<= t 0.0052))) (* x (/ t z)) (* (/ y z) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5e+153) || !(t <= 0.0052)) {
tmp = x * (t / z);
} else {
tmp = (y / z) * x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-5d+153)) .or. (.not. (t <= 0.0052d0))) then
tmp = x * (t / z)
else
tmp = (y / z) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5e+153) || !(t <= 0.0052)) {
tmp = x * (t / z);
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -5e+153) or not (t <= 0.0052): tmp = x * (t / z) else: tmp = (y / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -5e+153) || !(t <= 0.0052)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(Float64(y / z) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -5e+153) || ~((t <= 0.0052))) tmp = x * (t / z); else tmp = (y / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -5e+153], N[Not[LessEqual[t, 0.0052]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{+153} \lor \neg \left(t \leq 0.0052\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if t < -5.00000000000000018e153 or 0.0051999999999999998 < t Initial program 95.7%
Taylor expanded in z around inf 70.4%
associate-/l*73.1%
cancel-sign-sub-inv73.1%
metadata-eval73.1%
*-lft-identity73.1%
+-commutative73.1%
Simplified73.1%
Taylor expanded in t around inf 60.1%
clear-num59.2%
associate-/r/59.9%
clear-num59.9%
Applied egg-rr59.9%
if -5.00000000000000018e153 < t < 0.0051999999999999998Initial program 94.0%
Taylor expanded in y around inf 72.3%
associate-*r/78.3%
Simplified78.3%
Final simplification71.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.18e+154) (not (<= t 0.0052))) (/ x (/ z t)) (* (/ y z) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.18e+154) || !(t <= 0.0052)) {
tmp = x / (z / t);
} else {
tmp = (y / z) * x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-1.18d+154)) .or. (.not. (t <= 0.0052d0))) then
tmp = x / (z / t)
else
tmp = (y / z) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.18e+154) || !(t <= 0.0052)) {
tmp = x / (z / t);
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.18e+154) or not (t <= 0.0052): tmp = x / (z / t) else: tmp = (y / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.18e+154) || !(t <= 0.0052)) tmp = Float64(x / Float64(z / t)); else tmp = Float64(Float64(y / z) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.18e+154) || ~((t <= 0.0052))) tmp = x / (z / t); else tmp = (y / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.18e+154], N[Not[LessEqual[t, 0.0052]], $MachinePrecision]], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.18 \cdot 10^{+154} \lor \neg \left(t \leq 0.0052\right):\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if t < -1.18000000000000004e154 or 0.0051999999999999998 < t Initial program 95.7%
Taylor expanded in z around inf 70.4%
associate-/l*73.1%
cancel-sign-sub-inv73.1%
metadata-eval73.1%
*-lft-identity73.1%
+-commutative73.1%
Simplified73.1%
Taylor expanded in t around inf 60.1%
if -1.18000000000000004e154 < t < 0.0051999999999999998Initial program 94.0%
Taylor expanded in y around inf 72.3%
associate-*r/78.3%
Simplified78.3%
Final simplification71.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -4.7e+153) (not (<= t 0.0052))) (/ x (/ z t)) (/ x (/ z y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.7e+153) || !(t <= 0.0052)) {
tmp = x / (z / t);
} else {
tmp = x / (z / y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-4.7d+153)) .or. (.not. (t <= 0.0052d0))) then
tmp = x / (z / t)
else
tmp = x / (z / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.7e+153) || !(t <= 0.0052)) {
tmp = x / (z / t);
} else {
tmp = x / (z / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -4.7e+153) or not (t <= 0.0052): tmp = x / (z / t) else: tmp = x / (z / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -4.7e+153) || !(t <= 0.0052)) tmp = Float64(x / Float64(z / t)); else tmp = Float64(x / Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -4.7e+153) || ~((t <= 0.0052))) tmp = x / (z / t); else tmp = x / (z / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -4.7e+153], N[Not[LessEqual[t, 0.0052]], $MachinePrecision]], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.7 \cdot 10^{+153} \lor \neg \left(t \leq 0.0052\right):\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\end{array}
\end{array}
if t < -4.69999999999999968e153 or 0.0051999999999999998 < t Initial program 95.7%
Taylor expanded in z around inf 70.4%
associate-/l*73.1%
cancel-sign-sub-inv73.1%
metadata-eval73.1%
*-lft-identity73.1%
+-commutative73.1%
Simplified73.1%
Taylor expanded in t around inf 60.1%
if -4.69999999999999968e153 < t < 0.0051999999999999998Initial program 94.0%
Taylor expanded in z around inf 76.5%
associate-/l*78.8%
cancel-sign-sub-inv78.8%
metadata-eval78.8%
*-lft-identity78.8%
+-commutative78.8%
Simplified78.8%
Taylor expanded in t around 0 78.7%
Final simplification71.9%
(FPCore (x y z t) :precision binary64 (if (<= t -6e+179) (* t (- x)) (* (/ y z) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -6e+179) {
tmp = t * -x;
} else {
tmp = (y / z) * x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-6d+179)) then
tmp = t * -x
else
tmp = (y / z) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -6e+179) {
tmp = t * -x;
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -6e+179: tmp = t * -x else: tmp = (y / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -6e+179) tmp = Float64(t * Float64(-x)); else tmp = Float64(Float64(y / z) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -6e+179) tmp = t * -x; else tmp = (y / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -6e+179], N[(t * (-x)), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6 \cdot 10^{+179}:\\
\;\;\;\;t \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if t < -5.9999999999999996e179Initial program 96.6%
Taylor expanded in z around 0 51.4%
+-commutative51.4%
associate-*r/48.2%
*-commutative48.2%
associate-*r*48.2%
neg-mul-148.2%
distribute-rgt-out51.6%
unsub-neg51.6%
Simplified51.6%
Taylor expanded in y around 0 42.0%
mul-1-neg42.0%
distribute-lft-neg-out42.0%
*-commutative42.0%
Simplified42.0%
if -5.9999999999999996e179 < t Initial program 94.4%
Taylor expanded in y around inf 64.6%
associate-*r/67.7%
Simplified67.7%
Final simplification64.6%
(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.6%
Taylor expanded in z around 0 59.8%
+-commutative59.8%
associate-*r/61.9%
*-commutative61.9%
associate-*r*61.9%
neg-mul-161.9%
distribute-rgt-out63.4%
unsub-neg63.4%
Simplified63.4%
Taylor expanded in y around 0 22.8%
mul-1-neg22.8%
distribute-lft-neg-out22.8%
*-commutative22.8%
Simplified22.8%
Final simplification22.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z))))))
(t_2 (* x (- (/ y z) (/ t (- 1.0 z))))))
(if (< t_2 -7.623226303312042e-196)
t_1
(if (< t_2 1.4133944927702302e-211)
(+ (/ (* y x) z) (- (/ (* t x) (- 1.0 z))))
t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
double t_2 = x * ((y / z) - (t / (1.0 - z)));
double tmp;
if (t_2 < -7.623226303312042e-196) {
tmp = t_1;
} else if (t_2 < 1.4133944927702302e-211) {
tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x * ((y / z) - (t * (1.0d0 / (1.0d0 - z))))
t_2 = x * ((y / z) - (t / (1.0d0 - z)))
if (t_2 < (-7.623226303312042d-196)) then
tmp = t_1
else if (t_2 < 1.4133944927702302d-211) then
tmp = ((y * x) / z) + -((t * x) / (1.0d0 - z))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
double t_2 = x * ((y / z) - (t / (1.0 - z)));
double tmp;
if (t_2 < -7.623226303312042e-196) {
tmp = t_1;
} else if (t_2 < 1.4133944927702302e-211) {
tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z)))) t_2 = x * ((y / z) - (t / (1.0 - z))) tmp = 0 if t_2 < -7.623226303312042e-196: tmp = t_1 elif t_2 < 1.4133944927702302e-211: tmp = ((y * x) / z) + -((t * x) / (1.0 - z)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(y / z) - Float64(t * Float64(1.0 / Float64(1.0 - z))))) t_2 = Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) tmp = 0.0 if (t_2 < -7.623226303312042e-196) tmp = t_1; elseif (t_2 < 1.4133944927702302e-211) tmp = Float64(Float64(Float64(y * x) / z) + Float64(-Float64(Float64(t * x) / Float64(1.0 - z)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z)))); t_2 = x * ((y / z) - (t / (1.0 - z))); tmp = 0.0; if (t_2 < -7.623226303312042e-196) tmp = t_1; elseif (t_2 < 1.4133944927702302e-211) tmp = ((y * x) / z) + -((t * x) / (1.0 - z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t * N[(1.0 / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -7.623226303312042e-196], t$95$1, If[Less[t$95$2, 1.4133944927702302e-211], N[(N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision] + (-N[(N[(t * x), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1 - z}\right)\\
t_2 := x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\
\mathbf{if}\;t_2 < -7.623226303312042 \cdot 10^{-196}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_2 < 1.4133944927702302 \cdot 10^{-211}:\\
\;\;\;\;\frac{y \cdot x}{z} + \left(-\frac{t \cdot x}{1 - z}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2023322
(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)))))