
(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 (- 1.0 z))))) (if (<= t_1 (- INFINITY)) (/ (* y x) z) (* t_1 x))))
double code(double x, double y, double z, double t) {
double t_1 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (y * x) / z;
} else {
tmp = t_1 * x;
}
return tmp;
}
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 <= -Double.POSITIVE_INFINITY) {
tmp = (y * x) / z;
} else {
tmp = t_1 * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / z) - (t / (1.0 - z)) tmp = 0 if t_1 <= -math.inf: 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(1.0 - z))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(y * 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 / (1.0 - z)); tmp = 0.0; if (t_1 <= -Inf) 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[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision], N[(t$95$1 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} - \frac{t}{1 - z}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot x\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -inf.0Initial program 57.7%
Taylor expanded in y around inf 99.9%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) Initial program 97.5%
Final simplification97.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t z))))
(if (<= z -1.7e+225)
t_1
(if (<= z -1.45e+61)
(* (/ y z) x)
(if (or (<= z -6.6e+44) (not (<= z 2.3e+85)))
t_1
(* x (- (/ y z) t)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double tmp;
if (z <= -1.7e+225) {
tmp = t_1;
} else if (z <= -1.45e+61) {
tmp = (y / z) * x;
} else if ((z <= -6.6e+44) || !(z <= 2.3e+85)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = x * (t / z)
if (z <= (-1.7d+225)) then
tmp = t_1
else if (z <= (-1.45d+61)) then
tmp = (y / z) * x
else if ((z <= (-6.6d+44)) .or. (.not. (z <= 2.3d+85))) then
tmp = t_1
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 t_1 = x * (t / z);
double tmp;
if (z <= -1.7e+225) {
tmp = t_1;
} else if (z <= -1.45e+61) {
tmp = (y / z) * x;
} else if ((z <= -6.6e+44) || !(z <= 2.3e+85)) {
tmp = t_1;
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / z) tmp = 0 if z <= -1.7e+225: tmp = t_1 elif z <= -1.45e+61: tmp = (y / z) * x elif (z <= -6.6e+44) or not (z <= 2.3e+85): tmp = t_1 else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / z)) tmp = 0.0 if (z <= -1.7e+225) tmp = t_1; elseif (z <= -1.45e+61) tmp = Float64(Float64(y / z) * x); elseif ((z <= -6.6e+44) || !(z <= 2.3e+85)) tmp = t_1; else tmp = Float64(x * Float64(Float64(y / z) - t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / z); tmp = 0.0; if (z <= -1.7e+225) tmp = t_1; elseif (z <= -1.45e+61) tmp = (y / z) * x; elseif ((z <= -6.6e+44) || ~((z <= 2.3e+85))) tmp = t_1; else tmp = x * ((y / z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.7e+225], t$95$1, If[LessEqual[z, -1.45e+61], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], If[Or[LessEqual[z, -6.6e+44], N[Not[LessEqual[z, 2.3e+85]], $MachinePrecision]], t$95$1, N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
\mathbf{if}\;z \leq -1.7 \cdot 10^{+225}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.45 \cdot 10^{+61}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{elif}\;z \leq -6.6 \cdot 10^{+44} \lor \neg \left(z \leq 2.3 \cdot 10^{+85}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -1.70000000000000009e225 or -1.45e61 < z < -6.60000000000000027e44 or 2.2999999999999999e85 < z Initial program 95.7%
Taylor expanded in y around 0 66.3%
associate-*r/66.3%
mul-1-neg66.3%
*-commutative66.3%
distribute-rgt-neg-in66.3%
associate-*r/71.2%
neg-mul-171.2%
*-commutative71.2%
associate-*r/71.0%
metadata-eval71.0%
associate-/r*71.0%
neg-mul-171.0%
associate-*r/71.2%
*-rgt-identity71.2%
neg-sub071.2%
associate--r-71.2%
metadata-eval71.2%
Simplified71.2%
Taylor expanded in z around inf 71.2%
if -1.70000000000000009e225 < z < -1.45e61Initial program 96.6%
Taylor expanded in y around inf 52.3%
associate-*l/63.3%
Simplified63.3%
if -6.60000000000000027e44 < z < 2.2999999999999999e85Initial program 93.4%
Taylor expanded in z around 0 90.8%
associate-*l/85.2%
associate-*r*85.2%
neg-mul-185.2%
distribute-rgt-out87.7%
unsub-neg87.7%
Simplified87.7%
Final simplification80.3%
(FPCore (x y z t) :precision binary64 (if (<= z -1.8e-11) (/ x (/ z (+ y t))) (if (<= z 0.052) (* x (- (/ y z) (+ t (* z t)))) (* x (/ (+ y t) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.8e-11) {
tmp = x / (z / (y + t));
} else if (z <= 0.052) {
tmp = x * ((y / z) - (t + (z * t)));
} else {
tmp = x * ((y + t) / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.8d-11)) then
tmp = x / (z / (y + t))
else if (z <= 0.052d0) then
tmp = x * ((y / z) - (t + (z * t)))
else
tmp = x * ((y + t) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.8e-11) {
tmp = x / (z / (y + t));
} else if (z <= 0.052) {
tmp = x * ((y / z) - (t + (z * t)));
} else {
tmp = x * ((y + t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.8e-11: tmp = x / (z / (y + t)) elif z <= 0.052: tmp = x * ((y / z) - (t + (z * t))) else: tmp = x * ((y + t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.8e-11) tmp = Float64(x / Float64(z / Float64(y + t))); elseif (z <= 0.052) tmp = Float64(x * Float64(Float64(y / z) - Float64(t + Float64(z * t)))); else tmp = Float64(x * Float64(Float64(y + t) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.8e-11) tmp = x / (z / (y + t)); elseif (z <= 0.052) tmp = x * ((y / z) - (t + (z * t))); else tmp = x * ((y + t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.8e-11], N[(x / N[(z / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.052], N[(x * N[(N[(y / z), $MachinePrecision] - N[(t + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{-11}:\\
\;\;\;\;\frac{x}{\frac{z}{y + t}}\\
\mathbf{elif}\;z \leq 0.052:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - \left(t + z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\end{array}
\end{array}
if z < -1.79999999999999992e-11Initial program 97.1%
Taylor expanded in z around inf 87.3%
*-commutative87.3%
associate-/l*95.7%
neg-mul-195.7%
Simplified95.7%
Taylor expanded in z around 0 95.7%
if -1.79999999999999992e-11 < z < 0.0519999999999999976Initial program 92.0%
Taylor expanded in z around 0 91.7%
*-commutative91.7%
Simplified91.7%
if 0.0519999999999999976 < z Initial program 96.4%
Taylor expanded in z around inf 94.0%
cancel-sign-sub-inv94.0%
metadata-eval94.0%
*-lft-identity94.0%
Simplified94.0%
Final simplification93.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (- x))))
(if (<= t -2.3e+253)
t_1
(if (<= t -8.6e+23)
(* x (/ t z))
(if (<= t 1.45e+113) (* (/ y z) x) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = t * -x;
double tmp;
if (t <= -2.3e+253) {
tmp = t_1;
} else if (t <= -8.6e+23) {
tmp = x * (t / z);
} else if (t <= 1.45e+113) {
tmp = (y / z) * x;
} 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) :: tmp
t_1 = t * -x
if (t <= (-2.3d+253)) then
tmp = t_1
else if (t <= (-8.6d+23)) then
tmp = x * (t / z)
else if (t <= 1.45d+113) then
tmp = (y / z) * x
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 = t * -x;
double tmp;
if (t <= -2.3e+253) {
tmp = t_1;
} else if (t <= -8.6e+23) {
tmp = x * (t / z);
} else if (t <= 1.45e+113) {
tmp = (y / z) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * -x tmp = 0 if t <= -2.3e+253: tmp = t_1 elif t <= -8.6e+23: tmp = x * (t / z) elif t <= 1.45e+113: tmp = (y / z) * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(-x)) tmp = 0.0 if (t <= -2.3e+253) tmp = t_1; elseif (t <= -8.6e+23) tmp = Float64(x * Float64(t / z)); elseif (t <= 1.45e+113) tmp = Float64(Float64(y / z) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * -x; tmp = 0.0; if (t <= -2.3e+253) tmp = t_1; elseif (t <= -8.6e+23) tmp = x * (t / z); elseif (t <= 1.45e+113) tmp = (y / z) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * (-x)), $MachinePrecision]}, If[LessEqual[t, -2.3e+253], t$95$1, If[LessEqual[t, -8.6e+23], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.45e+113], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(-x\right)\\
\mathbf{if}\;t \leq -2.3 \cdot 10^{+253}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -8.6 \cdot 10^{+23}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{elif}\;t \leq 1.45 \cdot 10^{+113}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -2.3e253 or 1.44999999999999992e113 < t Initial program 95.6%
Taylor expanded in y around 0 84.6%
associate-*r/84.6%
mul-1-neg84.6%
*-commutative84.6%
distribute-rgt-neg-in84.6%
associate-*r/86.0%
neg-mul-186.0%
*-commutative86.0%
associate-*r/85.9%
metadata-eval85.9%
associate-/r*85.9%
neg-mul-185.9%
associate-*r/86.0%
*-rgt-identity86.0%
neg-sub086.0%
associate--r-86.0%
metadata-eval86.0%
Simplified86.0%
Taylor expanded in z around 0 58.2%
mul-1-neg58.2%
Simplified58.2%
if -2.3e253 < t < -8.5999999999999997e23Initial program 91.5%
Taylor expanded in y around 0 60.0%
associate-*r/60.0%
mul-1-neg60.0%
*-commutative60.0%
distribute-rgt-neg-in60.0%
associate-*r/70.5%
neg-mul-170.5%
*-commutative70.5%
associate-*r/70.4%
metadata-eval70.4%
associate-/r*70.4%
neg-mul-170.4%
associate-*r/70.5%
*-rgt-identity70.5%
neg-sub070.5%
associate--r-70.5%
metadata-eval70.5%
Simplified70.5%
Taylor expanded in z around inf 55.2%
if -8.5999999999999997e23 < t < 1.44999999999999992e113Initial program 94.7%
Taylor expanded in y around inf 78.6%
associate-*l/81.5%
Simplified81.5%
Final simplification70.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (- x))))
(if (<= t -6e+253)
t_1
(if (<= t -1.85e+24)
(/ x (/ z t))
(if (<= t 1.92e+118) (* (/ y z) x) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = t * -x;
double tmp;
if (t <= -6e+253) {
tmp = t_1;
} else if (t <= -1.85e+24) {
tmp = x / (z / t);
} else if (t <= 1.92e+118) {
tmp = (y / z) * x;
} 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) :: tmp
t_1 = t * -x
if (t <= (-6d+253)) then
tmp = t_1
else if (t <= (-1.85d+24)) then
tmp = x / (z / t)
else if (t <= 1.92d+118) then
tmp = (y / z) * x
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 = t * -x;
double tmp;
if (t <= -6e+253) {
tmp = t_1;
} else if (t <= -1.85e+24) {
tmp = x / (z / t);
} else if (t <= 1.92e+118) {
tmp = (y / z) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * -x tmp = 0 if t <= -6e+253: tmp = t_1 elif t <= -1.85e+24: tmp = x / (z / t) elif t <= 1.92e+118: tmp = (y / z) * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(-x)) tmp = 0.0 if (t <= -6e+253) tmp = t_1; elseif (t <= -1.85e+24) tmp = Float64(x / Float64(z / t)); elseif (t <= 1.92e+118) tmp = Float64(Float64(y / z) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * -x; tmp = 0.0; if (t <= -6e+253) tmp = t_1; elseif (t <= -1.85e+24) tmp = x / (z / t); elseif (t <= 1.92e+118) tmp = (y / z) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * (-x)), $MachinePrecision]}, If[LessEqual[t, -6e+253], t$95$1, If[LessEqual[t, -1.85e+24], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.92e+118], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(-x\right)\\
\mathbf{if}\;t \leq -6 \cdot 10^{+253}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -1.85 \cdot 10^{+24}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\mathbf{elif}\;t \leq 1.92 \cdot 10^{+118}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -5.9999999999999996e253 or 1.9199999999999999e118 < t Initial program 95.6%
Taylor expanded in y around 0 84.6%
associate-*r/84.6%
mul-1-neg84.6%
*-commutative84.6%
distribute-rgt-neg-in84.6%
associate-*r/86.0%
neg-mul-186.0%
*-commutative86.0%
associate-*r/85.9%
metadata-eval85.9%
associate-/r*85.9%
neg-mul-185.9%
associate-*r/86.0%
*-rgt-identity86.0%
neg-sub086.0%
associate--r-86.0%
metadata-eval86.0%
Simplified86.0%
Taylor expanded in z around 0 58.2%
mul-1-neg58.2%
Simplified58.2%
if -5.9999999999999996e253 < t < -1.85e24Initial program 91.5%
Taylor expanded in z around inf 58.2%
*-commutative58.2%
associate-/l*69.6%
neg-mul-169.6%
Simplified69.6%
Taylor expanded in y around 0 55.2%
if -1.85e24 < t < 1.9199999999999999e118Initial program 94.7%
Taylor expanded in y around inf 78.6%
associate-*l/81.5%
Simplified81.5%
Final simplification70.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (- x))))
(if (<= t -5.1e+253)
t_1
(if (<= t -1.85e+24)
(/ x (/ z t))
(if (<= t 6.5e+168) (/ y (/ z x)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = t * -x;
double tmp;
if (t <= -5.1e+253) {
tmp = t_1;
} else if (t <= -1.85e+24) {
tmp = x / (z / t);
} else if (t <= 6.5e+168) {
tmp = y / (z / x);
} 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) :: tmp
t_1 = t * -x
if (t <= (-5.1d+253)) then
tmp = t_1
else if (t <= (-1.85d+24)) then
tmp = x / (z / t)
else if (t <= 6.5d+168) then
tmp = y / (z / x)
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 = t * -x;
double tmp;
if (t <= -5.1e+253) {
tmp = t_1;
} else if (t <= -1.85e+24) {
tmp = x / (z / t);
} else if (t <= 6.5e+168) {
tmp = y / (z / x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * -x tmp = 0 if t <= -5.1e+253: tmp = t_1 elif t <= -1.85e+24: tmp = x / (z / t) elif t <= 6.5e+168: tmp = y / (z / x) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(-x)) tmp = 0.0 if (t <= -5.1e+253) tmp = t_1; elseif (t <= -1.85e+24) tmp = Float64(x / Float64(z / t)); elseif (t <= 6.5e+168) tmp = Float64(y / Float64(z / x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * -x; tmp = 0.0; if (t <= -5.1e+253) tmp = t_1; elseif (t <= -1.85e+24) tmp = x / (z / t); elseif (t <= 6.5e+168) tmp = y / (z / x); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * (-x)), $MachinePrecision]}, If[LessEqual[t, -5.1e+253], t$95$1, If[LessEqual[t, -1.85e+24], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6.5e+168], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(-x\right)\\
\mathbf{if}\;t \leq -5.1 \cdot 10^{+253}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -1.85 \cdot 10^{+24}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\mathbf{elif}\;t \leq 6.5 \cdot 10^{+168}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -5.09999999999999994e253 or 6.49999999999999999e168 < t Initial program 98.0%
Taylor expanded in y around 0 89.3%
associate-*r/89.3%
mul-1-neg89.3%
*-commutative89.3%
distribute-rgt-neg-in89.3%
associate-*r/91.3%
neg-mul-191.3%
*-commutative91.3%
associate-*r/91.3%
metadata-eval91.3%
associate-/r*91.3%
neg-mul-191.3%
associate-*r/91.3%
*-rgt-identity91.3%
neg-sub091.3%
associate--r-91.3%
metadata-eval91.3%
Simplified91.3%
Taylor expanded in z around 0 64.7%
mul-1-neg64.7%
Simplified64.7%
if -5.09999999999999994e253 < t < -1.85e24Initial program 91.5%
Taylor expanded in z around inf 58.2%
*-commutative58.2%
associate-/l*69.6%
neg-mul-169.6%
Simplified69.6%
Taylor expanded in y around 0 55.2%
if -1.85e24 < t < 6.49999999999999999e168Initial program 94.1%
clear-num93.6%
frac-sub78.7%
*-un-lft-identity78.7%
Applied egg-rr78.7%
Taylor expanded in z around 0 74.3%
associate-/l*77.4%
Simplified77.4%
Final simplification71.0%
(FPCore (x y z t) :precision binary64 (if (or (<= t -8.5e+23) (not (<= t 4.3e+109))) (* x (/ t (+ z -1.0))) (* (/ y z) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -8.5e+23) || !(t <= 4.3e+109)) {
tmp = x * (t / (z + -1.0));
} 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 <= (-8.5d+23)) .or. (.not. (t <= 4.3d+109))) then
tmp = x * (t / (z + (-1.0d0)))
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 <= -8.5e+23) || !(t <= 4.3e+109)) {
tmp = x * (t / (z + -1.0));
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -8.5e+23) or not (t <= 4.3e+109): tmp = x * (t / (z + -1.0)) else: tmp = (y / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -8.5e+23) || !(t <= 4.3e+109)) tmp = Float64(x * Float64(t / Float64(z + -1.0))); else tmp = Float64(Float64(y / z) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -8.5e+23) || ~((t <= 4.3e+109))) tmp = x * (t / (z + -1.0)); else tmp = (y / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -8.5e+23], N[Not[LessEqual[t, 4.3e+109]], $MachinePrecision]], N[(x * N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.5 \cdot 10^{+23} \lor \neg \left(t \leq 4.3 \cdot 10^{+109}\right):\\
\;\;\;\;x \cdot \frac{t}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if t < -8.5000000000000001e23 or 4.3000000000000001e109 < t Initial program 93.9%
Taylor expanded in y around 0 74.6%
associate-*r/74.6%
mul-1-neg74.6%
*-commutative74.6%
distribute-rgt-neg-in74.6%
associate-*r/79.7%
neg-mul-179.7%
*-commutative79.7%
associate-*r/79.6%
metadata-eval79.6%
associate-/r*79.6%
neg-mul-179.6%
associate-*r/79.7%
*-rgt-identity79.7%
neg-sub079.7%
associate--r-79.7%
metadata-eval79.7%
Simplified79.7%
if -8.5000000000000001e23 < t < 4.3000000000000001e109Initial program 94.7%
Taylor expanded in y around inf 78.6%
associate-*l/81.5%
Simplified81.5%
Final simplification80.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 0.052))) (* 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 <= 0.052)) {
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 <= 0.052d0))) 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 <= 0.052)) {
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 <= 0.052): 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 <= 0.052)) 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 <= 0.052))) 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, 0.052]], $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 0.052\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 0.0519999999999999976 < z Initial program 96.9%
Taylor expanded in z around inf 95.1%
cancel-sign-sub-inv95.1%
metadata-eval95.1%
*-lft-identity95.1%
Simplified95.1%
if -1 < z < 0.0519999999999999976Initial program 92.2%
Taylor expanded in z around 0 96.0%
associate-*l/89.3%
associate-*r*89.3%
neg-mul-189.3%
distribute-rgt-out91.6%
unsub-neg91.6%
Simplified91.6%
Final simplification93.2%
(FPCore (x y z t) :precision binary64 (if (<= z -1.8e-11) (/ x (/ z (+ y t))) (if (<= z 0.052) (* x (- (/ y z) t)) (* x (/ (+ y t) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.8e-11) {
tmp = x / (z / (y + t));
} else if (z <= 0.052) {
tmp = x * ((y / z) - t);
} else {
tmp = x * ((y + t) / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.8d-11)) then
tmp = x / (z / (y + t))
else if (z <= 0.052d0) then
tmp = x * ((y / z) - t)
else
tmp = x * ((y + t) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.8e-11) {
tmp = x / (z / (y + t));
} else if (z <= 0.052) {
tmp = x * ((y / z) - t);
} else {
tmp = x * ((y + t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.8e-11: tmp = x / (z / (y + t)) elif z <= 0.052: tmp = x * ((y / z) - t) else: tmp = x * ((y + t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.8e-11) tmp = Float64(x / Float64(z / Float64(y + t))); elseif (z <= 0.052) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(x * Float64(Float64(y + t) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.8e-11) tmp = x / (z / (y + t)); elseif (z <= 0.052) tmp = x * ((y / z) - t); else tmp = x * ((y + t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.8e-11], N[(x / N[(z / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.052], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{-11}:\\
\;\;\;\;\frac{x}{\frac{z}{y + t}}\\
\mathbf{elif}\;z \leq 0.052:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\end{array}
\end{array}
if z < -1.79999999999999992e-11Initial program 97.1%
Taylor expanded in z around inf 87.3%
*-commutative87.3%
associate-/l*95.7%
neg-mul-195.7%
Simplified95.7%
Taylor expanded in z around 0 95.7%
if -1.79999999999999992e-11 < z < 0.0519999999999999976Initial program 92.0%
Taylor expanded in z around 0 95.9%
associate-*l/89.1%
associate-*r*89.1%
neg-mul-189.1%
distribute-rgt-out91.4%
unsub-neg91.4%
Simplified91.4%
if 0.0519999999999999976 < z Initial program 96.4%
Taylor expanded in z around inf 94.0%
cancel-sign-sub-inv94.0%
metadata-eval94.0%
*-lft-identity94.0%
Simplified94.0%
Final simplification93.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.8e-11) (not (<= z 1.0))) (* x (/ t z)) (* t (- x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.8e-11) || !(z <= 1.0)) {
tmp = x * (t / z);
} else {
tmp = t * -x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.8d-11)) .or. (.not. (z <= 1.0d0))) then
tmp = x * (t / z)
else
tmp = t * -x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.8e-11) || !(z <= 1.0)) {
tmp = x * (t / z);
} else {
tmp = t * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.8e-11) or not (z <= 1.0): tmp = x * (t / z) else: tmp = t * -x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.8e-11) || !(z <= 1.0)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(t * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.8e-11) || ~((z <= 1.0))) tmp = x * (t / z); else tmp = t * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.8e-11], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(t * (-x)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{-11} \lor \neg \left(z \leq 1\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(-x\right)\\
\end{array}
\end{array}
if z < -1.79999999999999992e-11 or 1 < z Initial program 96.8%
Taylor expanded in y around 0 53.3%
associate-*r/53.3%
mul-1-neg53.3%
*-commutative53.3%
distribute-rgt-neg-in53.3%
associate-*r/56.3%
neg-mul-156.3%
*-commutative56.3%
associate-*r/56.2%
metadata-eval56.2%
associate-/r*56.2%
neg-mul-156.2%
associate-*r/56.3%
*-rgt-identity56.3%
neg-sub056.3%
associate--r-56.3%
metadata-eval56.3%
Simplified56.3%
Taylor expanded in z around inf 54.5%
if -1.79999999999999992e-11 < z < 1Initial program 92.2%
Taylor expanded in y around 0 42.0%
associate-*r/42.0%
mul-1-neg42.0%
*-commutative42.0%
distribute-rgt-neg-in42.0%
associate-*r/41.9%
neg-mul-141.9%
*-commutative41.9%
associate-*r/41.9%
metadata-eval41.9%
associate-/r*41.9%
neg-mul-141.9%
associate-*r/41.9%
*-rgt-identity41.9%
neg-sub041.9%
associate--r-41.9%
metadata-eval41.9%
Simplified41.9%
Taylor expanded in z around 0 41.3%
mul-1-neg41.3%
Simplified41.3%
Final simplification47.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.4%
Taylor expanded in y around 0 47.3%
associate-*r/47.3%
mul-1-neg47.3%
*-commutative47.3%
distribute-rgt-neg-in47.3%
associate-*r/48.8%
neg-mul-148.8%
*-commutative48.8%
associate-*r/48.7%
metadata-eval48.7%
associate-/r*48.7%
neg-mul-148.7%
associate-*r/48.8%
*-rgt-identity48.8%
neg-sub048.8%
associate--r-48.8%
metadata-eval48.8%
Simplified48.8%
Taylor expanded in z around 0 27.4%
mul-1-neg27.4%
Simplified27.4%
Final simplification27.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 2023192
(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)))))