
(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 9 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 (/ t (+ z -1.0))))
(if (<= (+ (/ y z) t_1) (- INFINITY))
(/ y (/ z x))
(* x (+ (* y (/ 1.0 z)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = t / (z + -1.0);
double tmp;
if (((y / z) + t_1) <= -((double) INFINITY)) {
tmp = y / (z / x);
} else {
tmp = x * ((y * (1.0 / z)) + t_1);
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = t / (z + -1.0);
double tmp;
if (((y / z) + t_1) <= -Double.POSITIVE_INFINITY) {
tmp = y / (z / x);
} else {
tmp = x * ((y * (1.0 / z)) + t_1);
}
return tmp;
}
def code(x, y, z, t): t_1 = t / (z + -1.0) tmp = 0 if ((y / z) + t_1) <= -math.inf: tmp = y / (z / x) else: tmp = x * ((y * (1.0 / z)) + t_1) return tmp
function code(x, y, z, t) t_1 = Float64(t / Float64(z + -1.0)) tmp = 0.0 if (Float64(Float64(y / z) + t_1) <= Float64(-Inf)) tmp = Float64(y / Float64(z / x)); else tmp = Float64(x * Float64(Float64(y * Float64(1.0 / z)) + t_1)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t / (z + -1.0); tmp = 0.0; if (((y / z) + t_1) <= -Inf) tmp = y / (z / x); else tmp = x * ((y * (1.0 / z)) + t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(y / z), $MachinePrecision] + t$95$1), $MachinePrecision], (-Infinity)], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y * N[(1.0 / z), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{z + -1}\\
\mathbf{if}\;\frac{y}{z} + t\_1 \leq -\infty:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{1}{z} + t\_1\right)\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -inf.0Initial program 65.6%
Taylor expanded in y around inf 99.9%
associate-*r/65.6%
Simplified65.6%
clear-num65.6%
un-div-inv69.2%
Applied egg-rr69.2%
associate-/r/99.9%
Applied egg-rr99.9%
*-commutative99.9%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 97.8%
clear-num97.7%
associate-/r/97.8%
Applied egg-rr97.8%
Final simplification98.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (/ x (+ z -1.0)))))
(if (<= t -4.4e+133)
t_1
(if (<= t -8.6e+103)
(/ y (/ z x))
(if (or (<= t -2.3e+55) (not (<= t 2.2e+72))) t_1 (/ x (/ z y)))))))
double code(double x, double y, double z, double t) {
double t_1 = t * (x / (z + -1.0));
double tmp;
if (t <= -4.4e+133) {
tmp = t_1;
} else if (t <= -8.6e+103) {
tmp = y / (z / x);
} else if ((t <= -2.3e+55) || !(t <= 2.2e+72)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = t * (x / (z + (-1.0d0)))
if (t <= (-4.4d+133)) then
tmp = t_1
else if (t <= (-8.6d+103)) then
tmp = y / (z / x)
else if ((t <= (-2.3d+55)) .or. (.not. (t <= 2.2d+72))) then
tmp = t_1
else
tmp = x / (z / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t * (x / (z + -1.0));
double tmp;
if (t <= -4.4e+133) {
tmp = t_1;
} else if (t <= -8.6e+103) {
tmp = y / (z / x);
} else if ((t <= -2.3e+55) || !(t <= 2.2e+72)) {
tmp = t_1;
} else {
tmp = x / (z / y);
}
return tmp;
}
def code(x, y, z, t): t_1 = t * (x / (z + -1.0)) tmp = 0 if t <= -4.4e+133: tmp = t_1 elif t <= -8.6e+103: tmp = y / (z / x) elif (t <= -2.3e+55) or not (t <= 2.2e+72): tmp = t_1 else: tmp = x / (z / y) return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(x / Float64(z + -1.0))) tmp = 0.0 if (t <= -4.4e+133) tmp = t_1; elseif (t <= -8.6e+103) tmp = Float64(y / Float64(z / x)); elseif ((t <= -2.3e+55) || !(t <= 2.2e+72)) tmp = t_1; else tmp = Float64(x / Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * (x / (z + -1.0)); tmp = 0.0; if (t <= -4.4e+133) tmp = t_1; elseif (t <= -8.6e+103) tmp = y / (z / x); elseif ((t <= -2.3e+55) || ~((t <= 2.2e+72))) tmp = t_1; else tmp = x / (z / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(x / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -4.4e+133], t$95$1, If[LessEqual[t, -8.6e+103], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t, -2.3e+55], N[Not[LessEqual[t, 2.2e+72]], $MachinePrecision]], t$95$1, N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{x}{z + -1}\\
\mathbf{if}\;t \leq -4.4 \cdot 10^{+133}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -8.6 \cdot 10^{+103}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\mathbf{elif}\;t \leq -2.3 \cdot 10^{+55} \lor \neg \left(t \leq 2.2 \cdot 10^{+72}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\end{array}
\end{array}
if t < -4.4e133 or -8.59999999999999938e103 < t < -2.29999999999999987e55 or 2.2e72 < t Initial program 94.0%
Taylor expanded in y around 0 75.6%
mul-1-neg75.6%
associate-/l*73.7%
distribute-rgt-neg-in73.7%
distribute-neg-frac273.7%
neg-sub073.7%
associate--r-73.7%
metadata-eval73.7%
Simplified73.7%
if -4.4e133 < t < -8.59999999999999938e103Initial program 99.4%
Taylor expanded in y around inf 84.9%
associate-*r/84.6%
Simplified84.6%
clear-num84.6%
un-div-inv84.6%
Applied egg-rr84.6%
associate-/r/84.6%
Applied egg-rr84.6%
*-commutative84.6%
clear-num84.6%
un-div-inv84.9%
Applied egg-rr84.9%
if -2.29999999999999987e55 < t < 2.2e72Initial program 95.5%
Taylor expanded in y around inf 86.1%
associate-*r/86.1%
Simplified86.1%
clear-num86.1%
un-div-inv86.6%
Applied egg-rr86.6%
Final simplification81.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (+ (/ y z) (/ t (+ z -1.0))))) (if (<= t_1 -1e+308) (/ y (/ z x)) (* t_1 x))))
double code(double x, double y, double z, double t) {
double t_1 = (y / z) + (t / (z + -1.0));
double tmp;
if (t_1 <= -1e+308) {
tmp = y / (z / x);
} else {
tmp = t_1 * 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) :: t_1
real(8) :: tmp
t_1 = (y / z) + (t / (z + (-1.0d0)))
if (t_1 <= (-1d+308)) then
tmp = y / (z / x)
else
tmp = t_1 * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y / z) + (t / (z + -1.0));
double tmp;
if (t_1 <= -1e+308) {
tmp = y / (z / x);
} else {
tmp = t_1 * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / z) + (t / (z + -1.0)) tmp = 0 if t_1 <= -1e+308: tmp = y / (z / x) else: tmp = t_1 * x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y / z) + Float64(t / Float64(z + -1.0))) tmp = 0.0 if (t_1 <= -1e+308) tmp = Float64(y / Float64(z / x)); else tmp = Float64(t_1 * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y / z) + (t / (z + -1.0)); tmp = 0.0; if (t_1 <= -1e+308) tmp = y / (z / x); else tmp = t_1 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / z), $MachinePrecision] + N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+308], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} + \frac{t}{z + -1}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+308}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot x\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -1e308Initial program 67.1%
Taylor expanded in y around inf 99.9%
associate-*r/67.1%
Simplified67.1%
clear-num67.1%
un-div-inv70.4%
Applied egg-rr70.4%
associate-/r/99.8%
Applied egg-rr99.8%
*-commutative99.8%
clear-num99.7%
un-div-inv99.9%
Applied egg-rr99.9%
if -1e308 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 97.8%
Final simplification98.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.0))) (* x (/ (+ y t) z)) (* 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 * ((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 <= (-1.0d0)) .or. (.not. (z <= 1.0d0))) 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 <= -1.0) || !(z <= 1.0)) {
tmp = x * ((y + t) / z);
} 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 * ((y + t) / z) 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(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 <= -1.0) || ~((z <= 1.0))) 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, -1.0], N[Not[LessEqual[z, 1.0]], $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 -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 98.3%
Taylor expanded in z around inf 88.7%
associate-/l*95.8%
neg-mul-195.8%
sub-neg95.8%
remove-double-neg95.8%
neg-mul-195.8%
neg-mul-195.8%
distribute-lft-in95.8%
neg-mul-195.8%
sub-neg95.8%
*-commutative95.8%
associate-*l/95.8%
*-commutative95.8%
associate-*r/95.8%
sub-neg95.8%
neg-mul-195.8%
distribute-lft-in95.8%
neg-mul-195.8%
remove-double-neg95.8%
neg-mul-195.8%
remove-double-neg95.8%
+-commutative95.8%
Simplified95.8%
if -1 < z < 1Initial program 92.0%
Taylor expanded in z around 0 91.5%
Final simplification93.6%
(FPCore (x y z t) :precision binary64 (if (<= x 1.1e-129) (/ (* y x) z) (/ x (/ z y))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.1e-129) {
tmp = (y * x) / z;
} else {
tmp = x / (z / y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 1.1d-129) then
tmp = (y * x) / z
else
tmp = x / (z / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.1e-129) {
tmp = (y * x) / z;
} else {
tmp = x / (z / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 1.1e-129: tmp = (y * x) / z else: tmp = x / (z / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 1.1e-129) tmp = Float64(Float64(y * 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 (x <= 1.1e-129) tmp = (y * x) / z; else tmp = x / (z / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 1.1e-129], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.1 \cdot 10^{-129}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\end{array}
\end{array}
if x < 1.10000000000000001e-129Initial program 92.9%
Taylor expanded in y around inf 65.0%
if 1.10000000000000001e-129 < x Initial program 98.7%
Taylor expanded in y around inf 61.8%
associate-*r/65.8%
Simplified65.8%
clear-num65.9%
un-div-inv66.3%
Applied egg-rr66.3%
Final simplification65.5%
(FPCore (x y z t) :precision binary64 (if (<= t 1.9e+59) (/ x (/ z y)) (/ y (/ z x))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.9e+59) {
tmp = x / (z / y);
} 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.9d+59) then
tmp = x / (z / y)
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.9e+59) {
tmp = x / (z / y);
} else {
tmp = y / (z / x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 1.9e+59: tmp = x / (z / y) else: tmp = y / (z / x) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 1.9e+59) tmp = Float64(x / Float64(z / y)); else tmp = Float64(y / Float64(z / x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 1.9e+59) tmp = x / (z / y); else tmp = y / (z / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.9e+59], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.9 \cdot 10^{+59}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\end{array}
\end{array}
if t < 1.9e59Initial program 94.9%
Taylor expanded in y around inf 73.5%
associate-*r/72.0%
Simplified72.0%
clear-num72.0%
un-div-inv72.6%
Applied egg-rr72.6%
if 1.9e59 < t Initial program 95.2%
Taylor expanded in y around inf 32.3%
associate-*r/29.5%
Simplified29.5%
clear-num29.5%
un-div-inv29.5%
Applied egg-rr29.5%
associate-/r/37.0%
Applied egg-rr37.0%
*-commutative37.0%
clear-num37.0%
un-div-inv37.1%
Applied egg-rr37.1%
(FPCore (x y z t) :precision binary64 (if (<= t 2.5e+63) (/ x (/ z y)) (* y (/ x z))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 2.5e+63) {
tmp = x / (z / y);
} 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 <= 2.5d+63) then
tmp = x / (z / y)
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 <= 2.5e+63) {
tmp = x / (z / y);
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 2.5e+63: tmp = x / (z / y) else: tmp = y * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 2.5e+63) tmp = Float64(x / Float64(z / y)); else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 2.5e+63) tmp = x / (z / y); else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 2.5e+63], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.5 \cdot 10^{+63}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if t < 2.50000000000000005e63Initial program 95.0%
Taylor expanded in y around inf 73.2%
associate-*r/71.8%
Simplified71.8%
clear-num71.8%
un-div-inv72.4%
Applied egg-rr72.4%
if 2.50000000000000005e63 < t Initial program 95.1%
Taylor expanded in y around inf 31.7%
associate-*r/28.7%
Simplified28.7%
clear-num28.7%
un-div-inv28.7%
Applied egg-rr28.7%
associate-/r/36.5%
Applied egg-rr36.5%
Final simplification64.3%
(FPCore (x y z t) :precision binary64 (if (<= t 2.3e+59) (* (/ y z) x) (* y (/ x z))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 2.3e+59) {
tmp = (y / z) * 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) :: tmp
if (t <= 2.3d+59) then
tmp = (y / z) * 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 tmp;
if (t <= 2.3e+59) {
tmp = (y / z) * x;
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 2.3e+59: tmp = (y / z) * x else: tmp = y * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 2.3e+59) tmp = Float64(Float64(y / z) * x); else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 2.3e+59) tmp = (y / z) * x; else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 2.3e+59], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.3 \cdot 10^{+59}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if t < 2.30000000000000008e59Initial program 94.9%
Taylor expanded in y around inf 73.5%
associate-*r/72.0%
Simplified72.0%
if 2.30000000000000008e59 < t Initial program 95.2%
Taylor expanded in y around inf 32.3%
associate-*r/29.5%
Simplified29.5%
clear-num29.5%
un-div-inv29.5%
Applied egg-rr29.5%
associate-/r/37.0%
Applied egg-rr37.0%
Final simplification63.8%
(FPCore (x y z t) :precision binary64 (* (/ y z) x))
double code(double x, double y, double z, double t) {
return (y / z) * 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 = (y / z) * x
end function
public static double code(double x, double y, double z, double t) {
return (y / z) * x;
}
def code(x, y, z, t): return (y / z) * x
function code(x, y, z, t) return Float64(Float64(y / z) * x) end
function tmp = code(x, y, z, t) tmp = (y / z) * x; end
code[x_, y_, z_, t_] := N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{z} \cdot x
\end{array}
Initial program 95.0%
Taylor expanded in y around inf 63.8%
associate-*r/62.0%
Simplified62.0%
Final simplification62.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z))))))
(t_2 (* x (- (/ y z) (/ t (- 1.0 z))))))
(if (< t_2 -7.623226303312042e-196)
t_1
(if (< t_2 1.4133944927702302e-211)
(+ (/ (* y x) z) (- (/ (* t x) (- 1.0 z))))
t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
double t_2 = x * ((y / z) - (t / (1.0 - z)));
double tmp;
if (t_2 < -7.623226303312042e-196) {
tmp = t_1;
} else if (t_2 < 1.4133944927702302e-211) {
tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x * ((y / z) - (t * (1.0d0 / (1.0d0 - z))))
t_2 = x * ((y / z) - (t / (1.0d0 - z)))
if (t_2 < (-7.623226303312042d-196)) then
tmp = t_1
else if (t_2 < 1.4133944927702302d-211) then
tmp = ((y * x) / z) + -((t * x) / (1.0d0 - z))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
double t_2 = x * ((y / z) - (t / (1.0 - z)));
double tmp;
if (t_2 < -7.623226303312042e-196) {
tmp = t_1;
} else if (t_2 < 1.4133944927702302e-211) {
tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z)))) t_2 = x * ((y / z) - (t / (1.0 - z))) tmp = 0 if t_2 < -7.623226303312042e-196: tmp = t_1 elif t_2 < 1.4133944927702302e-211: tmp = ((y * x) / z) + -((t * x) / (1.0 - z)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(y / z) - Float64(t * Float64(1.0 / Float64(1.0 - z))))) t_2 = Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) tmp = 0.0 if (t_2 < -7.623226303312042e-196) tmp = t_1; elseif (t_2 < 1.4133944927702302e-211) tmp = Float64(Float64(Float64(y * x) / z) + Float64(-Float64(Float64(t * x) / Float64(1.0 - z)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z)))); t_2 = x * ((y / z) - (t / (1.0 - z))); tmp = 0.0; if (t_2 < -7.623226303312042e-196) tmp = t_1; elseif (t_2 < 1.4133944927702302e-211) tmp = ((y * x) / z) + -((t * x) / (1.0 - z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t * N[(1.0 / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -7.623226303312042e-196], t$95$1, If[Less[t$95$2, 1.4133944927702302e-211], N[(N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision] + (-N[(N[(t * x), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1 - z}\right)\\
t_2 := x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\
\mathbf{if}\;t\_2 < -7.623226303312042 \cdot 10^{-196}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 < 1.4133944927702302 \cdot 10^{-211}:\\
\;\;\;\;\frac{y \cdot x}{z} + \left(-\frac{t \cdot x}{1 - z}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024111
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
:precision binary64
:alt
(if (< (* x (- (/ y z) (/ t (- 1.0 z)))) -7.623226303312042e-196) (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z))))) (if (< (* x (- (/ y z) (/ t (- 1.0 z)))) 1.4133944927702302e-211) (+ (/ (* y x) z) (- (/ (* t x) (- 1.0 z)))) (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z)))))))
(* x (- (/ y z) (/ t (- 1.0 z)))))