
(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * ((y / z) - (t / (1.0d0 - z)))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
def code(x, y, z, t): return x * ((y / z) - (t / (1.0 - z)))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) - (t / (1.0 - z))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * ((y / z) - (t / (1.0d0 - z)))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
def code(x, y, z, t): return x * ((y / z) - (t / (1.0 - z)))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) - (t / (1.0 - z))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\end{array}
(FPCore (x y z t) :precision binary64 (let* ((t_1 (+ (/ y z) (/ t (+ z -1.0))))) (if (<= t_1 -2e+307) (* y (/ x z)) (* 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 <= -2e+307) {
tmp = y * (x / z);
} 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 <= (-2d+307)) then
tmp = y * (x / z)
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 <= -2e+307) {
tmp = y * (x / z);
} 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 <= -2e+307: tmp = y * (x / z) 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 <= -2e+307) tmp = Float64(y * Float64(x / z)); 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 <= -2e+307) tmp = y * (x / z); 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, -2e+307], N[(y * N[(x / z), $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 -2 \cdot 10^{+307}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot x\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -1.99999999999999997e307Initial program 63.6%
Taylor expanded in y around inf 99.8%
associate-*r/63.6%
Simplified63.6%
*-commutative63.6%
associate-*l/99.8%
Applied egg-rr99.8%
associate-/l*99.9%
Applied egg-rr99.9%
if -1.99999999999999997e307 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 97.3%
Final simplification97.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6800000.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 <= -6800000.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 <= (-6800000.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 <= -6800000.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 <= -6800000.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 <= -6800000.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 <= -6800000.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, -6800000.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 -6800000 \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 < -6.8e6 or 1 < z Initial program 95.9%
Taylor expanded in z around inf 84.8%
associate-/l*95.9%
cancel-sign-sub-inv95.9%
metadata-eval95.9%
*-lft-identity95.9%
+-commutative95.9%
Simplified95.9%
if -6.8e6 < z < 1Initial program 94.0%
Taylor expanded in z around 0 92.6%
Final simplification94.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.52e-18) (not (<= t 4.4e-63))) (* x (/ t (+ z -1.0))) (* y (/ x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.52e-18) || !(t <= 4.4e-63)) {
tmp = x * (t / (z + -1.0));
} 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 <= (-1.52d-18)) .or. (.not. (t <= 4.4d-63))) then
tmp = x * (t / (z + (-1.0d0)))
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 <= -1.52e-18) || !(t <= 4.4e-63)) {
tmp = x * (t / (z + -1.0));
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.52e-18) or not (t <= 4.4e-63): tmp = x * (t / (z + -1.0)) else: tmp = y * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.52e-18) || !(t <= 4.4e-63)) tmp = Float64(x * Float64(t / Float64(z + -1.0))); else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.52e-18) || ~((t <= 4.4e-63))) tmp = x * (t / (z + -1.0)); else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.52e-18], N[Not[LessEqual[t, 4.4e-63]], $MachinePrecision]], N[(x * N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.52 \cdot 10^{-18} \lor \neg \left(t \leq 4.4 \cdot 10^{-63}\right):\\
\;\;\;\;x \cdot \frac{t}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if t < -1.52e-18 or 4.3999999999999999e-63 < t Initial program 96.9%
Taylor expanded in y around inf 84.6%
Taylor expanded in y around 0 72.3%
mul-1-neg72.3%
distribute-neg-frac272.3%
sub-neg72.3%
distribute-neg-in72.3%
metadata-eval72.3%
remove-double-neg72.3%
Simplified72.3%
if -1.52e-18 < t < 4.3999999999999999e-63Initial program 92.7%
Taylor expanded in y around inf 86.2%
associate-*r/88.2%
Simplified88.2%
*-commutative88.2%
associate-*l/86.2%
Applied egg-rr86.2%
associate-/l*89.5%
Applied egg-rr89.5%
Final simplification80.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -6.7e-18) (not (<= t 4.4e-63))) (* t (/ x (+ z -1.0))) (* y (/ x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -6.7e-18) || !(t <= 4.4e-63)) {
tmp = t * (x / (z + -1.0));
} 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 <= (-6.7d-18)) .or. (.not. (t <= 4.4d-63))) then
tmp = t * (x / (z + (-1.0d0)))
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 <= -6.7e-18) || !(t <= 4.4e-63)) {
tmp = t * (x / (z + -1.0));
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -6.7e-18) or not (t <= 4.4e-63): tmp = t * (x / (z + -1.0)) else: tmp = y * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -6.7e-18) || !(t <= 4.4e-63)) tmp = Float64(t * Float64(x / Float64(z + -1.0))); else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -6.7e-18) || ~((t <= 4.4e-63))) tmp = t * (x / (z + -1.0)); else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -6.7e-18], N[Not[LessEqual[t, 4.4e-63]], $MachinePrecision]], N[(t * N[(x / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.7 \cdot 10^{-18} \lor \neg \left(t \leq 4.4 \cdot 10^{-63}\right):\\
\;\;\;\;t \cdot \frac{x}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if t < -6.6999999999999998e-18 or 4.3999999999999999e-63 < t Initial program 96.9%
Taylor expanded in y around 0 63.9%
mul-1-neg63.9%
associate-/l*68.6%
distribute-rgt-neg-in68.6%
distribute-neg-frac268.6%
neg-sub068.6%
associate--r-68.6%
metadata-eval68.6%
Simplified68.6%
if -6.6999999999999998e-18 < t < 4.3999999999999999e-63Initial program 92.7%
Taylor expanded in y around inf 86.2%
associate-*r/88.2%
Simplified88.2%
*-commutative88.2%
associate-*l/86.2%
Applied egg-rr86.2%
associate-/l*89.5%
Applied egg-rr89.5%
Final simplification78.5%
(FPCore (x y z t) :precision binary64 (if (<= z -2.05e+18) (/ x (/ z t)) (if (<= z 2.25e+21) (* x (- (/ y z) t)) (* x (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.05e+18) {
tmp = x / (z / t);
} else if (z <= 2.25e+21) {
tmp = x * ((y / z) - t);
} 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 <= (-2.05d+18)) then
tmp = x / (z / t)
else if (z <= 2.25d+21) then
tmp = x * ((y / z) - t)
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 <= -2.05e+18) {
tmp = x / (z / t);
} else if (z <= 2.25e+21) {
tmp = x * ((y / z) - t);
} else {
tmp = x * (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.05e+18: tmp = x / (z / t) elif z <= 2.25e+21: tmp = x * ((y / z) - t) else: tmp = x * (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.05e+18) tmp = Float64(x / Float64(z / t)); elseif (z <= 2.25e+21) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(x * Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.05e+18) tmp = x / (z / t); elseif (z <= 2.25e+21) tmp = x * ((y / z) - t); else tmp = x * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.05e+18], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.25e+21], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.05 \cdot 10^{+18}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\mathbf{elif}\;z \leq 2.25 \cdot 10^{+21}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\end{array}
\end{array}
if z < -2.05e18Initial program 96.7%
clear-num96.6%
associate-/r/96.6%
Applied egg-rr96.6%
Taylor expanded in z around inf 88.3%
associate-/l*96.7%
sub-neg96.7%
mul-1-neg96.7%
remove-double-neg96.7%
Simplified96.7%
clear-num96.5%
un-div-inv96.7%
Applied egg-rr96.7%
Taylor expanded in y around 0 67.4%
if -2.05e18 < z < 2.25e21Initial program 94.0%
Taylor expanded in z around 0 92.6%
if 2.25e21 < z Initial program 95.0%
clear-num94.9%
associate-/r/94.9%
Applied egg-rr94.9%
Taylor expanded in z around inf 80.7%
associate-/l*95.0%
sub-neg95.0%
mul-1-neg95.0%
remove-double-neg95.0%
Simplified95.0%
Taylor expanded in y around 0 61.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -7.2e+65) (not (<= t 1.05e+141))) (* x (/ t z)) (* y (/ x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7.2e+65) || !(t <= 1.05e+141)) {
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 <= (-7.2d+65)) .or. (.not. (t <= 1.05d+141))) 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 <= -7.2e+65) || !(t <= 1.05e+141)) {
tmp = x * (t / z);
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -7.2e+65) or not (t <= 1.05e+141): tmp = x * (t / z) else: tmp = y * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -7.2e+65) || !(t <= 1.05e+141)) 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 <= -7.2e+65) || ~((t <= 1.05e+141))) tmp = x * (t / z); else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -7.2e+65], N[Not[LessEqual[t, 1.05e+141]], $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 -7.2 \cdot 10^{+65} \lor \neg \left(t \leq 1.05 \cdot 10^{+141}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if t < -7.19999999999999957e65 or 1.0499999999999999e141 < t Initial program 97.3%
clear-num97.3%
associate-/r/97.3%
Applied egg-rr97.3%
Taylor expanded in z around inf 54.1%
associate-/l*66.3%
sub-neg66.3%
mul-1-neg66.3%
remove-double-neg66.3%
Simplified66.3%
Taylor expanded in y around 0 57.3%
if -7.19999999999999957e65 < t < 1.0499999999999999e141Initial program 93.9%
Taylor expanded in y around inf 72.1%
associate-*r/74.6%
Simplified74.6%
*-commutative74.6%
associate-*l/72.1%
Applied egg-rr72.1%
associate-/l*75.5%
Applied egg-rr75.5%
Final simplification70.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -4.8e+65) (not (<= t 3.9e+43))) (* x (/ t z)) (* (/ y z) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.8e+65) || !(t <= 3.9e+43)) {
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 <= (-4.8d+65)) .or. (.not. (t <= 3.9d+43))) 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 <= -4.8e+65) || !(t <= 3.9e+43)) {
tmp = x * (t / z);
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -4.8e+65) or not (t <= 3.9e+43): tmp = x * (t / z) else: tmp = (y / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -4.8e+65) || !(t <= 3.9e+43)) 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 <= -4.8e+65) || ~((t <= 3.9e+43))) tmp = x * (t / z); else tmp = (y / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -4.8e+65], N[Not[LessEqual[t, 3.9e+43]], $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 -4.8 \cdot 10^{+65} \lor \neg \left(t \leq 3.9 \cdot 10^{+43}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if t < -4.8000000000000003e65 or 3.9000000000000001e43 < t Initial program 96.9%
clear-num96.9%
associate-/r/96.9%
Applied egg-rr96.9%
Taylor expanded in z around inf 57.7%
associate-/l*66.2%
sub-neg66.2%
mul-1-neg66.2%
remove-double-neg66.2%
Simplified66.2%
Taylor expanded in y around 0 54.3%
if -4.8000000000000003e65 < t < 3.9000000000000001e43Initial program 93.7%
Taylor expanded in y around inf 76.6%
associate-*r/79.4%
Simplified79.4%
Final simplification69.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6800000.0) (not (<= z 2.6e+20))) (* x (/ t z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6800000.0) || !(z <= 2.6e+20)) {
tmp = x * (t / z);
} else {
tmp = x * -t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-6800000.0d0)) .or. (.not. (z <= 2.6d+20))) then
tmp = x * (t / z)
else
tmp = x * -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6800000.0) || !(z <= 2.6e+20)) {
tmp = x * (t / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6800000.0) or not (z <= 2.6e+20): tmp = x * (t / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6800000.0) || !(z <= 2.6e+20)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(x * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -6800000.0) || ~((z <= 2.6e+20))) tmp = x * (t / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6800000.0], N[Not[LessEqual[z, 2.6e+20]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6800000 \lor \neg \left(z \leq 2.6 \cdot 10^{+20}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -6.8e6 or 2.6e20 < z Initial program 95.9%
clear-num95.8%
associate-/r/95.8%
Applied egg-rr95.8%
Taylor expanded in z around inf 84.7%
associate-/l*95.9%
sub-neg95.9%
mul-1-neg95.9%
remove-double-neg95.9%
Simplified95.9%
Taylor expanded in y around 0 64.6%
if -6.8e6 < z < 2.6e20Initial program 94.0%
Taylor expanded in z around 0 92.6%
Taylor expanded in y around 0 34.0%
associate-*r*34.0%
mul-1-neg34.0%
Simplified34.0%
Final simplification49.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6800000.0) (not (<= z 2.6e+20))) (* t (/ x z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6800000.0) || !(z <= 2.6e+20)) {
tmp = t * (x / z);
} else {
tmp = x * -t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-6800000.0d0)) .or. (.not. (z <= 2.6d+20))) then
tmp = t * (x / z)
else
tmp = x * -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6800000.0) || !(z <= 2.6e+20)) {
tmp = t * (x / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6800000.0) or not (z <= 2.6e+20): tmp = t * (x / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6800000.0) || !(z <= 2.6e+20)) tmp = Float64(t * Float64(x / z)); else tmp = Float64(x * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -6800000.0) || ~((z <= 2.6e+20))) tmp = t * (x / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6800000.0], N[Not[LessEqual[z, 2.6e+20]], $MachinePrecision]], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6800000 \lor \neg \left(z \leq 2.6 \cdot 10^{+20}\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -6.8e6 or 2.6e20 < z Initial program 95.9%
clear-num95.8%
associate-/r/95.8%
Applied egg-rr95.8%
Taylor expanded in z around inf 84.7%
associate-/l*95.9%
sub-neg95.9%
mul-1-neg95.9%
remove-double-neg95.9%
Simplified95.9%
Taylor expanded in y around 0 56.3%
associate-/l*61.4%
Simplified61.4%
if -6.8e6 < z < 2.6e20Initial program 94.0%
Taylor expanded in z around 0 92.6%
Taylor expanded in y around 0 34.0%
associate-*r*34.0%
mul-1-neg34.0%
Simplified34.0%
Final simplification47.4%
(FPCore (x y z t) :precision binary64 (if (<= t -3.7e+65) (* x (/ t z)) (if (<= t 6.8e+140) (* y (/ x z)) (/ x (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.7e+65) {
tmp = x * (t / z);
} else if (t <= 6.8e+140) {
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 <= (-3.7d+65)) then
tmp = x * (t / z)
else if (t <= 6.8d+140) 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 <= -3.7e+65) {
tmp = x * (t / z);
} else if (t <= 6.8e+140) {
tmp = y * (x / z);
} else {
tmp = x / (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -3.7e+65: tmp = x * (t / z) elif t <= 6.8e+140: tmp = y * (x / z) else: tmp = x / (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -3.7e+65) tmp = Float64(x * Float64(t / z)); elseif (t <= 6.8e+140) 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 <= -3.7e+65) tmp = x * (t / z); elseif (t <= 6.8e+140) tmp = y * (x / z); else tmp = x / (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -3.7e+65], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6.8e+140], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.7 \cdot 10^{+65}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{elif}\;t \leq 6.8 \cdot 10^{+140}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\end{array}
\end{array}
if t < -3.69999999999999995e65Initial program 98.0%
clear-num98.0%
associate-/r/98.1%
Applied egg-rr98.1%
Taylor expanded in z around inf 50.4%
associate-/l*64.6%
sub-neg64.6%
mul-1-neg64.6%
remove-double-neg64.6%
Simplified64.6%
Taylor expanded in y around 0 55.3%
if -3.69999999999999995e65 < t < 6.8e140Initial program 93.9%
Taylor expanded in y around inf 72.1%
associate-*r/74.6%
Simplified74.6%
*-commutative74.6%
associate-*l/72.1%
Applied egg-rr72.1%
associate-/l*75.5%
Applied egg-rr75.5%
if 6.8e140 < t Initial program 95.6%
clear-num95.6%
associate-/r/95.6%
Applied egg-rr95.6%
Taylor expanded in z around inf 62.6%
associate-/l*70.4%
sub-neg70.4%
mul-1-neg70.4%
remove-double-neg70.4%
Simplified70.4%
clear-num70.3%
un-div-inv70.6%
Applied egg-rr70.6%
Taylor expanded in y around 0 62.0%
(FPCore (x y z t) :precision binary64 (* x (- t)))
double code(double x, double y, double z, double t) {
return x * -t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * -t
end function
public static double code(double x, double y, double z, double t) {
return x * -t;
}
def code(x, y, z, t): return x * -t
function code(x, y, z, t) return Float64(x * Float64(-t)) end
function tmp = code(x, y, z, t) tmp = x * -t; end
code[x_, y_, z_, t_] := N[(x * (-t)), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(-t\right)
\end{array}
Initial program 94.9%
Taylor expanded in z around 0 64.4%
Taylor expanded in y around 0 25.0%
associate-*r*25.0%
mul-1-neg25.0%
Simplified25.0%
Final simplification25.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 2024180
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
:precision binary64
:alt
(! :herbie-platform default (if (< (* x (- (/ y z) (/ t (- 1 z)))) -3811613151656021/5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* x (- (/ y z) (* t (/ 1 (- 1 z))))) (if (< (* x (- (/ y z) (/ t (- 1 z)))) 7066972463851151/50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (/ (* y x) z) (- (/ (* t x) (- 1 z)))) (* x (- (/ y z) (* t (/ 1 (- 1 z))))))))
(* x (- (/ y z) (/ t (- 1.0 z)))))