
(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 (+ (/ (+ (/ 2.0 t) -2.0) x) (+ (/ 1.0 y) (/ 2.0 (* t (* x z)))))))))
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 * ((((2.0 / t) + -2.0) / x) + ((1.0 / y) + (2.0 / (t * (x * z)))));
}
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 * ((((2.0 / t) + -2.0) / x) + ((1.0 / y) + (2.0 / (t * (x * z)))));
}
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 * ((((2.0 / t) + -2.0) / x) + ((1.0 / y) + (2.0 / (t * (x * z))))) 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(x * Float64(Float64(Float64(Float64(2.0 / t) + -2.0) / x) + Float64(Float64(1.0 / y) + Float64(2.0 / Float64(t * Float64(x * z)))))); 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 * ((((2.0 / t) + -2.0) / x) + ((1.0 / y) + (2.0 / (t * (x * z))))); 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[(x * N[(N[(N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision] / x), $MachinePrecision] + N[(N[(1.0 / y), $MachinePrecision] + N[(2.0 / N[(t * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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}:\\
\;\;\;\;x \cdot \left(\frac{\frac{2}{t} + -2}{x} + \left(\frac{1}{y} + \frac{2}{t \cdot \left(x \cdot z\right)}\right)\right)\\
\end{array}
\end{array}
if (+.f64 (/.f64 x y) (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z))) < +inf.0Initial program 99.9%
if +inf.0 < (+.f64 (/.f64 x y) (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z))) Initial program 0.0%
Taylor expanded in x around inf 96.3%
associate-/r*99.7%
associate-*r/99.7%
*-commutative99.7%
*-commutative99.7%
div-sub99.7%
sub-neg99.7%
*-inverses99.7%
metadata-eval99.7%
distribute-lft-in99.7%
metadata-eval99.7%
associate-*r/99.7%
metadata-eval99.7%
*-commutative99.7%
Simplified99.7%
Final simplification99.8%
(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 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z))) < +inf.0Initial program 99.9%
if +inf.0 < (+.f64 (/.f64 x y) (/.f64 (+.f64 #s(literal 2 binary64) (*.f64 (*.f64 z #s(literal 2 binary64)) (-.f64 #s(literal 1 binary64) t))) (*.f64 t z))) Initial program 0.0%
Taylor expanded in t around inf 96.6%
Final simplification99.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ 2.0 (/ 2.0 z)) t)) (t_2 (- (/ x y) 2.0)))
(if (<= t -5e-5)
t_2
(if (<= t 8.2e-48)
t_1
(if (<= t 4.8e-30) (/ x y) (if (<= t 32000.0) t_1 t_2))))))
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;
double tmp;
if (t <= -5e-5) {
tmp = t_2;
} else if (t <= 8.2e-48) {
tmp = t_1;
} else if (t <= 4.8e-30) {
tmp = x / y;
} else if (t <= 32000.0) {
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 / z)) / t
t_2 = (x / y) - 2.0d0
if (t <= (-5d-5)) then
tmp = t_2
else if (t <= 8.2d-48) then
tmp = t_1
else if (t <= 4.8d-30) then
tmp = x / y
else if (t <= 32000.0d0) 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 / z)) / t;
double t_2 = (x / y) - 2.0;
double tmp;
if (t <= -5e-5) {
tmp = t_2;
} else if (t <= 8.2e-48) {
tmp = t_1;
} else if (t <= 4.8e-30) {
tmp = x / y;
} else if (t <= 32000.0) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (2.0 + (2.0 / z)) / t t_2 = (x / y) - 2.0 tmp = 0 if t <= -5e-5: tmp = t_2 elif t <= 8.2e-48: tmp = t_1 elif t <= 4.8e-30: tmp = x / y elif t <= 32000.0: tmp = t_1 else: tmp = t_2 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) - 2.0) tmp = 0.0 if (t <= -5e-5) tmp = t_2; elseif (t <= 8.2e-48) tmp = t_1; elseif (t <= 4.8e-30) tmp = Float64(x / y); elseif (t <= 32000.0) 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 / z)) / t; t_2 = (x / y) - 2.0; tmp = 0.0; if (t <= -5e-5) tmp = t_2; elseif (t <= 8.2e-48) tmp = t_1; elseif (t <= 4.8e-30) tmp = x / y; elseif (t <= 32000.0) tmp = t_1; else tmp = t_2; 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] - 2.0), $MachinePrecision]}, If[LessEqual[t, -5e-5], t$95$2, If[LessEqual[t, 8.2e-48], t$95$1, If[LessEqual[t, 4.8e-30], N[(x / y), $MachinePrecision], If[LessEqual[t, 32000.0], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{2 + \frac{2}{z}}{t}\\
t_2 := \frac{x}{y} - 2\\
\mathbf{if}\;t \leq -5 \cdot 10^{-5}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq 8.2 \cdot 10^{-48}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 4.8 \cdot 10^{-30}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;t \leq 32000:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t < -5.00000000000000024e-5 or 32000 < t Initial program 79.0%
Taylor expanded in t around inf 88.9%
if -5.00000000000000024e-5 < t < 8.20000000000000028e-48 or 4.7999999999999997e-30 < t < 32000Initial program 98.1%
Taylor expanded in t around 0 82.7%
associate-*r/82.7%
metadata-eval82.7%
Simplified82.7%
if 8.20000000000000028e-48 < t < 4.7999999999999997e-30Initial program 100.0%
Taylor expanded in x around inf 100.0%
Final simplification86.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ 2.0 (/ 2.0 z)) t)) (t_2 (+ (/ x y) (+ (/ 2.0 t) -2.0))))
(if (<= t -2e-5)
t_2
(if (<= t 1e-87)
t_1
(if (<= t 3.6e-27) t_2 (if (<= t 125.0) t_1 (- (/ x y) 2.0)))))))
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) + -2.0);
double tmp;
if (t <= -2e-5) {
tmp = t_2;
} else if (t <= 1e-87) {
tmp = t_1;
} else if (t <= 3.6e-27) {
tmp = t_2;
} else if (t <= 125.0) {
tmp = t_1;
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (2.0d0 + (2.0d0 / z)) / t
t_2 = (x / y) + ((2.0d0 / t) + (-2.0d0))
if (t <= (-2d-5)) then
tmp = t_2
else if (t <= 1d-87) then
tmp = t_1
else if (t <= 3.6d-27) then
tmp = t_2
else if (t <= 125.0d0) then
tmp = t_1
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 t_1 = (2.0 + (2.0 / z)) / t;
double t_2 = (x / y) + ((2.0 / t) + -2.0);
double tmp;
if (t <= -2e-5) {
tmp = t_2;
} else if (t <= 1e-87) {
tmp = t_1;
} else if (t <= 3.6e-27) {
tmp = t_2;
} else if (t <= 125.0) {
tmp = t_1;
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
def code(x, y, z, t): t_1 = (2.0 + (2.0 / z)) / t t_2 = (x / y) + ((2.0 / t) + -2.0) tmp = 0 if t <= -2e-5: tmp = t_2 elif t <= 1e-87: tmp = t_1 elif t <= 3.6e-27: tmp = t_2 elif t <= 125.0: tmp = t_1 else: tmp = (x / y) - 2.0 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(Float64(2.0 / t) + -2.0)) tmp = 0.0 if (t <= -2e-5) tmp = t_2; elseif (t <= 1e-87) tmp = t_1; elseif (t <= 3.6e-27) tmp = t_2; elseif (t <= 125.0) 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 = (2.0 + (2.0 / z)) / t; t_2 = (x / y) + ((2.0 / t) + -2.0); tmp = 0.0; if (t <= -2e-5) tmp = t_2; elseif (t <= 1e-87) tmp = t_1; elseif (t <= 3.6e-27) tmp = t_2; elseif (t <= 125.0) 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[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2e-5], t$95$2, If[LessEqual[t, 1e-87], t$95$1, If[LessEqual[t, 3.6e-27], t$95$2, If[LessEqual[t, 125.0], t$95$1, N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{2 + \frac{2}{z}}{t}\\
t_2 := \frac{x}{y} + \left(\frac{2}{t} + -2\right)\\
\mathbf{if}\;t \leq -2 \cdot 10^{-5}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq 10^{-87}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.6 \cdot 10^{-27}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq 125:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - 2\\
\end{array}
\end{array}
if t < -2.00000000000000016e-5 or 1.00000000000000002e-87 < t < 3.5999999999999999e-27Initial program 83.5%
Taylor expanded in z around inf 88.4%
div-sub88.4%
sub-neg88.4%
*-inverses88.4%
metadata-eval88.4%
distribute-lft-in88.4%
metadata-eval88.4%
associate-*r/88.4%
metadata-eval88.4%
Simplified88.4%
if -2.00000000000000016e-5 < t < 1.00000000000000002e-87 or 3.5999999999999999e-27 < t < 125Initial program 98.0%
Taylor expanded in t around 0 83.5%
associate-*r/83.5%
metadata-eval83.5%
Simplified83.5%
if 125 < t Initial program 77.6%
Taylor expanded in t around inf 90.0%
Final simplification86.6%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -6.6e+82) (/ x y) (if (<= (/ x y) 1.5e+60) (+ -2.0 (/ (/ 2.0 z) t)) (- (/ x y) 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -6.6e+82) {
tmp = x / y;
} else if ((x / y) <= 1.5e+60) {
tmp = -2.0 + ((2.0 / z) / 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) <= (-6.6d+82)) then
tmp = x / y
else if ((x / y) <= 1.5d+60) then
tmp = (-2.0d0) + ((2.0d0 / z) / 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) <= -6.6e+82) {
tmp = x / y;
} else if ((x / y) <= 1.5e+60) {
tmp = -2.0 + ((2.0 / z) / t);
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -6.6e+82: tmp = x / y elif (x / y) <= 1.5e+60: tmp = -2.0 + ((2.0 / z) / t) else: tmp = (x / y) - 2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -6.6e+82) tmp = Float64(x / y); elseif (Float64(x / y) <= 1.5e+60) tmp = Float64(-2.0 + Float64(Float64(2.0 / z) / 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) <= -6.6e+82) tmp = x / y; elseif ((x / y) <= 1.5e+60) tmp = -2.0 + ((2.0 / z) / t); else tmp = (x / y) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -6.6e+82], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1.5e+60], N[(-2.0 + N[(N[(2.0 / z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -6.6 \cdot 10^{+82}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 1.5 \cdot 10^{+60}:\\
\;\;\;\;-2 + \frac{\frac{2}{z}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - 2\\
\end{array}
\end{array}
if (/.f64 x y) < -6.5999999999999997e82Initial program 85.5%
Taylor expanded in x around inf 88.0%
if -6.5999999999999997e82 < (/.f64 x y) < 1.4999999999999999e60Initial program 89.8%
Taylor expanded in x around inf 67.7%
associate-/r*71.2%
associate-*r/71.2%
*-commutative71.2%
*-commutative71.2%
div-sub71.2%
sub-neg71.2%
*-inverses71.2%
metadata-eval71.2%
distribute-lft-in71.2%
metadata-eval71.2%
associate-*r/71.2%
metadata-eval71.2%
*-commutative71.2%
Simplified71.2%
Taylor expanded in x around 0 93.5%
sub-neg93.5%
*-commutative93.5%
*-commutative93.5%
associate-/r*93.5%
associate-*l/93.5%
associate-/l*93.4%
distribute-lft-in93.4%
associate-*l/93.4%
*-lft-identity93.4%
metadata-eval93.4%
Simplified93.4%
Taylor expanded in z around 0 72.7%
if 1.4999999999999999e60 < (/.f64 x y) Initial program 88.3%
Taylor expanded in t around inf 77.3%
Final simplification77.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.16e-15) (not (<= z 1.2e-19))) (+ (/ x y) (+ (/ 2.0 t) -2.0)) (+ (/ x y) (/ (/ 2.0 t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.16e-15) || !(z <= 1.2e-19)) {
tmp = (x / y) + ((2.0 / t) + -2.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.16d-15)) .or. (.not. (z <= 1.2d-19))) then
tmp = (x / y) + ((2.0d0 / t) + (-2.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.16e-15) || !(z <= 1.2e-19)) {
tmp = (x / y) + ((2.0 / t) + -2.0);
} else {
tmp = (x / y) + ((2.0 / t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.16e-15) or not (z <= 1.2e-19): tmp = (x / y) + ((2.0 / t) + -2.0) else: tmp = (x / y) + ((2.0 / t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.16e-15) || !(z <= 1.2e-19)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) + -2.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.16e-15) || ~((z <= 1.2e-19))) tmp = (x / y) + ((2.0 / t) + -2.0); else tmp = (x / y) + ((2.0 / t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.16e-15], N[Not[LessEqual[z, 1.2e-19]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] + -2.0), $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.16 \cdot 10^{-15} \lor \neg \left(z \leq 1.2 \cdot 10^{-19}\right):\\
\;\;\;\;\frac{x}{y} + \left(\frac{2}{t} + -2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{\frac{2}{t}}{z}\\
\end{array}
\end{array}
if z < -1.1599999999999999e-15 or 1.20000000000000011e-19 < z Initial program 79.6%
Taylor expanded in z around inf 98.5%
div-sub98.5%
sub-neg98.5%
*-inverses98.5%
metadata-eval98.5%
distribute-lft-in98.5%
metadata-eval98.5%
associate-*r/98.5%
metadata-eval98.5%
Simplified98.5%
if -1.1599999999999999e-15 < z < 1.20000000000000011e-19Initial program 98.2%
Taylor expanded in z around 0 91.9%
associate-/r*92.0%
Simplified92.0%
Final simplification95.4%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -3.95) (not (<= (/ x y) 560000000000.0))) (/ x y) -2.0))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -3.95) || !((x / y) <= 560000000000.0)) {
tmp = x / y;
} else {
tmp = -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) <= (-3.95d0)) .or. (.not. ((x / y) <= 560000000000.0d0))) then
tmp = x / y
else
tmp = -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) <= -3.95) || !((x / y) <= 560000000000.0)) {
tmp = x / y;
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -3.95) or not ((x / y) <= 560000000000.0): tmp = x / y else: tmp = -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -3.95) || !(Float64(x / y) <= 560000000000.0)) tmp = Float64(x / y); else tmp = -2.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -3.95) || ~(((x / y) <= 560000000000.0))) tmp = x / y; else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -3.95], N[Not[LessEqual[N[(x / y), $MachinePrecision], 560000000000.0]], $MachinePrecision]], N[(x / y), $MachinePrecision], -2.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -3.95 \lor \neg \left(\frac{x}{y} \leq 560000000000\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if (/.f64 x y) < -3.9500000000000002 or 5.6e11 < (/.f64 x y) Initial program 87.8%
Taylor expanded in x around inf 73.6%
if -3.9500000000000002 < (/.f64 x y) < 5.6e11Initial program 89.4%
Taylor expanded in x around inf 63.4%
associate-/r*67.4%
associate-*r/67.4%
*-commutative67.4%
*-commutative67.4%
div-sub67.4%
sub-neg67.4%
*-inverses67.4%
metadata-eval67.4%
distribute-lft-in67.4%
metadata-eval67.4%
associate-*r/67.4%
metadata-eval67.4%
*-commutative67.4%
Simplified67.4%
Taylor expanded in x around 0 98.6%
sub-neg98.6%
associate-*r/98.6%
metadata-eval98.6%
+-commutative98.6%
associate-*r/98.6%
metadata-eval98.6%
metadata-eval98.6%
Simplified98.6%
Taylor expanded in t around inf 36.0%
Final simplification56.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -6.2e-68) (not (<= t 1.55e-123))) (- (/ x y) 2.0) (/ 2.0 t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -6.2e-68) || !(t <= 1.55e-123)) {
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 <= (-6.2d-68)) .or. (.not. (t <= 1.55d-123))) 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 <= -6.2e-68) || !(t <= 1.55e-123)) {
tmp = (x / y) - 2.0;
} else {
tmp = 2.0 / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -6.2e-68) or not (t <= 1.55e-123): tmp = (x / y) - 2.0 else: tmp = 2.0 / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -6.2e-68) || !(t <= 1.55e-123)) 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 <= -6.2e-68) || ~((t <= 1.55e-123))) tmp = (x / y) - 2.0; else tmp = 2.0 / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -6.2e-68], N[Not[LessEqual[t, 1.55e-123]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(2.0 / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.2 \cdot 10^{-68} \lor \neg \left(t \leq 1.55 \cdot 10^{-123}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t}\\
\end{array}
\end{array}
if t < -6.1999999999999999e-68 or 1.54999999999999999e-123 < t Initial program 84.4%
Taylor expanded in t around inf 75.6%
if -6.1999999999999999e-68 < t < 1.54999999999999999e-123Initial program 97.4%
Taylor expanded in t around 0 86.9%
associate-*r/86.9%
metadata-eval86.9%
Simplified86.9%
Taylor expanded in z around inf 39.8%
Final simplification64.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -9e-204) (not (<= z 1.35e-139))) (- (/ x y) 2.0) (/ 2.0 (* z t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9e-204) || !(z <= 1.35e-139)) {
tmp = (x / y) - 2.0;
} else {
tmp = 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 <= (-9d-204)) .or. (.not. (z <= 1.35d-139))) then
tmp = (x / y) - 2.0d0
else
tmp = 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 <= -9e-204) || !(z <= 1.35e-139)) {
tmp = (x / y) - 2.0;
} else {
tmp = 2.0 / (z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -9e-204) or not (z <= 1.35e-139): tmp = (x / y) - 2.0 else: tmp = 2.0 / (z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -9e-204) || !(z <= 1.35e-139)) tmp = Float64(Float64(x / y) - 2.0); else tmp = Float64(2.0 / Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -9e-204) || ~((z <= 1.35e-139))) tmp = (x / y) - 2.0; else tmp = 2.0 / (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -9e-204], N[Not[LessEqual[z, 1.35e-139]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{-204} \lor \neg \left(z \leq 1.35 \cdot 10^{-139}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{z \cdot t}\\
\end{array}
\end{array}
if z < -8.99999999999999948e-204 or 1.3499999999999999e-139 < z Initial program 86.0%
Taylor expanded in t around inf 65.7%
if -8.99999999999999948e-204 < z < 1.3499999999999999e-139Initial program 98.0%
Taylor expanded in x around inf 75.9%
associate-/r*77.3%
associate-*r/77.3%
*-commutative77.3%
*-commutative77.3%
div-sub77.3%
sub-neg77.3%
*-inverses77.3%
metadata-eval77.3%
distribute-lft-in77.3%
metadata-eval77.3%
associate-*r/77.3%
metadata-eval77.3%
*-commutative77.3%
Simplified77.3%
Taylor expanded in z around 0 77.6%
Final simplification68.2%
(FPCore (x y z t) :precision binary64 (if (<= t -2.8e-10) -2.0 (if (<= t 2.75e-5) (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.8e-10) {
tmp = -2.0;
} else if (t <= 2.75e-5) {
tmp = 2.0 / t;
} else {
tmp = -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 (t <= (-2.8d-10)) then
tmp = -2.0d0
else if (t <= 2.75d-5) then
tmp = 2.0d0 / t
else
tmp = -2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.8e-10) {
tmp = -2.0;
} else if (t <= 2.75e-5) {
tmp = 2.0 / t;
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.8e-10: tmp = -2.0 elif t <= 2.75e-5: tmp = 2.0 / t else: tmp = -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.8e-10) tmp = -2.0; elseif (t <= 2.75e-5) tmp = Float64(2.0 / t); else tmp = -2.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2.8e-10) tmp = -2.0; elseif (t <= 2.75e-5) tmp = 2.0 / t; else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.8e-10], -2.0, If[LessEqual[t, 2.75e-5], N[(2.0 / t), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{-10}:\\
\;\;\;\;-2\\
\mathbf{elif}\;t \leq 2.75 \cdot 10^{-5}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if t < -2.80000000000000015e-10 or 2.7500000000000001e-5 < t Initial program 80.0%
Taylor expanded in x around inf 86.9%
associate-/r*90.5%
associate-*r/90.5%
*-commutative90.5%
*-commutative90.5%
div-sub90.5%
sub-neg90.5%
*-inverses90.5%
metadata-eval90.5%
distribute-lft-in90.5%
metadata-eval90.5%
associate-*r/90.5%
metadata-eval90.5%
*-commutative90.5%
Simplified90.5%
Taylor expanded in x around 0 45.9%
sub-neg45.9%
associate-*r/45.9%
metadata-eval45.9%
+-commutative45.9%
associate-*r/45.9%
metadata-eval45.9%
metadata-eval45.9%
Simplified45.9%
Taylor expanded in t around inf 31.4%
if -2.80000000000000015e-10 < t < 2.7500000000000001e-5Initial program 98.1%
Taylor expanded in t around 0 79.1%
associate-*r/79.1%
metadata-eval79.1%
Simplified79.1%
Taylor expanded in z around inf 33.6%
Final simplification32.4%
(FPCore (x y z t) :precision binary64 -2.0)
double code(double x, double y, double z, double t) {
return -2.0;
}
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
end function
public static double code(double x, double y, double z, double t) {
return -2.0;
}
def code(x, y, z, t): return -2.0
function code(x, y, z, t) return -2.0 end
function tmp = code(x, y, z, t) tmp = -2.0; end
code[x_, y_, z_, t_] := -2.0
\begin{array}{l}
\\
-2
\end{array}
Initial program 88.5%
Taylor expanded in x around inf 80.9%
associate-/r*82.9%
associate-*r/82.9%
*-commutative82.9%
*-commutative82.9%
div-sub82.9%
sub-neg82.9%
*-inverses82.9%
metadata-eval82.9%
distribute-lft-in82.9%
metadata-eval82.9%
associate-*r/82.9%
metadata-eval82.9%
*-commutative82.9%
Simplified82.9%
Taylor expanded in x around 0 61.6%
sub-neg61.6%
associate-*r/61.6%
metadata-eval61.6%
+-commutative61.6%
associate-*r/61.6%
metadata-eval61.6%
metadata-eval61.6%
Simplified61.6%
Taylor expanded in t around inf 17.8%
Final simplification17.8%
(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 2024076
(FPCore (x y z t)
:name "Data.HashTable.ST.Basic:computeOverhead from hashtables-1.2.0.2"
:precision binary64
:alt
(- (/ (+ (/ 2.0 z) 2.0) t) (- 2.0 (/ x y)))
(+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))