
(FPCore (x y z t) :precision binary64 (+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))
double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * 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) + ((2.0d0 + ((z * 2.0d0) * (1.0d0 - t))) / (t * z))
end function
public static double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z));
}
def code(x, y, z, t): return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z))
function code(x, y, z, t) return Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(Float64(z * 2.0) * Float64(1.0 - t))) / Float64(t * z))) end
function tmp = code(x, y, z, t) tmp = (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z)); end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(N[(z * 2.0), $MachinePrecision] * N[(1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))
double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * 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) + ((2.0d0 + ((z * 2.0d0) * (1.0d0 - t))) / (t * z))
end function
public static double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z));
}
def code(x, y, z, t): return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z))
function code(x, y, z, t) return Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(Float64(z * 2.0) * Float64(1.0 - t))) / Float64(t * z))) end
function tmp = code(x, y, z, t) tmp = (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z)); end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(N[(z * 2.0), $MachinePrecision] * N[(1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}
\end{array}
(FPCore (x y z t) :precision binary64 (let* ((t_1 (+ (/ x y) (/ (+ 2.0 (* (* 2.0 z) (- 1.0 t))) (* z t))))) (if (<= t_1 INFINITY) t_1 (- (/ x y) 2.0))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) + ((2.0 + ((2.0 * z) * (1.0 - t))) / (z * t));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (x / y) + ((2.0 + ((2.0 * z) * (1.0 - t))) / (z * t));
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) + ((2.0 + ((2.0 * z) * (1.0 - t))) / (z * t)) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = (x / y) - 2.0 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(Float64(2.0 * z) * Float64(1.0 - t))) / Float64(z * t))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(Float64(x / y) - 2.0); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) + ((2.0 + ((2.0 * z) * (1.0 - t))) / (z * t)); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = (x / y) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(N[(2.0 * z), $MachinePrecision] * N[(1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} + \frac{2 + \left(2 \cdot z\right) \cdot \left(1 - t\right)}{z \cdot t}\\
\mathbf{if}\;t_1 \leq \infty:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - 2\\
\end{array}
\end{array}
if (+.f64 (/.f64 x y) (/.f64 (+.f64 2 (*.f64 (*.f64 z 2) (-.f64 1 t))) (*.f64 t z))) < +inf.0Initial program 99.8%
if +inf.0 < (+.f64 (/.f64 x y) (/.f64 (+.f64 2 (*.f64 (*.f64 z 2) (-.f64 1 t))) (*.f64 t z))) Initial program 0.0%
Taylor expanded in t around inf 100.0%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)) (t_2 (/ 2.0 (* z t))) (t_3 (+ -2.0 (/ 2.0 t))))
(if (<= z -3.5e+108)
t_3
(if (<= z -3.7e-89)
t_1
(if (<= z 6.1e-120)
t_2
(if (<= z 9e-40)
t_1
(if (<= z 1.65e-11)
t_2
(if (or (<= z 7.2e+213) (not (<= z 4.9e+291))) t_1 t_3))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double t_2 = 2.0 / (z * t);
double t_3 = -2.0 + (2.0 / t);
double tmp;
if (z <= -3.5e+108) {
tmp = t_3;
} else if (z <= -3.7e-89) {
tmp = t_1;
} else if (z <= 6.1e-120) {
tmp = t_2;
} else if (z <= 9e-40) {
tmp = t_1;
} else if (z <= 1.65e-11) {
tmp = t_2;
} else if ((z <= 7.2e+213) || !(z <= 4.9e+291)) {
tmp = t_1;
} else {
tmp = t_3;
}
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) :: t_3
real(8) :: tmp
t_1 = (x / y) - 2.0d0
t_2 = 2.0d0 / (z * t)
t_3 = (-2.0d0) + (2.0d0 / t)
if (z <= (-3.5d+108)) then
tmp = t_3
else if (z <= (-3.7d-89)) then
tmp = t_1
else if (z <= 6.1d-120) then
tmp = t_2
else if (z <= 9d-40) then
tmp = t_1
else if (z <= 1.65d-11) then
tmp = t_2
else if ((z <= 7.2d+213) .or. (.not. (z <= 4.9d+291))) then
tmp = t_1
else
tmp = t_3
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double t_2 = 2.0 / (z * t);
double t_3 = -2.0 + (2.0 / t);
double tmp;
if (z <= -3.5e+108) {
tmp = t_3;
} else if (z <= -3.7e-89) {
tmp = t_1;
} else if (z <= 6.1e-120) {
tmp = t_2;
} else if (z <= 9e-40) {
tmp = t_1;
} else if (z <= 1.65e-11) {
tmp = t_2;
} else if ((z <= 7.2e+213) || !(z <= 4.9e+291)) {
tmp = t_1;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) - 2.0 t_2 = 2.0 / (z * t) t_3 = -2.0 + (2.0 / t) tmp = 0 if z <= -3.5e+108: tmp = t_3 elif z <= -3.7e-89: tmp = t_1 elif z <= 6.1e-120: tmp = t_2 elif z <= 9e-40: tmp = t_1 elif z <= 1.65e-11: tmp = t_2 elif (z <= 7.2e+213) or not (z <= 4.9e+291): tmp = t_1 else: tmp = t_3 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) - 2.0) t_2 = Float64(2.0 / Float64(z * t)) t_3 = Float64(-2.0 + Float64(2.0 / t)) tmp = 0.0 if (z <= -3.5e+108) tmp = t_3; elseif (z <= -3.7e-89) tmp = t_1; elseif (z <= 6.1e-120) tmp = t_2; elseif (z <= 9e-40) tmp = t_1; elseif (z <= 1.65e-11) tmp = t_2; elseif ((z <= 7.2e+213) || !(z <= 4.9e+291)) tmp = t_1; else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) - 2.0; t_2 = 2.0 / (z * t); t_3 = -2.0 + (2.0 / t); tmp = 0.0; if (z <= -3.5e+108) tmp = t_3; elseif (z <= -3.7e-89) tmp = t_1; elseif (z <= 6.1e-120) tmp = t_2; elseif (z <= 9e-40) tmp = t_1; elseif (z <= 1.65e-11) tmp = t_2; elseif ((z <= 7.2e+213) || ~((z <= 4.9e+291))) tmp = t_1; else tmp = t_3; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.5e+108], t$95$3, If[LessEqual[z, -3.7e-89], t$95$1, If[LessEqual[z, 6.1e-120], t$95$2, If[LessEqual[z, 9e-40], t$95$1, If[LessEqual[z, 1.65e-11], t$95$2, If[Or[LessEqual[z, 7.2e+213], N[Not[LessEqual[z, 4.9e+291]], $MachinePrecision]], t$95$1, t$95$3]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
t_2 := \frac{2}{z \cdot t}\\
t_3 := -2 + \frac{2}{t}\\
\mathbf{if}\;z \leq -3.5 \cdot 10^{+108}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;z \leq -3.7 \cdot 10^{-89}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 6.1 \cdot 10^{-120}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 9 \cdot 10^{-40}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{-11}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{+213} \lor \neg \left(z \leq 4.9 \cdot 10^{+291}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\end{array}
if z < -3.5000000000000002e108 or 7.2000000000000002e213 < z < 4.90000000000000004e291Initial program 72.4%
Taylor expanded in z around inf 100.0%
div-sub100.0%
sub-neg100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 80.9%
sub-neg80.9%
metadata-eval80.9%
distribute-lft-in80.9%
associate-*r/80.9%
metadata-eval80.9%
metadata-eval80.9%
Simplified80.9%
if -3.5000000000000002e108 < z < -3.6999999999999997e-89 or 6.1e-120 < z < 9.0000000000000002e-40 or 1.6500000000000001e-11 < z < 7.2000000000000002e213 or 4.90000000000000004e291 < z Initial program 87.8%
Taylor expanded in t around inf 71.2%
if -3.6999999999999997e-89 < z < 6.1e-120 or 9.0000000000000002e-40 < z < 1.6500000000000001e-11Initial program 97.7%
Taylor expanded in t around 0 95.7%
Taylor expanded in z around 0 95.7%
associate-*r/95.7%
metadata-eval95.7%
associate-/r*95.8%
*-rgt-identity95.8%
associate-*r/95.6%
*-commutative95.6%
metadata-eval95.6%
associate-*r/95.6%
associate-*r*95.6%
associate-*l/95.6%
metadata-eval95.6%
distribute-rgt-in95.7%
associate-*l/95.8%
*-lft-identity95.8%
Simplified95.8%
Taylor expanded in z around 0 77.6%
Final simplification75.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)) (t_2 (/ (/ 2.0 t) z)) (t_3 (+ -2.0 (/ 2.0 t))))
(if (<= z -1.25e+108)
t_3
(if (<= z -2.15e-89)
t_1
(if (<= z 8.2e-119)
t_2
(if (<= z 9.2e-40)
t_1
(if (<= z 1.65e-11)
t_2
(if (or (<= z 1.02e+214) (not (<= z 4.5e+292))) t_1 t_3))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double t_2 = (2.0 / t) / z;
double t_3 = -2.0 + (2.0 / t);
double tmp;
if (z <= -1.25e+108) {
tmp = t_3;
} else if (z <= -2.15e-89) {
tmp = t_1;
} else if (z <= 8.2e-119) {
tmp = t_2;
} else if (z <= 9.2e-40) {
tmp = t_1;
} else if (z <= 1.65e-11) {
tmp = t_2;
} else if ((z <= 1.02e+214) || !(z <= 4.5e+292)) {
tmp = t_1;
} else {
tmp = t_3;
}
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) :: t_3
real(8) :: tmp
t_1 = (x / y) - 2.0d0
t_2 = (2.0d0 / t) / z
t_3 = (-2.0d0) + (2.0d0 / t)
if (z <= (-1.25d+108)) then
tmp = t_3
else if (z <= (-2.15d-89)) then
tmp = t_1
else if (z <= 8.2d-119) then
tmp = t_2
else if (z <= 9.2d-40) then
tmp = t_1
else if (z <= 1.65d-11) then
tmp = t_2
else if ((z <= 1.02d+214) .or. (.not. (z <= 4.5d+292))) then
tmp = t_1
else
tmp = t_3
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double t_2 = (2.0 / t) / z;
double t_3 = -2.0 + (2.0 / t);
double tmp;
if (z <= -1.25e+108) {
tmp = t_3;
} else if (z <= -2.15e-89) {
tmp = t_1;
} else if (z <= 8.2e-119) {
tmp = t_2;
} else if (z <= 9.2e-40) {
tmp = t_1;
} else if (z <= 1.65e-11) {
tmp = t_2;
} else if ((z <= 1.02e+214) || !(z <= 4.5e+292)) {
tmp = t_1;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) - 2.0 t_2 = (2.0 / t) / z t_3 = -2.0 + (2.0 / t) tmp = 0 if z <= -1.25e+108: tmp = t_3 elif z <= -2.15e-89: tmp = t_1 elif z <= 8.2e-119: tmp = t_2 elif z <= 9.2e-40: tmp = t_1 elif z <= 1.65e-11: tmp = t_2 elif (z <= 1.02e+214) or not (z <= 4.5e+292): tmp = t_1 else: tmp = t_3 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) - 2.0) t_2 = Float64(Float64(2.0 / t) / z) t_3 = Float64(-2.0 + Float64(2.0 / t)) tmp = 0.0 if (z <= -1.25e+108) tmp = t_3; elseif (z <= -2.15e-89) tmp = t_1; elseif (z <= 8.2e-119) tmp = t_2; elseif (z <= 9.2e-40) tmp = t_1; elseif (z <= 1.65e-11) tmp = t_2; elseif ((z <= 1.02e+214) || !(z <= 4.5e+292)) tmp = t_1; else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) - 2.0; t_2 = (2.0 / t) / z; t_3 = -2.0 + (2.0 / t); tmp = 0.0; if (z <= -1.25e+108) tmp = t_3; elseif (z <= -2.15e-89) tmp = t_1; elseif (z <= 8.2e-119) tmp = t_2; elseif (z <= 9.2e-40) tmp = t_1; elseif (z <= 1.65e-11) tmp = t_2; elseif ((z <= 1.02e+214) || ~((z <= 4.5e+292))) tmp = t_1; else tmp = t_3; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]}, Block[{t$95$3 = N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.25e+108], t$95$3, If[LessEqual[z, -2.15e-89], t$95$1, If[LessEqual[z, 8.2e-119], t$95$2, If[LessEqual[z, 9.2e-40], t$95$1, If[LessEqual[z, 1.65e-11], t$95$2, If[Or[LessEqual[z, 1.02e+214], N[Not[LessEqual[z, 4.5e+292]], $MachinePrecision]], t$95$1, t$95$3]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
t_2 := \frac{\frac{2}{t}}{z}\\
t_3 := -2 + \frac{2}{t}\\
\mathbf{if}\;z \leq -1.25 \cdot 10^{+108}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;z \leq -2.15 \cdot 10^{-89}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{-119}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{-40}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{-11}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 1.02 \cdot 10^{+214} \lor \neg \left(z \leq 4.5 \cdot 10^{+292}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\end{array}
if z < -1.24999999999999998e108 or 1.02e214 < z < 4.49999999999999984e292Initial program 72.4%
Taylor expanded in z around inf 100.0%
div-sub100.0%
sub-neg100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 80.9%
sub-neg80.9%
metadata-eval80.9%
distribute-lft-in80.9%
associate-*r/80.9%
metadata-eval80.9%
metadata-eval80.9%
Simplified80.9%
if -1.24999999999999998e108 < z < -2.14999999999999993e-89 or 8.20000000000000041e-119 < z < 9.2e-40 or 1.6500000000000001e-11 < z < 1.02e214 or 4.49999999999999984e292 < z Initial program 87.8%
Taylor expanded in t around inf 71.2%
if -2.14999999999999993e-89 < z < 8.20000000000000041e-119 or 9.2e-40 < z < 1.6500000000000001e-11Initial program 97.7%
Taylor expanded in t around 0 95.7%
Taylor expanded in z around 0 95.7%
associate-*r/95.7%
metadata-eval95.7%
associate-/r*95.8%
*-rgt-identity95.8%
associate-*r/95.6%
*-commutative95.6%
metadata-eval95.6%
associate-*r/95.6%
associate-*r*95.6%
associate-*l/95.6%
metadata-eval95.6%
distribute-rgt-in95.7%
associate-*l/95.8%
*-lft-identity95.8%
Simplified95.8%
Taylor expanded in z around 0 77.6%
associate-/r*77.7%
Simplified77.7%
Final simplification75.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ 2.0 (/ 2.0 z)) t))
(t_2 (+ (/ x y) (/ 2.0 t)))
(t_3 (- (/ x y) 2.0)))
(if (<= t -1.5e+19)
t_3
(if (<= t -5.4e-57)
t_1
(if (<= t -1.44e-157)
t_2
(if (<= t 1.3e-276)
t_1
(if (<= t 5.3e-96) t_2 (if (<= t 1.45e-16) t_1 t_3))))))))
double code(double x, double y, double z, double t) {
double t_1 = (2.0 + (2.0 / z)) / t;
double t_2 = (x / y) + (2.0 / t);
double t_3 = (x / y) - 2.0;
double tmp;
if (t <= -1.5e+19) {
tmp = t_3;
} else if (t <= -5.4e-57) {
tmp = t_1;
} else if (t <= -1.44e-157) {
tmp = t_2;
} else if (t <= 1.3e-276) {
tmp = t_1;
} else if (t <= 5.3e-96) {
tmp = t_2;
} else if (t <= 1.45e-16) {
tmp = t_1;
} else {
tmp = t_3;
}
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) :: t_3
real(8) :: tmp
t_1 = (2.0d0 + (2.0d0 / z)) / t
t_2 = (x / y) + (2.0d0 / t)
t_3 = (x / y) - 2.0d0
if (t <= (-1.5d+19)) then
tmp = t_3
else if (t <= (-5.4d-57)) then
tmp = t_1
else if (t <= (-1.44d-157)) then
tmp = t_2
else if (t <= 1.3d-276) then
tmp = t_1
else if (t <= 5.3d-96) then
tmp = t_2
else if (t <= 1.45d-16) then
tmp = t_1
else
tmp = t_3
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (2.0 + (2.0 / z)) / t;
double t_2 = (x / y) + (2.0 / t);
double t_3 = (x / y) - 2.0;
double tmp;
if (t <= -1.5e+19) {
tmp = t_3;
} else if (t <= -5.4e-57) {
tmp = t_1;
} else if (t <= -1.44e-157) {
tmp = t_2;
} else if (t <= 1.3e-276) {
tmp = t_1;
} else if (t <= 5.3e-96) {
tmp = t_2;
} else if (t <= 1.45e-16) {
tmp = t_1;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z, t): t_1 = (2.0 + (2.0 / z)) / t t_2 = (x / y) + (2.0 / t) t_3 = (x / y) - 2.0 tmp = 0 if t <= -1.5e+19: tmp = t_3 elif t <= -5.4e-57: tmp = t_1 elif t <= -1.44e-157: tmp = t_2 elif t <= 1.3e-276: tmp = t_1 elif t <= 5.3e-96: tmp = t_2 elif t <= 1.45e-16: tmp = t_1 else: tmp = t_3 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(2.0 + Float64(2.0 / z)) / t) t_2 = Float64(Float64(x / y) + Float64(2.0 / t)) t_3 = Float64(Float64(x / y) - 2.0) tmp = 0.0 if (t <= -1.5e+19) tmp = t_3; elseif (t <= -5.4e-57) tmp = t_1; elseif (t <= -1.44e-157) tmp = t_2; elseif (t <= 1.3e-276) tmp = t_1; elseif (t <= 5.3e-96) tmp = t_2; elseif (t <= 1.45e-16) tmp = t_1; else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (2.0 + (2.0 / z)) / t; t_2 = (x / y) + (2.0 / t); t_3 = (x / y) - 2.0; tmp = 0.0; if (t <= -1.5e+19) tmp = t_3; elseif (t <= -5.4e-57) tmp = t_1; elseif (t <= -1.44e-157) tmp = t_2; elseif (t <= 1.3e-276) tmp = t_1; elseif (t <= 5.3e-96) tmp = t_2; elseif (t <= 1.45e-16) tmp = t_1; else tmp = t_3; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / y), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[t, -1.5e+19], t$95$3, If[LessEqual[t, -5.4e-57], t$95$1, If[LessEqual[t, -1.44e-157], t$95$2, If[LessEqual[t, 1.3e-276], t$95$1, If[LessEqual[t, 5.3e-96], t$95$2, If[LessEqual[t, 1.45e-16], t$95$1, t$95$3]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{2 + \frac{2}{z}}{t}\\
t_2 := \frac{x}{y} + \frac{2}{t}\\
t_3 := \frac{x}{y} - 2\\
\mathbf{if}\;t \leq -1.5 \cdot 10^{+19}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;t \leq -5.4 \cdot 10^{-57}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -1.44 \cdot 10^{-157}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq 1.3 \cdot 10^{-276}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 5.3 \cdot 10^{-96}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq 1.45 \cdot 10^{-16}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\end{array}
if t < -1.5e19 or 1.4499999999999999e-16 < t Initial program 78.6%
Taylor expanded in t around inf 78.4%
if -1.5e19 < t < -5.4000000000000004e-57 or -1.43999999999999996e-157 < t < 1.29999999999999992e-276 or 5.3000000000000001e-96 < t < 1.4499999999999999e-16Initial program 99.7%
Taylor expanded in t around 0 91.0%
associate-*r/91.0%
metadata-eval91.0%
Simplified91.0%
if -5.4000000000000004e-57 < t < -1.43999999999999996e-157 or 1.29999999999999992e-276 < t < 5.3000000000000001e-96Initial program 96.1%
Taylor expanded in t around 0 96.1%
Taylor expanded in z around inf 80.9%
Final simplification82.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ -2.0 (/ (/ 2.0 t) z))) (t_2 (+ (/ x y) (+ -2.0 (/ 2.0 t)))))
(if (<= z -3.6e-89)
t_2
(if (<= z 7.9e-119)
t_1
(if (<= z 1.55e-43) (- (/ x y) 2.0) (if (<= z 8.5e-11) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = -2.0 + ((2.0 / t) / z);
double t_2 = (x / y) + (-2.0 + (2.0 / t));
double tmp;
if (z <= -3.6e-89) {
tmp = t_2;
} else if (z <= 7.9e-119) {
tmp = t_1;
} else if (z <= 1.55e-43) {
tmp = (x / y) - 2.0;
} else if (z <= 8.5e-11) {
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 = (-2.0d0) + ((2.0d0 / t) / z)
t_2 = (x / y) + ((-2.0d0) + (2.0d0 / t))
if (z <= (-3.6d-89)) then
tmp = t_2
else if (z <= 7.9d-119) then
tmp = t_1
else if (z <= 1.55d-43) then
tmp = (x / y) - 2.0d0
else if (z <= 8.5d-11) 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 = -2.0 + ((2.0 / t) / z);
double t_2 = (x / y) + (-2.0 + (2.0 / t));
double tmp;
if (z <= -3.6e-89) {
tmp = t_2;
} else if (z <= 7.9e-119) {
tmp = t_1;
} else if (z <= 1.55e-43) {
tmp = (x / y) - 2.0;
} else if (z <= 8.5e-11) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = -2.0 + ((2.0 / t) / z) t_2 = (x / y) + (-2.0 + (2.0 / t)) tmp = 0 if z <= -3.6e-89: tmp = t_2 elif z <= 7.9e-119: tmp = t_1 elif z <= 1.55e-43: tmp = (x / y) - 2.0 elif z <= 8.5e-11: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(-2.0 + Float64(Float64(2.0 / t) / z)) t_2 = Float64(Float64(x / y) + Float64(-2.0 + Float64(2.0 / t))) tmp = 0.0 if (z <= -3.6e-89) tmp = t_2; elseif (z <= 7.9e-119) tmp = t_1; elseif (z <= 1.55e-43) tmp = Float64(Float64(x / y) - 2.0); elseif (z <= 8.5e-11) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -2.0 + ((2.0 / t) / z); t_2 = (x / y) + (-2.0 + (2.0 / t)); tmp = 0.0; if (z <= -3.6e-89) tmp = t_2; elseif (z <= 7.9e-119) tmp = t_1; elseif (z <= 1.55e-43) tmp = (x / y) - 2.0; elseif (z <= 8.5e-11) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(-2.0 + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / y), $MachinePrecision] + N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.6e-89], t$95$2, If[LessEqual[z, 7.9e-119], t$95$1, If[LessEqual[z, 1.55e-43], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], If[LessEqual[z, 8.5e-11], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -2 + \frac{\frac{2}{t}}{z}\\
t_2 := \frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\
\mathbf{if}\;z \leq -3.6 \cdot 10^{-89}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 7.9 \cdot 10^{-119}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{-43}:\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-11}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -3.60000000000000007e-89 or 8.50000000000000037e-11 < z Initial program 81.5%
Taylor expanded in z around inf 94.6%
div-sub94.6%
sub-neg94.6%
*-inverses94.6%
metadata-eval94.6%
Simplified94.6%
Taylor expanded in x around 0 94.6%
+-commutative94.6%
sub-neg94.6%
metadata-eval94.6%
distribute-lft-in94.6%
associate-*r/94.6%
metadata-eval94.6%
metadata-eval94.6%
Simplified94.6%
if -3.60000000000000007e-89 < z < 7.9e-119 or 1.55e-43 < z < 8.50000000000000037e-11Initial program 97.7%
Taylor expanded in t around inf 97.5%
*-commutative97.5%
associate-*l*97.5%
Simplified97.5%
Taylor expanded in t around 0 97.5%
sub-neg97.5%
associate-*r/97.5%
metadata-eval97.5%
metadata-eval97.5%
Simplified97.5%
Taylor expanded in x around 0 80.0%
sub-neg80.0%
associate-*r/80.0%
metadata-eval80.0%
associate-/r*80.1%
metadata-eval80.1%
+-commutative80.1%
Simplified80.1%
if 7.9e-119 < z < 1.55e-43Initial program 99.7%
Taylor expanded in t around inf 82.0%
Final simplification88.5%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -4e+100) (not (<= (/ x y) 3.1e+46))) (+ (/ x y) (/ 2.0 t)) (+ -2.0 (/ (/ 2.0 t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -4e+100) || !((x / y) <= 3.1e+46)) {
tmp = (x / y) + (2.0 / t);
} else {
tmp = -2.0 + ((2.0 / 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 (((x / y) <= (-4d+100)) .or. (.not. ((x / y) <= 3.1d+46))) then
tmp = (x / y) + (2.0d0 / t)
else
tmp = (-2.0d0) + ((2.0d0 / t) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -4e+100) || !((x / y) <= 3.1e+46)) {
tmp = (x / y) + (2.0 / t);
} else {
tmp = -2.0 + ((2.0 / t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -4e+100) or not ((x / y) <= 3.1e+46): tmp = (x / y) + (2.0 / t) else: tmp = -2.0 + ((2.0 / t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -4e+100) || !(Float64(x / y) <= 3.1e+46)) tmp = Float64(Float64(x / y) + Float64(2.0 / t)); else tmp = Float64(-2.0 + Float64(Float64(2.0 / t) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -4e+100) || ~(((x / y) <= 3.1e+46))) tmp = (x / y) + (2.0 / t); else tmp = -2.0 + ((2.0 / t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -4e+100], N[Not[LessEqual[N[(x / y), $MachinePrecision], 3.1e+46]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision], N[(-2.0 + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -4 \cdot 10^{+100} \lor \neg \left(\frac{x}{y} \leq 3.1 \cdot 10^{+46}\right):\\
\;\;\;\;\frac{x}{y} + \frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{\frac{2}{t}}{z}\\
\end{array}
\end{array}
if (/.f64 x y) < -4.00000000000000006e100 or 3.09999999999999975e46 < (/.f64 x y) Initial program 92.5%
Taylor expanded in t around 0 98.1%
Taylor expanded in z around inf 82.5%
if -4.00000000000000006e100 < (/.f64 x y) < 3.09999999999999975e46Initial program 85.6%
Taylor expanded in t around inf 61.1%
*-commutative61.1%
associate-*l*61.1%
Simplified61.1%
Taylor expanded in t around 0 75.2%
sub-neg75.2%
associate-*r/75.2%
metadata-eval75.2%
metadata-eval75.2%
Simplified75.2%
Taylor expanded in x around 0 71.4%
sub-neg71.4%
associate-*r/71.4%
metadata-eval71.4%
associate-/r*71.4%
metadata-eval71.4%
+-commutative71.4%
Simplified71.4%
Final simplification76.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.0))) (+ (/ x y) (+ -2.0 (/ 2.0 t))) (+ (/ x y) (+ (/ 2.0 (* z t)) -2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else {
tmp = (x / y) + ((2.0 / (z * t)) + -2.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.0d0)) .or. (.not. (z <= 1.0d0))) then
tmp = (x / y) + ((-2.0d0) + (2.0d0 / t))
else
tmp = (x / y) + ((2.0d0 / (z * t)) + (-2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else {
tmp = (x / y) + ((2.0 / (z * t)) + -2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.0) or not (z <= 1.0): tmp = (x / y) + (-2.0 + (2.0 / t)) else: tmp = (x / y) + ((2.0 / (z * t)) + -2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.0) || !(z <= 1.0)) tmp = Float64(Float64(x / y) + Float64(-2.0 + Float64(2.0 / t))); else tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / Float64(z * t)) + -2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.0) || ~((z <= 1.0))) tmp = (x / y) + (-2.0 + (2.0 / t)); else tmp = (x / y) + ((2.0 / (z * t)) + -2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \left(\frac{2}{z \cdot t} + -2\right)\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 77.5%
Taylor expanded in z around inf 99.3%
div-sub99.3%
sub-neg99.3%
*-inverses99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in x around 0 99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
distribute-lft-in99.3%
associate-*r/99.3%
metadata-eval99.3%
metadata-eval99.3%
Simplified99.3%
if -1 < z < 1Initial program 98.3%
Taylor expanded in t around inf 97.1%
*-commutative97.1%
associate-*l*97.1%
Simplified97.1%
Taylor expanded in t around 0 97.1%
sub-neg97.1%
associate-*r/97.1%
metadata-eval97.1%
metadata-eval97.1%
Simplified97.1%
Final simplification98.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -0.86) (not (<= t 8.5e-30))) (+ (/ x y) (+ (/ 2.0 (* z t)) -2.0)) (+ (/ x y) (/ (+ 2.0 (/ 2.0 z)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -0.86) || !(t <= 8.5e-30)) {
tmp = (x / y) + ((2.0 / (z * t)) + -2.0);
} else {
tmp = (x / y) + ((2.0 + (2.0 / 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 <= (-0.86d0)) .or. (.not. (t <= 8.5d-30))) then
tmp = (x / y) + ((2.0d0 / (z * t)) + (-2.0d0))
else
tmp = (x / y) + ((2.0d0 + (2.0d0 / z)) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -0.86) || !(t <= 8.5e-30)) {
tmp = (x / y) + ((2.0 / (z * t)) + -2.0);
} else {
tmp = (x / y) + ((2.0 + (2.0 / z)) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -0.86) or not (t <= 8.5e-30): tmp = (x / y) + ((2.0 / (z * t)) + -2.0) else: tmp = (x / y) + ((2.0 + (2.0 / z)) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -0.86) || !(t <= 8.5e-30)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / Float64(z * t)) + -2.0)); else tmp = Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(2.0 / z)) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -0.86) || ~((t <= 8.5e-30))) tmp = (x / y) + ((2.0 / (z * t)) + -2.0); else tmp = (x / y) + ((2.0 + (2.0 / z)) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -0.86], N[Not[LessEqual[t, 8.5e-30]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.86 \lor \neg \left(t \leq 8.5 \cdot 10^{-30}\right):\\
\;\;\;\;\frac{x}{y} + \left(\frac{2}{z \cdot t} + -2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if t < -0.859999999999999987 or 8.49999999999999931e-30 < t Initial program 79.7%
Taylor expanded in t around inf 78.4%
*-commutative78.4%
associate-*l*78.4%
Simplified78.4%
Taylor expanded in t around 0 98.5%
sub-neg98.5%
associate-*r/98.5%
metadata-eval98.5%
metadata-eval98.5%
Simplified98.5%
if -0.859999999999999987 < t < 8.49999999999999931e-30Initial program 98.1%
Taylor expanded in t around 0 98.1%
Taylor expanded in z around 0 98.2%
associate-*r/98.2%
metadata-eval98.2%
associate-/r*98.2%
*-rgt-identity98.2%
associate-*r/98.2%
*-commutative98.2%
metadata-eval98.2%
associate-*r/98.2%
associate-*r*98.2%
associate-*l/98.2%
metadata-eval98.2%
distribute-rgt-in98.2%
associate-*l/98.3%
*-lft-identity98.3%
Simplified98.3%
Final simplification98.4%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -1.85e+100) (/ x y) (if (<= (/ x y) 1.56e+47) (+ -2.0 (/ (/ 2.0 t) z)) (- (/ x y) 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -1.85e+100) {
tmp = x / y;
} else if ((x / y) <= 1.56e+47) {
tmp = -2.0 + ((2.0 / t) / z);
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x / y) <= (-1.85d+100)) then
tmp = x / y
else if ((x / y) <= 1.56d+47) then
tmp = (-2.0d0) + ((2.0d0 / t) / z)
else
tmp = (x / y) - 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -1.85e+100) {
tmp = x / y;
} else if ((x / y) <= 1.56e+47) {
tmp = -2.0 + ((2.0 / t) / z);
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -1.85e+100: tmp = x / y elif (x / y) <= 1.56e+47: tmp = -2.0 + ((2.0 / t) / z) else: tmp = (x / y) - 2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -1.85e+100) tmp = Float64(x / y); elseif (Float64(x / y) <= 1.56e+47) tmp = Float64(-2.0 + Float64(Float64(2.0 / t) / z)); else tmp = Float64(Float64(x / y) - 2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -1.85e+100) tmp = x / y; elseif ((x / y) <= 1.56e+47) tmp = -2.0 + ((2.0 / t) / z); else tmp = (x / y) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -1.85e+100], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1.56e+47], N[(-2.0 + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1.85 \cdot 10^{+100}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 1.56 \cdot 10^{+47}:\\
\;\;\;\;-2 + \frac{\frac{2}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - 2\\
\end{array}
\end{array}
if (/.f64 x y) < -1.8500000000000001e100Initial program 90.2%
Taylor expanded in x around inf 74.2%
if -1.8500000000000001e100 < (/.f64 x y) < 1.55999999999999998e47Initial program 85.6%
Taylor expanded in t around inf 61.1%
*-commutative61.1%
associate-*l*61.1%
Simplified61.1%
Taylor expanded in t around 0 75.2%
sub-neg75.2%
associate-*r/75.2%
metadata-eval75.2%
metadata-eval75.2%
Simplified75.2%
Taylor expanded in x around 0 71.4%
sub-neg71.4%
associate-*r/71.4%
metadata-eval71.4%
associate-/r*71.4%
metadata-eval71.4%
+-commutative71.4%
Simplified71.4%
if 1.55999999999999998e47 < (/.f64 x y) Initial program 94.6%
Taylor expanded in t around inf 75.1%
Final simplification72.8%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -5.5e+34) (not (<= (/ x y) 1300000.0))) (/ x y) (+ -2.0 (/ 2.0 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5.5e+34) || !((x / y) <= 1300000.0)) {
tmp = x / y;
} else {
tmp = -2.0 + (2.0 / 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 (((x / y) <= (-5.5d+34)) .or. (.not. ((x / y) <= 1300000.0d0))) then
tmp = x / y
else
tmp = (-2.0d0) + (2.0d0 / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5.5e+34) || !((x / y) <= 1300000.0)) {
tmp = x / y;
} else {
tmp = -2.0 + (2.0 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -5.5e+34) or not ((x / y) <= 1300000.0): tmp = x / y else: tmp = -2.0 + (2.0 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -5.5e+34) || !(Float64(x / y) <= 1300000.0)) tmp = Float64(x / y); else tmp = Float64(-2.0 + Float64(2.0 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -5.5e+34) || ~(((x / y) <= 1300000.0))) tmp = x / y; else tmp = -2.0 + (2.0 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -5.5e+34], N[Not[LessEqual[N[(x / y), $MachinePrecision], 1300000.0]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5.5 \cdot 10^{+34} \lor \neg \left(\frac{x}{y} \leq 1300000\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -5.4999999999999996e34 or 1.3e6 < (/.f64 x y) Initial program 91.1%
Taylor expanded in x around inf 67.3%
if -5.4999999999999996e34 < (/.f64 x y) < 1.3e6Initial program 85.9%
Taylor expanded in z around inf 59.0%
div-sub59.0%
sub-neg59.0%
*-inverses59.0%
metadata-eval59.0%
Simplified59.0%
Taylor expanded in x around 0 58.7%
sub-neg58.7%
metadata-eval58.7%
distribute-lft-in58.7%
associate-*r/58.7%
metadata-eval58.7%
metadata-eval58.7%
Simplified58.7%
Final simplification62.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -0.115) (not (<= z 2e-5))) (+ (/ x y) (+ -2.0 (/ 2.0 t))) (+ (/ x y) (/ 2.0 (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.115) || !(z <= 2e-5)) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else {
tmp = (x / y) + (2.0 / (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 <= (-0.115d0)) .or. (.not. (z <= 2d-5))) then
tmp = (x / y) + ((-2.0d0) + (2.0d0 / t))
else
tmp = (x / y) + (2.0d0 / (z * t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.115) || !(z <= 2e-5)) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else {
tmp = (x / y) + (2.0 / (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -0.115) or not (z <= 2e-5): tmp = (x / y) + (-2.0 + (2.0 / t)) else: tmp = (x / y) + (2.0 / (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -0.115) || !(z <= 2e-5)) tmp = Float64(Float64(x / y) + Float64(-2.0 + Float64(2.0 / t))); else tmp = Float64(Float64(x / y) + Float64(2.0 / Float64(z * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -0.115) || ~((z <= 2e-5))) tmp = (x / y) + (-2.0 + (2.0 / t)); else tmp = (x / y) + (2.0 / (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -0.115], N[Not[LessEqual[z, 2e-5]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.115 \lor \neg \left(z \leq 2 \cdot 10^{-5}\right):\\
\;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{2}{z \cdot t}\\
\end{array}
\end{array}
if z < -0.115000000000000005 or 2.00000000000000016e-5 < z Initial program 77.5%
Taylor expanded in z around inf 99.3%
div-sub99.3%
sub-neg99.3%
*-inverses99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in x around 0 99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
distribute-lft-in99.3%
associate-*r/99.3%
metadata-eval99.3%
metadata-eval99.3%
Simplified99.3%
if -0.115000000000000005 < z < 2.00000000000000016e-5Initial program 98.3%
Taylor expanded in z around 0 91.4%
Final simplification95.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -0.11) (not (<= z 1.3e-5))) (+ (/ x y) (+ -2.0 (/ 2.0 t))) (+ (/ x y) (/ (/ 2.0 t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.11) || !(z <= 1.3e-5)) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else {
tmp = (x / y) + ((2.0 / 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 <= (-0.11d0)) .or. (.not. (z <= 1.3d-5))) then
tmp = (x / y) + ((-2.0d0) + (2.0d0 / t))
else
tmp = (x / y) + ((2.0d0 / t) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.11) || !(z <= 1.3e-5)) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else {
tmp = (x / y) + ((2.0 / t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -0.11) or not (z <= 1.3e-5): tmp = (x / y) + (-2.0 + (2.0 / t)) else: tmp = (x / y) + ((2.0 / t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -0.11) || !(z <= 1.3e-5)) tmp = Float64(Float64(x / y) + Float64(-2.0 + Float64(2.0 / t))); else tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -0.11) || ~((z <= 1.3e-5))) tmp = (x / y) + (-2.0 + (2.0 / t)); else tmp = (x / y) + ((2.0 / t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -0.11], N[Not[LessEqual[z, 1.3e-5]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.11 \lor \neg \left(z \leq 1.3 \cdot 10^{-5}\right):\\
\;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{\frac{2}{t}}{z}\\
\end{array}
\end{array}
if z < -0.110000000000000001 or 1.29999999999999992e-5 < z Initial program 77.5%
Taylor expanded in z around inf 99.3%
div-sub99.3%
sub-neg99.3%
*-inverses99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in x around 0 99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
distribute-lft-in99.3%
associate-*r/99.3%
metadata-eval99.3%
metadata-eval99.3%
Simplified99.3%
if -0.110000000000000001 < z < 1.29999999999999992e-5Initial program 98.3%
Taylor expanded in z around 0 91.4%
associate-/r*91.4%
Simplified91.4%
Final simplification95.2%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -1.35e+35) (/ x y) (if (<= (/ x y) 60000.0) (+ -2.0 (/ 2.0 t)) (- (/ x y) 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -1.35e+35) {
tmp = x / y;
} else if ((x / y) <= 60000.0) {
tmp = -2.0 + (2.0 / t);
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x / y) <= (-1.35d+35)) then
tmp = x / y
else if ((x / y) <= 60000.0d0) then
tmp = (-2.0d0) + (2.0d0 / t)
else
tmp = (x / y) - 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -1.35e+35) {
tmp = x / y;
} else if ((x / y) <= 60000.0) {
tmp = -2.0 + (2.0 / t);
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -1.35e+35: tmp = x / y elif (x / y) <= 60000.0: tmp = -2.0 + (2.0 / t) else: tmp = (x / y) - 2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -1.35e+35) tmp = Float64(x / y); elseif (Float64(x / y) <= 60000.0) tmp = Float64(-2.0 + Float64(2.0 / t)); else tmp = Float64(Float64(x / y) - 2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -1.35e+35) tmp = x / y; elseif ((x / y) <= 60000.0) tmp = -2.0 + (2.0 / t); else tmp = (x / y) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -1.35e+35], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 60000.0], N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1.35 \cdot 10^{+35}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 60000:\\
\;\;\;\;-2 + \frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - 2\\
\end{array}
\end{array}
if (/.f64 x y) < -1.35000000000000001e35Initial program 88.2%
Taylor expanded in x around inf 68.2%
if -1.35000000000000001e35 < (/.f64 x y) < 6e4Initial program 85.9%
Taylor expanded in z around inf 59.0%
div-sub59.0%
sub-neg59.0%
*-inverses59.0%
metadata-eval59.0%
Simplified59.0%
Taylor expanded in x around 0 58.7%
sub-neg58.7%
metadata-eval58.7%
distribute-lft-in58.7%
associate-*r/58.7%
metadata-eval58.7%
metadata-eval58.7%
Simplified58.7%
if 6e4 < (/.f64 x y) Initial program 93.8%
Taylor expanded in t around inf 66.9%
Final simplification63.0%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -1.2e+41) (not (<= (/ x y) 11500000.0))) (/ x y) (/ 2.0 t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -1.2e+41) || !((x / y) <= 11500000.0)) {
tmp = x / y;
} else {
tmp = 2.0 / 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 (((x / y) <= (-1.2d+41)) .or. (.not. ((x / y) <= 11500000.0d0))) then
tmp = x / y
else
tmp = 2.0d0 / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -1.2e+41) || !((x / y) <= 11500000.0)) {
tmp = x / y;
} else {
tmp = 2.0 / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -1.2e+41) or not ((x / y) <= 11500000.0): tmp = x / y else: tmp = 2.0 / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -1.2e+41) || !(Float64(x / y) <= 11500000.0)) tmp = Float64(x / y); else tmp = Float64(2.0 / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -1.2e+41) || ~(((x / y) <= 11500000.0))) tmp = x / y; else tmp = 2.0 / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -1.2e+41], N[Not[LessEqual[N[(x / y), $MachinePrecision], 11500000.0]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[(2.0 / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1.2 \cdot 10^{+41} \lor \neg \left(\frac{x}{y} \leq 11500000\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -1.2000000000000001e41 or 1.15e7 < (/.f64 x y) Initial program 91.1%
Taylor expanded in x around inf 67.3%
if -1.2000000000000001e41 < (/.f64 x y) < 1.15e7Initial program 85.9%
Taylor expanded in z around inf 59.0%
div-sub59.0%
sub-neg59.0%
*-inverses59.0%
metadata-eval59.0%
Simplified59.0%
Taylor expanded in t around 0 27.3%
Final simplification47.0%
(FPCore (x y z t) :precision binary64 (/ 2.0 t))
double code(double x, double y, double z, double t) {
return 2.0 / 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 = 2.0d0 / t
end function
public static double code(double x, double y, double z, double t) {
return 2.0 / t;
}
def code(x, y, z, t): return 2.0 / t
function code(x, y, z, t) return Float64(2.0 / t) end
function tmp = code(x, y, z, t) tmp = 2.0 / t; end
code[x_, y_, z_, t_] := N[(2.0 / t), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{t}
\end{array}
Initial program 88.5%
Taylor expanded in z around inf 67.4%
div-sub67.4%
sub-neg67.4%
*-inverses67.4%
metadata-eval67.4%
Simplified67.4%
Taylor expanded in t around 0 19.0%
Final simplification19.0%
(FPCore (x y z t) :precision binary64 (- (/ (+ (/ 2.0 z) 2.0) t) (- 2.0 (/ x y))))
double code(double x, double y, double z, double t) {
return (((2.0 / z) + 2.0) / t) - (2.0 - (x / y));
}
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 = (((2.0d0 / z) + 2.0d0) / t) - (2.0d0 - (x / y))
end function
public static double code(double x, double y, double z, double t) {
return (((2.0 / z) + 2.0) / t) - (2.0 - (x / y));
}
def code(x, y, z, t): return (((2.0 / z) + 2.0) / t) - (2.0 - (x / y))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(2.0 / z) + 2.0) / t) - Float64(2.0 - Float64(x / y))) end
function tmp = code(x, y, z, t) tmp = (((2.0 / z) + 2.0) / t) - (2.0 - (x / y)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(2.0 / z), $MachinePrecision] + 2.0), $MachinePrecision] / t), $MachinePrecision] - N[(2.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{2}{z} + 2}{t} - \left(2 - \frac{x}{y}\right)
\end{array}
herbie shell --seed 2023308
(FPCore (x y z t)
:name "Data.HashTable.ST.Basic:computeOverhead from hashtables-1.2.0.2"
:precision binary64
:herbie-target
(- (/ (+ (/ 2.0 z) 2.0) t) (- 2.0 (/ x y)))
(+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))