
(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 11 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 97.4%
Final simplification99.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (/ x y) (/ 2.0 t))) (t_2 (- (/ x y) 2.0)))
(if (<= t -1.0)
t_2
(if (<= t -4.6e-143)
t_1
(if (<= t -8e-194)
(/ (/ 2.0 t) z)
(if (<= t 4.6e-291)
t_1
(if (<= t 1.6e-195) (/ 2.0 (* z t)) (if (<= t 0.8) t_1 t_2))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) + (2.0 / t);
double t_2 = (x / y) - 2.0;
double tmp;
if (t <= -1.0) {
tmp = t_2;
} else if (t <= -4.6e-143) {
tmp = t_1;
} else if (t <= -8e-194) {
tmp = (2.0 / t) / z;
} else if (t <= 4.6e-291) {
tmp = t_1;
} else if (t <= 1.6e-195) {
tmp = 2.0 / (z * t);
} else if (t <= 0.8) {
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) + (2.0d0 / t)
t_2 = (x / y) - 2.0d0
if (t <= (-1.0d0)) then
tmp = t_2
else if (t <= (-4.6d-143)) then
tmp = t_1
else if (t <= (-8d-194)) then
tmp = (2.0d0 / t) / z
else if (t <= 4.6d-291) then
tmp = t_1
else if (t <= 1.6d-195) then
tmp = 2.0d0 / (z * t)
else if (t <= 0.8d0) 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) + (2.0 / t);
double t_2 = (x / y) - 2.0;
double tmp;
if (t <= -1.0) {
tmp = t_2;
} else if (t <= -4.6e-143) {
tmp = t_1;
} else if (t <= -8e-194) {
tmp = (2.0 / t) / z;
} else if (t <= 4.6e-291) {
tmp = t_1;
} else if (t <= 1.6e-195) {
tmp = 2.0 / (z * t);
} else if (t <= 0.8) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) + (2.0 / t) t_2 = (x / y) - 2.0 tmp = 0 if t <= -1.0: tmp = t_2 elif t <= -4.6e-143: tmp = t_1 elif t <= -8e-194: tmp = (2.0 / t) / z elif t <= 4.6e-291: tmp = t_1 elif t <= 1.6e-195: tmp = 2.0 / (z * t) elif t <= 0.8: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) + Float64(2.0 / t)) t_2 = Float64(Float64(x / y) - 2.0) tmp = 0.0 if (t <= -1.0) tmp = t_2; elseif (t <= -4.6e-143) tmp = t_1; elseif (t <= -8e-194) tmp = Float64(Float64(2.0 / t) / z); elseif (t <= 4.6e-291) tmp = t_1; elseif (t <= 1.6e-195) tmp = Float64(2.0 / Float64(z * t)); elseif (t <= 0.8) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) + (2.0 / t); t_2 = (x / y) - 2.0; tmp = 0.0; if (t <= -1.0) tmp = t_2; elseif (t <= -4.6e-143) tmp = t_1; elseif (t <= -8e-194) tmp = (2.0 / t) / z; elseif (t <= 4.6e-291) tmp = t_1; elseif (t <= 1.6e-195) tmp = 2.0 / (z * t); elseif (t <= 0.8) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[t, -1.0], t$95$2, If[LessEqual[t, -4.6e-143], t$95$1, If[LessEqual[t, -8e-194], N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t, 4.6e-291], t$95$1, If[LessEqual[t, 1.6e-195], N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 0.8], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} + \frac{2}{t}\\
t_2 := \frac{x}{y} - 2\\
\mathbf{if}\;t \leq -1:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq -4.6 \cdot 10^{-143}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -8 \cdot 10^{-194}:\\
\;\;\;\;\frac{\frac{2}{t}}{z}\\
\mathbf{elif}\;t \leq 4.6 \cdot 10^{-291}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.6 \cdot 10^{-195}:\\
\;\;\;\;\frac{2}{z \cdot t}\\
\mathbf{elif}\;t \leq 0.8:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if t < -1 or 0.80000000000000004 < t Initial program 71.2%
Taylor expanded in t around inf 93.3%
if -1 < t < -4.60000000000000023e-143 or -8.00000000000000014e-194 < t < 4.6000000000000001e-291 or 1.6000000000000001e-195 < t < 0.80000000000000004Initial program 98.8%
Taylor expanded in z around inf 66.3%
div-sub66.3%
sub-neg66.3%
*-inverses66.3%
metadata-eval66.3%
Simplified66.3%
Taylor expanded in t around 0 65.3%
Taylor expanded in x around 0 65.3%
associate-*r/65.3%
metadata-eval65.3%
+-commutative65.3%
Simplified65.3%
if -4.60000000000000023e-143 < t < -8.00000000000000014e-194Initial program 99.5%
Taylor expanded in t around 0 99.8%
associate-*r/99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0 74.8%
associate-/r*74.9%
div-inv74.8%
Applied egg-rr74.8%
Taylor expanded in t around 0 74.8%
associate-/r*74.9%
Simplified74.9%
if 4.6000000000000001e-291 < t < 1.6000000000000001e-195Initial program 93.7%
Taylor expanded in t around 0 94.1%
associate-*r/94.1%
metadata-eval94.1%
Simplified94.1%
Taylor expanded in z around 0 69.3%
Final simplification79.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ 2.0 (* z t))) (t_2 (- (/ x y) 2.0)))
(if (<= t -1.55e-66)
t_2
(if (<= t -1.02e-194)
t_1
(if (<= t 1.95e-290) (/ 2.0 t) (if (<= t 5e-157) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 / (z * t);
double t_2 = (x / y) - 2.0;
double tmp;
if (t <= -1.55e-66) {
tmp = t_2;
} else if (t <= -1.02e-194) {
tmp = t_1;
} else if (t <= 1.95e-290) {
tmp = 2.0 / t;
} else if (t <= 5e-157) {
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 / (z * t)
t_2 = (x / y) - 2.0d0
if (t <= (-1.55d-66)) then
tmp = t_2
else if (t <= (-1.02d-194)) then
tmp = t_1
else if (t <= 1.95d-290) then
tmp = 2.0d0 / t
else if (t <= 5d-157) 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 / (z * t);
double t_2 = (x / y) - 2.0;
double tmp;
if (t <= -1.55e-66) {
tmp = t_2;
} else if (t <= -1.02e-194) {
tmp = t_1;
} else if (t <= 1.95e-290) {
tmp = 2.0 / t;
} else if (t <= 5e-157) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 / (z * t) t_2 = (x / y) - 2.0 tmp = 0 if t <= -1.55e-66: tmp = t_2 elif t <= -1.02e-194: tmp = t_1 elif t <= 1.95e-290: tmp = 2.0 / t elif t <= 5e-157: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(2.0 / Float64(z * t)) t_2 = Float64(Float64(x / y) - 2.0) tmp = 0.0 if (t <= -1.55e-66) tmp = t_2; elseif (t <= -1.02e-194) tmp = t_1; elseif (t <= 1.95e-290) tmp = Float64(2.0 / t); elseif (t <= 5e-157) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 / (z * t); t_2 = (x / y) - 2.0; tmp = 0.0; if (t <= -1.55e-66) tmp = t_2; elseif (t <= -1.02e-194) tmp = t_1; elseif (t <= 1.95e-290) tmp = 2.0 / t; elseif (t <= 5e-157) 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[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[t, -1.55e-66], t$95$2, If[LessEqual[t, -1.02e-194], t$95$1, If[LessEqual[t, 1.95e-290], N[(2.0 / t), $MachinePrecision], If[LessEqual[t, 5e-157], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{2}{z \cdot t}\\
t_2 := \frac{x}{y} - 2\\
\mathbf{if}\;t \leq -1.55 \cdot 10^{-66}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq -1.02 \cdot 10^{-194}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.95 \cdot 10^{-290}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{elif}\;t \leq 5 \cdot 10^{-157}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if t < -1.5499999999999999e-66 or 5.0000000000000002e-157 < t Initial program 78.4%
Taylor expanded in t around inf 80.0%
if -1.5499999999999999e-66 < t < -1.02e-194 or 1.94999999999999986e-290 < t < 5.0000000000000002e-157Initial program 98.1%
Taylor expanded in t around 0 90.9%
associate-*r/90.9%
metadata-eval90.9%
Simplified90.9%
Taylor expanded in z around 0 59.1%
if -1.02e-194 < t < 1.94999999999999986e-290Initial program 99.9%
Taylor expanded in t around 0 85.3%
associate-*r/85.3%
metadata-eval85.3%
Simplified85.3%
Taylor expanded in z around inf 56.2%
Final simplification72.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)))
(if (<= t -6.8e-68)
t_1
(if (<= t -3.8e-194)
(/ (/ 2.0 t) z)
(if (<= t 7e-292)
(/ 2.0 t)
(if (<= t 5.5e-157) (/ 2.0 (* z t)) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double tmp;
if (t <= -6.8e-68) {
tmp = t_1;
} else if (t <= -3.8e-194) {
tmp = (2.0 / t) / z;
} else if (t <= 7e-292) {
tmp = 2.0 / t;
} else if (t <= 5.5e-157) {
tmp = 2.0 / (z * t);
} 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 = (x / y) - 2.0d0
if (t <= (-6.8d-68)) then
tmp = t_1
else if (t <= (-3.8d-194)) then
tmp = (2.0d0 / t) / z
else if (t <= 7d-292) then
tmp = 2.0d0 / t
else if (t <= 5.5d-157) then
tmp = 2.0d0 / (z * t)
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) - 2.0;
double tmp;
if (t <= -6.8e-68) {
tmp = t_1;
} else if (t <= -3.8e-194) {
tmp = (2.0 / t) / z;
} else if (t <= 7e-292) {
tmp = 2.0 / t;
} else if (t <= 5.5e-157) {
tmp = 2.0 / (z * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) - 2.0 tmp = 0 if t <= -6.8e-68: tmp = t_1 elif t <= -3.8e-194: tmp = (2.0 / t) / z elif t <= 7e-292: tmp = 2.0 / t elif t <= 5.5e-157: tmp = 2.0 / (z * t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) - 2.0) tmp = 0.0 if (t <= -6.8e-68) tmp = t_1; elseif (t <= -3.8e-194) tmp = Float64(Float64(2.0 / t) / z); elseif (t <= 7e-292) tmp = Float64(2.0 / t); elseif (t <= 5.5e-157) tmp = Float64(2.0 / Float64(z * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) - 2.0; tmp = 0.0; if (t <= -6.8e-68) tmp = t_1; elseif (t <= -3.8e-194) tmp = (2.0 / t) / z; elseif (t <= 7e-292) tmp = 2.0 / t; elseif (t <= 5.5e-157) tmp = 2.0 / (z * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[t, -6.8e-68], t$95$1, If[LessEqual[t, -3.8e-194], N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t, 7e-292], N[(2.0 / t), $MachinePrecision], If[LessEqual[t, 5.5e-157], N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
\mathbf{if}\;t \leq -6.8 \cdot 10^{-68}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -3.8 \cdot 10^{-194}:\\
\;\;\;\;\frac{\frac{2}{t}}{z}\\
\mathbf{elif}\;t \leq 7 \cdot 10^{-292}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{elif}\;t \leq 5.5 \cdot 10^{-157}:\\
\;\;\;\;\frac{2}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -6.80000000000000037e-68 or 5.4999999999999998e-157 < t Initial program 78.4%
Taylor expanded in t around inf 80.0%
if -6.80000000000000037e-68 < t < -3.8000000000000003e-194Initial program 99.5%
Taylor expanded in t around 0 89.8%
associate-*r/89.8%
metadata-eval89.8%
Simplified89.8%
Taylor expanded in z around 0 58.1%
associate-/r*58.3%
div-inv58.1%
Applied egg-rr58.1%
Taylor expanded in t around 0 58.1%
associate-/r*58.3%
Simplified58.3%
if -3.8000000000000003e-194 < t < 6.9999999999999999e-292Initial program 99.9%
Taylor expanded in t around 0 85.3%
associate-*r/85.3%
metadata-eval85.3%
Simplified85.3%
Taylor expanded in z around inf 56.2%
if 6.9999999999999999e-292 < t < 5.4999999999999998e-157Initial program 96.1%
Taylor expanded in t around 0 92.5%
associate-*r/92.5%
metadata-eval92.5%
Simplified92.5%
Taylor expanded in z around 0 60.6%
Final simplification72.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)))
(if (<= t -1500000.0)
t_1
(if (<= t 2.7e-104)
(/ (+ 2.0 (/ 2.0 z)) t)
(if (<= t 2.05e+23) (+ (/ x y) (/ 2.0 (* z t))) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double tmp;
if (t <= -1500000.0) {
tmp = t_1;
} else if (t <= 2.7e-104) {
tmp = (2.0 + (2.0 / z)) / t;
} else if (t <= 2.05e+23) {
tmp = (x / y) + (2.0 / (z * t));
} 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 = (x / y) - 2.0d0
if (t <= (-1500000.0d0)) then
tmp = t_1
else if (t <= 2.7d-104) then
tmp = (2.0d0 + (2.0d0 / z)) / t
else if (t <= 2.05d+23) then
tmp = (x / y) + (2.0d0 / (z * t))
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) - 2.0;
double tmp;
if (t <= -1500000.0) {
tmp = t_1;
} else if (t <= 2.7e-104) {
tmp = (2.0 + (2.0 / z)) / t;
} else if (t <= 2.05e+23) {
tmp = (x / y) + (2.0 / (z * t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) - 2.0 tmp = 0 if t <= -1500000.0: tmp = t_1 elif t <= 2.7e-104: tmp = (2.0 + (2.0 / z)) / t elif t <= 2.05e+23: tmp = (x / y) + (2.0 / (z * t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) - 2.0) tmp = 0.0 if (t <= -1500000.0) tmp = t_1; elseif (t <= 2.7e-104) tmp = Float64(Float64(2.0 + Float64(2.0 / z)) / t); elseif (t <= 2.05e+23) tmp = Float64(Float64(x / y) + Float64(2.0 / Float64(z * t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) - 2.0; tmp = 0.0; if (t <= -1500000.0) tmp = t_1; elseif (t <= 2.7e-104) tmp = (2.0 + (2.0 / z)) / t; elseif (t <= 2.05e+23) tmp = (x / y) + (2.0 / (z * t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[t, -1500000.0], t$95$1, If[LessEqual[t, 2.7e-104], N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[t, 2.05e+23], N[(N[(x / y), $MachinePrecision] + N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
\mathbf{if}\;t \leq -1500000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 2.7 \cdot 10^{-104}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\mathbf{elif}\;t \leq 2.05 \cdot 10^{+23}:\\
\;\;\;\;\frac{x}{y} + \frac{2}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -1.5e6 or 2.04999999999999998e23 < t Initial program 69.5%
Taylor expanded in t around inf 95.8%
if -1.5e6 < t < 2.6999999999999998e-104Initial program 98.9%
Taylor expanded in t around 0 83.9%
associate-*r/83.9%
metadata-eval83.9%
Simplified83.9%
if 2.6999999999999998e-104 < t < 2.04999999999999998e23Initial program 96.0%
Taylor expanded in z around 0 85.4%
Final simplification89.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ x y) 2.0)))
(if (<= t -7500.0)
t_1
(if (<= t 3.2e-104)
(/ (+ 2.0 (/ 2.0 z)) t)
(if (<= t 1.6e+19) (+ (/ x y) (/ (/ 2.0 t) z)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double tmp;
if (t <= -7500.0) {
tmp = t_1;
} else if (t <= 3.2e-104) {
tmp = (2.0 + (2.0 / z)) / t;
} else if (t <= 1.6e+19) {
tmp = (x / y) + ((2.0 / t) / 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) :: tmp
t_1 = (x / y) - 2.0d0
if (t <= (-7500.0d0)) then
tmp = t_1
else if (t <= 3.2d-104) then
tmp = (2.0d0 + (2.0d0 / z)) / t
else if (t <= 1.6d+19) then
tmp = (x / y) + ((2.0d0 / t) / 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) - 2.0;
double tmp;
if (t <= -7500.0) {
tmp = t_1;
} else if (t <= 3.2e-104) {
tmp = (2.0 + (2.0 / z)) / t;
} else if (t <= 1.6e+19) {
tmp = (x / y) + ((2.0 / t) / z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) - 2.0 tmp = 0 if t <= -7500.0: tmp = t_1 elif t <= 3.2e-104: tmp = (2.0 + (2.0 / z)) / t elif t <= 1.6e+19: tmp = (x / y) + ((2.0 / t) / z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) - 2.0) tmp = 0.0 if (t <= -7500.0) tmp = t_1; elseif (t <= 3.2e-104) tmp = Float64(Float64(2.0 + Float64(2.0 / z)) / t); elseif (t <= 1.6e+19) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) / z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) - 2.0; tmp = 0.0; if (t <= -7500.0) tmp = t_1; elseif (t <= 3.2e-104) tmp = (2.0 + (2.0 / z)) / t; elseif (t <= 1.6e+19) tmp = (x / y) + ((2.0 / t) / z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[t, -7500.0], t$95$1, If[LessEqual[t, 3.2e-104], N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[t, 1.6e+19], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
\mathbf{if}\;t \leq -7500:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 3.2 \cdot 10^{-104}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\mathbf{elif}\;t \leq 1.6 \cdot 10^{+19}:\\
\;\;\;\;\frac{x}{y} + \frac{\frac{2}{t}}{z}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -7500 or 1.6e19 < t Initial program 69.5%
Taylor expanded in t around inf 95.8%
if -7500 < t < 3.19999999999999989e-104Initial program 98.9%
Taylor expanded in t around 0 83.9%
associate-*r/83.9%
metadata-eval83.9%
Simplified83.9%
if 3.19999999999999989e-104 < t < 1.6e19Initial program 96.0%
Taylor expanded in z around 0 85.4%
associate-/r*85.4%
Simplified85.4%
Final simplification89.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.95e-10) (not (<= z 4e-22))) (+ (/ x y) (* 2.0 (+ (/ 1.0 t) -1.0))) (+ (/ x y) (/ (/ 2.0 t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.95e-10) || !(z <= 4e-22)) {
tmp = (x / y) + (2.0 * ((1.0 / t) + -1.0));
} 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 <= (-1.95d-10)) .or. (.not. (z <= 4d-22))) then
tmp = (x / y) + (2.0d0 * ((1.0d0 / t) + (-1.0d0)))
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 <= -1.95e-10) || !(z <= 4e-22)) {
tmp = (x / y) + (2.0 * ((1.0 / t) + -1.0));
} else {
tmp = (x / y) + ((2.0 / t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.95e-10) or not (z <= 4e-22): tmp = (x / y) + (2.0 * ((1.0 / t) + -1.0)) else: tmp = (x / y) + ((2.0 / t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.95e-10) || !(z <= 4e-22)) tmp = Float64(Float64(x / y) + Float64(2.0 * Float64(Float64(1.0 / t) + -1.0))); 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 <= -1.95e-10) || ~((z <= 4e-22))) tmp = (x / y) + (2.0 * ((1.0 / t) + -1.0)); else tmp = (x / y) + ((2.0 / t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.95e-10], N[Not[LessEqual[z, 4e-22]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(2.0 * N[(N[(1.0 / t), $MachinePrecision] + -1.0), $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 -1.95 \cdot 10^{-10} \lor \neg \left(z \leq 4 \cdot 10^{-22}\right):\\
\;\;\;\;\frac{x}{y} + 2 \cdot \left(\frac{1}{t} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{\frac{2}{t}}{z}\\
\end{array}
\end{array}
if z < -1.95e-10 or 4.0000000000000002e-22 < z Initial program 73.0%
Taylor expanded in z around inf 99.0%
div-sub99.0%
sub-neg99.0%
*-inverses99.0%
metadata-eval99.0%
Simplified99.0%
if -1.95e-10 < z < 4.0000000000000002e-22Initial program 98.2%
Taylor expanded in z around 0 88.8%
associate-/r*88.9%
Simplified88.9%
Final simplification94.2%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -1.45e+23) (not (<= (/ x y) 0.12))) (/ x y) (/ 2.0 t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -1.45e+23) || !((x / y) <= 0.12)) {
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.45d+23)) .or. (.not. ((x / y) <= 0.12d0))) 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.45e+23) || !((x / y) <= 0.12)) {
tmp = x / y;
} else {
tmp = 2.0 / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -1.45e+23) or not ((x / y) <= 0.12): tmp = x / y else: tmp = 2.0 / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -1.45e+23) || !(Float64(x / y) <= 0.12)) 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.45e+23) || ~(((x / y) <= 0.12))) 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.45e+23], N[Not[LessEqual[N[(x / y), $MachinePrecision], 0.12]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[(2.0 / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1.45 \cdot 10^{+23} \lor \neg \left(\frac{x}{y} \leq 0.12\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -1.45000000000000006e23 or 0.12 < (/.f64 x y) Initial program 85.8%
Taylor expanded in x around inf 76.8%
if -1.45000000000000006e23 < (/.f64 x y) < 0.12Initial program 84.2%
Taylor expanded in t around 0 62.8%
associate-*r/62.8%
metadata-eval62.8%
Simplified62.8%
Taylor expanded in z around inf 30.5%
Final simplification54.8%
(FPCore (x y z t) :precision binary64 (if (or (<= t -100000.0) (not (<= t 1.2e-30))) (- (/ x y) 2.0) (/ (+ 2.0 (/ 2.0 z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -100000.0) || !(t <= 1.2e-30)) {
tmp = (x / y) - 2.0;
} else {
tmp = (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 <= (-100000.0d0)) .or. (.not. (t <= 1.2d-30))) then
tmp = (x / y) - 2.0d0
else
tmp = (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 <= -100000.0) || !(t <= 1.2e-30)) {
tmp = (x / y) - 2.0;
} else {
tmp = (2.0 + (2.0 / z)) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -100000.0) or not (t <= 1.2e-30): tmp = (x / y) - 2.0 else: tmp = (2.0 + (2.0 / z)) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -100000.0) || !(t <= 1.2e-30)) tmp = Float64(Float64(x / y) - 2.0); else tmp = 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 <= -100000.0) || ~((t <= 1.2e-30))) tmp = (x / y) - 2.0; else tmp = (2.0 + (2.0 / z)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -100000.0], N[Not[LessEqual[t, 1.2e-30]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -100000 \lor \neg \left(t \leq 1.2 \cdot 10^{-30}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if t < -1e5 or 1.19999999999999992e-30 < t Initial program 71.2%
Taylor expanded in t around inf 92.7%
if -1e5 < t < 1.19999999999999992e-30Initial program 99.0%
Taylor expanded in t around 0 80.6%
associate-*r/80.6%
metadata-eval80.6%
Simplified80.6%
Final simplification86.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -4.5e-80) (not (<= t 2.8e-104))) (- (/ x y) 2.0) (/ 2.0 t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.5e-80) || !(t <= 2.8e-104)) {
tmp = (x / y) - 2.0;
} 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 ((t <= (-4.5d-80)) .or. (.not. (t <= 2.8d-104))) then
tmp = (x / y) - 2.0d0
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 ((t <= -4.5e-80) || !(t <= 2.8e-104)) {
tmp = (x / y) - 2.0;
} else {
tmp = 2.0 / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -4.5e-80) or not (t <= 2.8e-104): tmp = (x / y) - 2.0 else: tmp = 2.0 / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -4.5e-80) || !(t <= 2.8e-104)) tmp = Float64(Float64(x / y) - 2.0); else tmp = Float64(2.0 / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -4.5e-80) || ~((t <= 2.8e-104))) tmp = (x / y) - 2.0; else tmp = 2.0 / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -4.5e-80], N[Not[LessEqual[t, 2.8e-104]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(2.0 / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.5 \cdot 10^{-80} \lor \neg \left(t \leq 2.8 \cdot 10^{-104}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t}\\
\end{array}
\end{array}
if t < -4.5000000000000003e-80 or 2.8e-104 < t Initial program 77.3%
Taylor expanded in t around inf 82.0%
if -4.5000000000000003e-80 < t < 2.8e-104Initial program 98.7%
Taylor expanded in t around 0 86.2%
associate-*r/86.2%
metadata-eval86.2%
Simplified86.2%
Taylor expanded in z around inf 41.8%
Final simplification67.5%
(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 85.0%
Taylor expanded in t around 0 44.4%
associate-*r/44.4%
metadata-eval44.4%
Simplified44.4%
Taylor expanded in z around inf 18.9%
Final simplification18.9%
(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 2024018
(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))))