
(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 (- INFINITY))
(/ y (/ z x))
(if (<= t_1 5e+279) (* 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 <= -((double) INFINITY)) {
tmp = y / (z / x);
} else if (t_1 <= 5e+279) {
tmp = t_1 * x;
} else {
tmp = (y * x) / z;
}
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 / (z / x);
} else if (t_1 <= 5e+279) {
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 <= -math.inf: tmp = y / (z / x) elif t_1 <= 5e+279: 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 <= Float64(-Inf)) tmp = Float64(y / Float64(z / x)); elseif (t_1 <= 5e+279) tmp = Float64(t_1 * x); else tmp = Float64(Float64(y * 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 <= -Inf) tmp = y / (z / x); elseif (t_1 <= 5e+279) 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, (-Infinity)], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+279], N[(t$95$1 * x), $MachinePrecision], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} - \frac{t}{1 - z}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+279}:\\
\;\;\;\;t_1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -inf.0Initial program 67.5%
Taylor expanded in y around inf 99.8%
associate-*r/67.5%
Simplified67.5%
*-commutative67.5%
associate-*l/99.8%
associate-*r/99.8%
clear-num99.9%
un-div-inv99.9%
Applied egg-rr99.9%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 5.0000000000000002e279Initial program 98.3%
if 5.0000000000000002e279 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) Initial program 76.1%
Taylor expanded in y around inf 99.9%
Final simplification98.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t z))) (t_2 (* x (- (/ y z) t))))
(if (<= z -1.8e+21)
t_1
(if (<= z -3e-278)
t_2
(if (<= z 1.75e-231)
(/ (* y x) z)
(if (<= z 78000.0)
t_2
(if (<= z 7.2e+63)
(* t (/ x z))
(if (<= z 2.6e+221) (/ x (/ z y)) t_1))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double t_2 = x * ((y / z) - t);
double tmp;
if (z <= -1.8e+21) {
tmp = t_1;
} else if (z <= -3e-278) {
tmp = t_2;
} else if (z <= 1.75e-231) {
tmp = (y * x) / z;
} else if (z <= 78000.0) {
tmp = t_2;
} else if (z <= 7.2e+63) {
tmp = t * (x / z);
} else if (z <= 2.6e+221) {
tmp = x / (z / y);
} 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 * (t / z)
t_2 = x * ((y / z) - t)
if (z <= (-1.8d+21)) then
tmp = t_1
else if (z <= (-3d-278)) then
tmp = t_2
else if (z <= 1.75d-231) then
tmp = (y * x) / z
else if (z <= 78000.0d0) then
tmp = t_2
else if (z <= 7.2d+63) then
tmp = t * (x / z)
else if (z <= 2.6d+221) then
tmp = x / (z / y)
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 * (t / z);
double t_2 = x * ((y / z) - t);
double tmp;
if (z <= -1.8e+21) {
tmp = t_1;
} else if (z <= -3e-278) {
tmp = t_2;
} else if (z <= 1.75e-231) {
tmp = (y * x) / z;
} else if (z <= 78000.0) {
tmp = t_2;
} else if (z <= 7.2e+63) {
tmp = t * (x / z);
} else if (z <= 2.6e+221) {
tmp = x / (z / y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / z) t_2 = x * ((y / z) - t) tmp = 0 if z <= -1.8e+21: tmp = t_1 elif z <= -3e-278: tmp = t_2 elif z <= 1.75e-231: tmp = (y * x) / z elif z <= 78000.0: tmp = t_2 elif z <= 7.2e+63: tmp = t * (x / z) elif z <= 2.6e+221: tmp = x / (z / y) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / z)) t_2 = Float64(x * Float64(Float64(y / z) - t)) tmp = 0.0 if (z <= -1.8e+21) tmp = t_1; elseif (z <= -3e-278) tmp = t_2; elseif (z <= 1.75e-231) tmp = Float64(Float64(y * x) / z); elseif (z <= 78000.0) tmp = t_2; elseif (z <= 7.2e+63) tmp = Float64(t * Float64(x / z)); elseif (z <= 2.6e+221) tmp = Float64(x / Float64(z / y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / z); t_2 = x * ((y / z) - t); tmp = 0.0; if (z <= -1.8e+21) tmp = t_1; elseif (z <= -3e-278) tmp = t_2; elseif (z <= 1.75e-231) tmp = (y * x) / z; elseif (z <= 78000.0) tmp = t_2; elseif (z <= 7.2e+63) tmp = t * (x / z); elseif (z <= 2.6e+221) tmp = x / (z / y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.8e+21], t$95$1, If[LessEqual[z, -3e-278], t$95$2, If[LessEqual[z, 1.75e-231], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 78000.0], t$95$2, If[LessEqual[z, 7.2e+63], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.6e+221], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
t_2 := x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{if}\;z \leq -1.8 \cdot 10^{+21}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -3 \cdot 10^{-278}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{-231}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\mathbf{elif}\;z \leq 78000:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{+63}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{+221}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -1.8e21 or 2.60000000000000004e221 < z Initial program 95.8%
Taylor expanded in z around inf 95.8%
cancel-sign-sub-inv95.8%
metadata-eval95.8%
*-lft-identity95.8%
+-commutative95.8%
Simplified95.8%
Taylor expanded in t around inf 68.6%
if -1.8e21 < z < -3e-278 or 1.7500000000000001e-231 < z < 78000Initial program 93.4%
Taylor expanded in z around 0 83.2%
+-commutative83.2%
associate-*r/81.4%
*-commutative81.4%
associate-*r*81.4%
neg-mul-181.4%
distribute-rgt-out91.2%
unsub-neg91.2%
Simplified91.2%
if -3e-278 < z < 1.7500000000000001e-231Initial program 76.2%
Taylor expanded in y around inf 92.7%
if 78000 < z < 7.19999999999999998e63Initial program 99.6%
Taylor expanded in z around inf 94.3%
cancel-sign-sub-inv94.3%
metadata-eval94.3%
*-lft-identity94.3%
+-commutative94.3%
Simplified94.3%
Taylor expanded in t around inf 68.9%
associate-*r/68.9%
Simplified68.9%
if 7.19999999999999998e63 < z < 2.60000000000000004e221Initial program 99.7%
Taylor expanded in y around inf 72.2%
associate-/l*79.0%
Simplified79.0%
Final simplification81.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- (/ y z) t))) (t_2 (* x (/ (+ y t) z))))
(if (<= z -2.1e-73)
t_2
(if (<= z -2.8e-278)
t_1
(if (<= z 1.6e-231) (/ (* y x) z) (if (<= z 0.216) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y / z) - t);
double t_2 = x * ((y + t) / z);
double tmp;
if (z <= -2.1e-73) {
tmp = t_2;
} else if (z <= -2.8e-278) {
tmp = t_1;
} else if (z <= 1.6e-231) {
tmp = (y * x) / z;
} else if (z <= 0.216) {
tmp = t_1;
} else {
tmp = t_2;
}
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)
t_2 = x * ((y + t) / z)
if (z <= (-2.1d-73)) then
tmp = t_2
else if (z <= (-2.8d-278)) then
tmp = t_1
else if (z <= 1.6d-231) then
tmp = (y * x) / z
else if (z <= 0.216d0) then
tmp = t_1
else
tmp = t_2
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);
double t_2 = x * ((y + t) / z);
double tmp;
if (z <= -2.1e-73) {
tmp = t_2;
} else if (z <= -2.8e-278) {
tmp = t_1;
} else if (z <= 1.6e-231) {
tmp = (y * x) / z;
} else if (z <= 0.216) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((y / z) - t) t_2 = x * ((y + t) / z) tmp = 0 if z <= -2.1e-73: tmp = t_2 elif z <= -2.8e-278: tmp = t_1 elif z <= 1.6e-231: tmp = (y * x) / z elif z <= 0.216: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(y / z) - t)) t_2 = Float64(x * Float64(Float64(y + t) / z)) tmp = 0.0 if (z <= -2.1e-73) tmp = t_2; elseif (z <= -2.8e-278) tmp = t_1; elseif (z <= 1.6e-231) tmp = Float64(Float64(y * x) / z); elseif (z <= 0.216) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((y / z) - t); t_2 = x * ((y + t) / z); tmp = 0.0; if (z <= -2.1e-73) tmp = t_2; elseif (z <= -2.8e-278) tmp = t_1; elseif (z <= 1.6e-231) tmp = (y * x) / z; elseif (z <= 0.216) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.1e-73], t$95$2, If[LessEqual[z, -2.8e-278], t$95$1, If[LessEqual[z, 1.6e-231], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 0.216], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\frac{y}{z} - t\right)\\
t_2 := x \cdot \frac{y + t}{z}\\
\mathbf{if}\;z \leq -2.1 \cdot 10^{-73}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -2.8 \cdot 10^{-278}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{-231}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\mathbf{elif}\;z \leq 0.216:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -2.0999999999999999e-73 or 0.215999999999999998 < z Initial program 97.0%
Taylor expanded in z around inf 95.9%
cancel-sign-sub-inv95.9%
metadata-eval95.9%
*-lft-identity95.9%
+-commutative95.9%
Simplified95.9%
if -2.0999999999999999e-73 < z < -2.80000000000000008e-278 or 1.60000000000000004e-231 < z < 0.215999999999999998Initial program 93.0%
Taylor expanded in z around 0 83.9%
+-commutative83.9%
associate-*r/81.7%
*-commutative81.7%
associate-*r*81.7%
neg-mul-181.7%
distribute-rgt-out91.4%
unsub-neg91.4%
Simplified91.4%
if -2.80000000000000008e-278 < z < 1.60000000000000004e-231Initial program 76.2%
Taylor expanded in y around inf 92.7%
Final simplification94.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t z))) (t_2 (* x (- t))))
(if (<= z -2.1e-73)
t_1
(if (<= z 3.2e-242)
t_2
(if (<= z 2.5e-210) (* t (/ x z)) (if (<= z 0.216) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double t_2 = x * -t;
double tmp;
if (z <= -2.1e-73) {
tmp = t_1;
} else if (z <= 3.2e-242) {
tmp = t_2;
} else if (z <= 2.5e-210) {
tmp = t * (x / z);
} else if (z <= 0.216) {
tmp = t_2;
} 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 * (t / z)
t_2 = x * -t
if (z <= (-2.1d-73)) then
tmp = t_1
else if (z <= 3.2d-242) then
tmp = t_2
else if (z <= 2.5d-210) then
tmp = t * (x / z)
else if (z <= 0.216d0) then
tmp = t_2
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 * (t / z);
double t_2 = x * -t;
double tmp;
if (z <= -2.1e-73) {
tmp = t_1;
} else if (z <= 3.2e-242) {
tmp = t_2;
} else if (z <= 2.5e-210) {
tmp = t * (x / z);
} else if (z <= 0.216) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / z) t_2 = x * -t tmp = 0 if z <= -2.1e-73: tmp = t_1 elif z <= 3.2e-242: tmp = t_2 elif z <= 2.5e-210: tmp = t * (x / z) elif z <= 0.216: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / z)) t_2 = Float64(x * Float64(-t)) tmp = 0.0 if (z <= -2.1e-73) tmp = t_1; elseif (z <= 3.2e-242) tmp = t_2; elseif (z <= 2.5e-210) tmp = Float64(t * Float64(x / z)); elseif (z <= 0.216) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / z); t_2 = x * -t; tmp = 0.0; if (z <= -2.1e-73) tmp = t_1; elseif (z <= 3.2e-242) tmp = t_2; elseif (z <= 2.5e-210) tmp = t * (x / z); elseif (z <= 0.216) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * (-t)), $MachinePrecision]}, If[LessEqual[z, -2.1e-73], t$95$1, If[LessEqual[z, 3.2e-242], t$95$2, If[LessEqual[z, 2.5e-210], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.216], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
t_2 := x \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -2.1 \cdot 10^{-73}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-242}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{-210}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 0.216:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -2.0999999999999999e-73 or 0.215999999999999998 < z Initial program 97.0%
Taylor expanded in z around inf 95.9%
cancel-sign-sub-inv95.9%
metadata-eval95.9%
*-lft-identity95.9%
+-commutative95.9%
Simplified95.9%
Taylor expanded in t around inf 59.1%
if -2.0999999999999999e-73 < z < 3.19999999999999999e-242 or 2.5000000000000001e-210 < z < 0.215999999999999998Initial program 88.2%
Taylor expanded in z around 0 87.1%
+-commutative87.1%
associate-*r/78.4%
*-commutative78.4%
associate-*r*78.4%
neg-mul-178.4%
distribute-rgt-out86.8%
unsub-neg86.8%
Simplified86.8%
Taylor expanded in y around 0 35.2%
mul-1-neg35.2%
distribute-lft-neg-out35.2%
*-commutative35.2%
Simplified35.2%
if 3.19999999999999999e-242 < z < 2.5000000000000001e-210Initial program 93.3%
Taylor expanded in z around inf 79.7%
cancel-sign-sub-inv79.7%
metadata-eval79.7%
*-lft-identity79.7%
+-commutative79.7%
Simplified79.7%
Taylor expanded in t around inf 24.1%
associate-*r/31.1%
Simplified31.1%
Final simplification48.7%
(FPCore (x y z t) :precision binary64 (if (<= y -4.8e+54) (* y (/ x z)) (if (<= y 2.55e+14) (* x (/ t (+ z -1.0))) (/ (* y x) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.8e+54) {
tmp = y * (x / z);
} else if (y <= 2.55e+14) {
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 (y <= (-4.8d+54)) then
tmp = y * (x / z)
else if (y <= 2.55d+14) 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 (y <= -4.8e+54) {
tmp = y * (x / z);
} else if (y <= 2.55e+14) {
tmp = x * (t / (z + -1.0));
} else {
tmp = (y * x) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -4.8e+54: tmp = y * (x / z) elif y <= 2.55e+14: tmp = x * (t / (z + -1.0)) else: tmp = (y * x) / z return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -4.8e+54) tmp = Float64(y * Float64(x / z)); elseif (y <= 2.55e+14) tmp = Float64(x * Float64(t / Float64(z + -1.0))); else tmp = Float64(Float64(y * x) / z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -4.8e+54) tmp = y * (x / z); elseif (y <= 2.55e+14) tmp = x * (t / (z + -1.0)); else tmp = (y * x) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -4.8e+54], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.55e+14], N[(x * N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{+54}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq 2.55 \cdot 10^{+14}:\\
\;\;\;\;x \cdot \frac{t}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\end{array}
\end{array}
if y < -4.79999999999999997e54Initial program 86.5%
Taylor expanded in y around inf 80.9%
associate-/l*77.4%
associate-/r/88.6%
Simplified88.6%
if -4.79999999999999997e54 < y < 2.55e14Initial program 97.5%
Taylor expanded in y around 0 72.1%
associate-*r/72.1%
mul-1-neg72.1%
*-commutative72.1%
distribute-rgt-neg-in72.1%
associate-*r/75.7%
neg-mul-175.7%
*-commutative75.7%
associate-*r/75.7%
metadata-eval75.7%
associate-/r*75.7%
neg-mul-175.7%
associate-*r/75.7%
*-rgt-identity75.7%
neg-sub075.7%
associate--r-75.7%
metadata-eval75.7%
Simplified75.7%
if 2.55e14 < y Initial program 91.3%
Taylor expanded in y around inf 86.7%
Final simplification81.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -7.8e-30) (not (<= y 2.5e+18))) (* (/ y z) x) (* x (/ t z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.8e-30) || !(y <= 2.5e+18)) {
tmp = (y / z) * x;
} 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 ((y <= (-7.8d-30)) .or. (.not. (y <= 2.5d+18))) then
tmp = (y / z) * x
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 ((y <= -7.8e-30) || !(y <= 2.5e+18)) {
tmp = (y / z) * x;
} else {
tmp = x * (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -7.8e-30) or not (y <= 2.5e+18): tmp = (y / z) * x else: tmp = x * (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -7.8e-30) || !(y <= 2.5e+18)) tmp = Float64(Float64(y / z) * x); else tmp = Float64(x * Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -7.8e-30) || ~((y <= 2.5e+18))) tmp = (y / z) * x; else tmp = x * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -7.8e-30], N[Not[LessEqual[y, 2.5e+18]], $MachinePrecision]], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.8 \cdot 10^{-30} \lor \neg \left(y \leq 2.5 \cdot 10^{+18}\right):\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\end{array}
\end{array}
if y < -7.8000000000000007e-30 or 2.5e18 < y Initial program 89.9%
Taylor expanded in y around inf 80.9%
associate-*r/77.6%
Simplified77.6%
if -7.8000000000000007e-30 < y < 2.5e18Initial program 97.3%
Taylor expanded in z around inf 72.7%
cancel-sign-sub-inv72.7%
metadata-eval72.7%
*-lft-identity72.7%
+-commutative72.7%
Simplified72.7%
Taylor expanded in t around inf 61.8%
Final simplification69.9%
(FPCore (x y z t) :precision binary64 (if (<= y -3.4e-29) (* y (/ x z)) (if (<= y 2.55e+14) (* x (/ t z)) (* (/ y z) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.4e-29) {
tmp = y * (x / z);
} else if (y <= 2.55e+14) {
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 (y <= (-3.4d-29)) then
tmp = y * (x / z)
else if (y <= 2.55d+14) 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 (y <= -3.4e-29) {
tmp = y * (x / z);
} else if (y <= 2.55e+14) {
tmp = x * (t / z);
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.4e-29: tmp = y * (x / z) elif y <= 2.55e+14: tmp = x * (t / z) else: tmp = (y / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.4e-29) tmp = Float64(y * Float64(x / z)); elseif (y <= 2.55e+14) 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 (y <= -3.4e-29) tmp = y * (x / z); elseif (y <= 2.55e+14) tmp = x * (t / z); else tmp = (y / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.4e-29], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.55e+14], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{-29}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq 2.55 \cdot 10^{+14}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if y < -3.39999999999999972e-29Initial program 88.6%
Taylor expanded in y around inf 75.1%
associate-/l*72.3%
associate-/r/81.6%
Simplified81.6%
if -3.39999999999999972e-29 < y < 2.55e14Initial program 97.3%
Taylor expanded in z around inf 72.7%
cancel-sign-sub-inv72.7%
metadata-eval72.7%
*-lft-identity72.7%
+-commutative72.7%
Simplified72.7%
Taylor expanded in t around inf 61.8%
if 2.55e14 < y Initial program 91.3%
Taylor expanded in y around inf 86.7%
associate-*r/82.9%
Simplified82.9%
Final simplification72.3%
(FPCore (x y z t) :precision binary64 (if (<= y -7.4e-30) (* y (/ x z)) (if (<= y 2.55e+14) (* x (/ t z)) (/ (* y x) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7.4e-30) {
tmp = y * (x / z);
} else if (y <= 2.55e+14) {
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 (y <= (-7.4d-30)) then
tmp = y * (x / z)
else if (y <= 2.55d+14) 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 (y <= -7.4e-30) {
tmp = y * (x / z);
} else if (y <= 2.55e+14) {
tmp = x * (t / z);
} else {
tmp = (y * x) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -7.4e-30: tmp = y * (x / z) elif y <= 2.55e+14: tmp = x * (t / z) else: tmp = (y * x) / z return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -7.4e-30) tmp = Float64(y * Float64(x / z)); elseif (y <= 2.55e+14) tmp = Float64(x * Float64(t / z)); else tmp = Float64(Float64(y * x) / z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -7.4e-30) tmp = y * (x / z); elseif (y <= 2.55e+14) tmp = x * (t / z); else tmp = (y * x) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -7.4e-30], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.55e+14], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.4 \cdot 10^{-30}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq 2.55 \cdot 10^{+14}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\end{array}
\end{array}
if y < -7.4000000000000006e-30Initial program 88.6%
Taylor expanded in y around inf 75.1%
associate-/l*72.3%
associate-/r/81.6%
Simplified81.6%
if -7.4000000000000006e-30 < y < 2.55e14Initial program 97.3%
Taylor expanded in z around inf 72.7%
cancel-sign-sub-inv72.7%
metadata-eval72.7%
*-lft-identity72.7%
+-commutative72.7%
Simplified72.7%
Taylor expanded in t around inf 61.8%
if 2.55e14 < y Initial program 91.3%
Taylor expanded in y around inf 86.7%
Final simplification73.2%
(FPCore (x y z t) :precision binary64 (* t (/ x z)))
double code(double x, double y, double z, double t) {
return t * (x / z);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t * (x / z)
end function
public static double code(double x, double y, double z, double t) {
return t * (x / z);
}
def code(x, y, z, t): return t * (x / z)
function code(x, y, z, t) return Float64(t * Float64(x / z)) end
function tmp = code(x, y, z, t) tmp = t * (x / z); end
code[x_, y_, z_, t_] := N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t \cdot \frac{x}{z}
\end{array}
Initial program 93.5%
Taylor expanded in z around inf 76.7%
cancel-sign-sub-inv76.7%
metadata-eval76.7%
*-lft-identity76.7%
+-commutative76.7%
Simplified76.7%
Taylor expanded in t around inf 39.6%
associate-*r/40.9%
Simplified40.9%
Final simplification40.9%
(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 93.5%
Taylor expanded in z around 0 59.0%
+-commutative59.0%
associate-*r/58.0%
*-commutative58.0%
associate-*r*58.0%
neg-mul-158.0%
distribute-rgt-out62.7%
unsub-neg62.7%
Simplified62.7%
Taylor expanded in y around 0 22.2%
mul-1-neg22.2%
distribute-lft-neg-out22.2%
*-commutative22.2%
Simplified22.2%
Final simplification22.2%
(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 2023332
(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)))))