
(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 10 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 (+ (/ x y) (+ -2.0 (/ (+ 2.0 (/ 2.0 z)) t))))
double code(double x, double y, double z, double t) {
return (x / y) + (-2.0 + ((2.0 + (2.0 / z)) / t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x / y) + ((-2.0d0) + ((2.0d0 + (2.0d0 / z)) / t))
end function
public static double code(double x, double y, double z, double t) {
return (x / y) + (-2.0 + ((2.0 + (2.0 / z)) / t));
}
def code(x, y, z, t): return (x / y) + (-2.0 + ((2.0 + (2.0 / z)) / t))
function code(x, y, z, t) return Float64(Float64(x / y) + Float64(-2.0 + Float64(Float64(2.0 + Float64(2.0 / z)) / t))) end
function tmp = code(x, y, z, t) tmp = (x / y) + (-2.0 + ((2.0 + (2.0 / z)) / t)); end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] + N[(-2.0 + N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} + \left(-2 + \frac{2 + \frac{2}{z}}{t}\right)
\end{array}
Initial program 83.8%
Taylor expanded in t around 0 99.9%
associate--l+99.9%
associate-*r/99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around 0 99.9%
associate--l+99.9%
associate-*r/99.9%
metadata-eval99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
associate-+r+99.9%
+-commutative99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
metadata-eval99.9%
associate-*l/99.9%
metadata-eval99.9%
associate-*l/99.9%
associate-/r/99.9%
associate-/l*99.9%
metadata-eval99.9%
associate-*r/99.9%
associate-/r/99.9%
distribute-lft-in99.9%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ 2.0 (/ 2.0 z)) t)) (t_2 (+ (/ x y) (+ -2.0 (/ 2.0 t)))))
(if (<= z -3.35e-46)
t_2
(if (<= z -5.6e-66)
t_1
(if (<= z -8e-102) (+ (/ x y) -2.0) (if (<= z 3.6e-51) 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 + (2.0 / t));
double tmp;
if (z <= -3.35e-46) {
tmp = t_2;
} else if (z <= -5.6e-66) {
tmp = t_1;
} else if (z <= -8e-102) {
tmp = (x / y) + -2.0;
} else if (z <= 3.6e-51) {
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) + (2.0d0 / t))
if (z <= (-3.35d-46)) then
tmp = t_2
else if (z <= (-5.6d-66)) then
tmp = t_1
else if (z <= (-8d-102)) then
tmp = (x / y) + (-2.0d0)
else if (z <= 3.6d-51) 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 + (2.0 / t));
double tmp;
if (z <= -3.35e-46) {
tmp = t_2;
} else if (z <= -5.6e-66) {
tmp = t_1;
} else if (z <= -8e-102) {
tmp = (x / y) + -2.0;
} else if (z <= 3.6e-51) {
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 + (2.0 / t)) tmp = 0 if z <= -3.35e-46: tmp = t_2 elif z <= -5.6e-66: tmp = t_1 elif z <= -8e-102: tmp = (x / y) + -2.0 elif z <= 3.6e-51: 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) + Float64(-2.0 + Float64(2.0 / t))) tmp = 0.0 if (z <= -3.35e-46) tmp = t_2; elseif (z <= -5.6e-66) tmp = t_1; elseif (z <= -8e-102) tmp = Float64(Float64(x / y) + -2.0); elseif (z <= 3.6e-51) 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 + (2.0 / t)); tmp = 0.0; if (z <= -3.35e-46) tmp = t_2; elseif (z <= -5.6e-66) tmp = t_1; elseif (z <= -8e-102) tmp = (x / y) + -2.0; elseif (z <= 3.6e-51) 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] + N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.35e-46], t$95$2, If[LessEqual[z, -5.6e-66], t$95$1, If[LessEqual[z, -8e-102], N[(N[(x / y), $MachinePrecision] + -2.0), $MachinePrecision], If[LessEqual[z, 3.6e-51], 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} + \left(-2 + \frac{2}{t}\right)\\
\mathbf{if}\;z \leq -3.35 \cdot 10^{-46}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -5.6 \cdot 10^{-66}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -8 \cdot 10^{-102}:\\
\;\;\;\;\frac{x}{y} + -2\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{-51}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -3.35e-46 or 3.6e-51 < z Initial program 73.9%
Taylor expanded in t around 0 100.0%
associate--l+100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around inf 95.7%
sub-neg95.7%
associate-*r/95.7%
metadata-eval95.7%
metadata-eval95.7%
+-commutative95.7%
Simplified95.7%
if -3.35e-46 < z < -5.6000000000000001e-66 or -7.99999999999999946e-102 < z < 3.6e-51Initial program 99.8%
Taylor expanded in t around 0 69.2%
associate-*r/69.2%
metadata-eval69.2%
Simplified69.2%
if -5.6000000000000001e-66 < z < -7.99999999999999946e-102Initial program 100.0%
Taylor expanded in t around inf 94.2%
Final simplification86.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ 2.0 (/ 2.0 z)) t)) (t_2 (+ (/ x y) -2.0)))
(if (<= t -1.35e-9)
t_2
(if (<= t 3.4e-113)
t_1
(if (<= t 4.2e-52)
(+ (/ x y) (/ 2.0 t))
(if (<= t 1080000000.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 <= -1.35e-9) {
tmp = t_2;
} else if (t <= 3.4e-113) {
tmp = t_1;
} else if (t <= 4.2e-52) {
tmp = (x / y) + (2.0 / t);
} else if (t <= 1080000000.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 <= (-1.35d-9)) then
tmp = t_2
else if (t <= 3.4d-113) then
tmp = t_1
else if (t <= 4.2d-52) then
tmp = (x / y) + (2.0d0 / t)
else if (t <= 1080000000.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 <= -1.35e-9) {
tmp = t_2;
} else if (t <= 3.4e-113) {
tmp = t_1;
} else if (t <= 4.2e-52) {
tmp = (x / y) + (2.0 / t);
} else if (t <= 1080000000.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 <= -1.35e-9: tmp = t_2 elif t <= 3.4e-113: tmp = t_1 elif t <= 4.2e-52: tmp = (x / y) + (2.0 / t) elif t <= 1080000000.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 <= -1.35e-9) tmp = t_2; elseif (t <= 3.4e-113) tmp = t_1; elseif (t <= 4.2e-52) tmp = Float64(Float64(x / y) + Float64(2.0 / t)); elseif (t <= 1080000000.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 <= -1.35e-9) tmp = t_2; elseif (t <= 3.4e-113) tmp = t_1; elseif (t <= 4.2e-52) tmp = (x / y) + (2.0 / t); elseif (t <= 1080000000.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, -1.35e-9], t$95$2, If[LessEqual[t, 3.4e-113], t$95$1, If[LessEqual[t, 4.2e-52], N[(N[(x / y), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1080000000.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 -1.35 \cdot 10^{-9}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq 3.4 \cdot 10^{-113}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 4.2 \cdot 10^{-52}:\\
\;\;\;\;\frac{x}{y} + \frac{2}{t}\\
\mathbf{elif}\;t \leq 1080000000:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if t < -1.3500000000000001e-9 or 1.08e9 < t Initial program 71.4%
Taylor expanded in t around inf 82.6%
if -1.3500000000000001e-9 < t < 3.4000000000000002e-113 or 4.1999999999999997e-52 < t < 1.08e9Initial program 99.7%
Taylor expanded in t around 0 79.9%
associate-*r/79.9%
metadata-eval79.9%
Simplified79.9%
if 3.4000000000000002e-113 < t < 4.1999999999999997e-52Initial program 99.9%
Taylor expanded in t around 0 99.9%
associate--l+99.9%
associate-*r/99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around 0 99.9%
associate--l+99.9%
associate-*r/99.9%
metadata-eval99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
associate-+r+99.9%
+-commutative99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
metadata-eval99.9%
associate-*l/99.9%
metadata-eval99.9%
associate-*l/99.9%
associate-/r/99.9%
associate-/l*99.9%
metadata-eval99.9%
associate-*r/99.9%
associate-/r/99.9%
distribute-lft-in99.9%
Simplified99.9%
Taylor expanded in z around inf 75.8%
sub-neg75.8%
associate-*r/75.8%
metadata-eval75.8%
metadata-eval75.8%
Simplified75.8%
Taylor expanded in t around 0 75.8%
Final simplification81.1%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -45000000000000.0) (/ x y) (if (<= (/ x y) -2.5e-28) (/ 2.0 t) (if (<= (/ x y) 0.027) -2.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -45000000000000.0) {
tmp = x / y;
} else if ((x / y) <= -2.5e-28) {
tmp = 2.0 / t;
} else if ((x / y) <= 0.027) {
tmp = -2.0;
} else {
tmp = x / y;
}
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) <= (-45000000000000.0d0)) then
tmp = x / y
else if ((x / y) <= (-2.5d-28)) then
tmp = 2.0d0 / t
else if ((x / y) <= 0.027d0) then
tmp = -2.0d0
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -45000000000000.0) {
tmp = x / y;
} else if ((x / y) <= -2.5e-28) {
tmp = 2.0 / t;
} else if ((x / y) <= 0.027) {
tmp = -2.0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -45000000000000.0: tmp = x / y elif (x / y) <= -2.5e-28: tmp = 2.0 / t elif (x / y) <= 0.027: tmp = -2.0 else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -45000000000000.0) tmp = Float64(x / y); elseif (Float64(x / y) <= -2.5e-28) tmp = Float64(2.0 / t); elseif (Float64(x / y) <= 0.027) tmp = -2.0; else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -45000000000000.0) tmp = x / y; elseif ((x / y) <= -2.5e-28) tmp = 2.0 / t; elseif ((x / y) <= 0.027) tmp = -2.0; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -45000000000000.0], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], -2.5e-28], N[(2.0 / t), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 0.027], -2.0, N[(x / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -45000000000000:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq -2.5 \cdot 10^{-28}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{elif}\;\frac{x}{y} \leq 0.027:\\
\;\;\;\;-2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -4.5e13 or 0.0269999999999999997 < (/.f64 x y) Initial program 84.5%
Taylor expanded in x around inf 73.2%
if -4.5e13 < (/.f64 x y) < -2.5000000000000001e-28Initial program 88.4%
Taylor expanded in t around 0 78.3%
associate-*r/78.3%
metadata-eval78.3%
Simplified78.3%
div-inv78.1%
Applied egg-rr78.1%
Taylor expanded in z around inf 57.1%
if -2.5000000000000001e-28 < (/.f64 x y) < 0.0269999999999999997Initial program 82.8%
Taylor expanded in z around inf 64.3%
div-sub64.4%
sub-neg64.4%
*-inverses64.4%
metadata-eval64.4%
Simplified64.4%
Taylor expanded in x around 0 64.1%
Taylor expanded in t around inf 43.0%
Final simplification58.0%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -15500000000000.0) (not (<= (/ x y) 9.6e-18))) (+ (/ x y) -2.0) (* 2.0 (+ (/ 1.0 t) -1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -15500000000000.0) || !((x / y) <= 9.6e-18)) {
tmp = (x / y) + -2.0;
} else {
tmp = 2.0 * ((1.0 / t) + -1.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) <= (-15500000000000.0d0)) .or. (.not. ((x / y) <= 9.6d-18))) then
tmp = (x / y) + (-2.0d0)
else
tmp = 2.0d0 * ((1.0d0 / t) + (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -15500000000000.0) || !((x / y) <= 9.6e-18)) {
tmp = (x / y) + -2.0;
} else {
tmp = 2.0 * ((1.0 / t) + -1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -15500000000000.0) or not ((x / y) <= 9.6e-18): tmp = (x / y) + -2.0 else: tmp = 2.0 * ((1.0 / t) + -1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -15500000000000.0) || !(Float64(x / y) <= 9.6e-18)) tmp = Float64(Float64(x / y) + -2.0); else tmp = Float64(2.0 * Float64(Float64(1.0 / t) + -1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -15500000000000.0) || ~(((x / y) <= 9.6e-18))) tmp = (x / y) + -2.0; else tmp = 2.0 * ((1.0 / t) + -1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -15500000000000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 9.6e-18]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + -2.0), $MachinePrecision], N[(2.0 * N[(N[(1.0 / t), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -15500000000000 \lor \neg \left(\frac{x}{y} \leq 9.6 \cdot 10^{-18}\right):\\
\;\;\;\;\frac{x}{y} + -2\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\frac{1}{t} + -1\right)\\
\end{array}
\end{array}
if (/.f64 x y) < -1.55e13 or 9.59999999999999976e-18 < (/.f64 x y) Initial program 83.4%
Taylor expanded in t around inf 74.0%
if -1.55e13 < (/.f64 x y) < 9.59999999999999976e-18Initial program 84.2%
Taylor expanded in z around inf 65.8%
div-sub65.8%
sub-neg65.8%
*-inverses65.8%
metadata-eval65.8%
Simplified65.8%
Taylor expanded in x around 0 64.5%
Final simplification69.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.65e-35) (not (<= z 4.1e-10))) (+ (/ 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 <= -1.65e-35) || !(z <= 4.1e-10)) {
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 <= (-1.65d-35)) .or. (.not. (z <= 4.1d-10))) 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 <= -1.65e-35) || !(z <= 4.1e-10)) {
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 <= -1.65e-35) or not (z <= 4.1e-10): 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 <= -1.65e-35) || !(z <= 4.1e-10)) 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 <= -1.65e-35) || ~((z <= 4.1e-10))) 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, -1.65e-35], N[Not[LessEqual[z, 4.1e-10]], $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 -1.65 \cdot 10^{-35} \lor \neg \left(z \leq 4.1 \cdot 10^{-10}\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 < -1.65e-35 or 4.0999999999999998e-10 < z Initial program 71.8%
Taylor expanded in t around 0 100.0%
associate--l+100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around inf 98.0%
sub-neg98.0%
associate-*r/98.0%
metadata-eval98.0%
metadata-eval98.0%
+-commutative98.0%
Simplified98.0%
if -1.65e-35 < z < 4.0999999999999998e-10Initial program 99.8%
Taylor expanded in z around 0 91.7%
Final simplification95.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -8e+24) (not (<= t 0.095))) (+ (/ x y) -2.0) (+ (/ x y) (/ 2.0 t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -8e+24) || !(t <= 0.095)) {
tmp = (x / y) + -2.0;
} else {
tmp = (x / y) + (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 <= (-8d+24)) .or. (.not. (t <= 0.095d0))) then
tmp = (x / y) + (-2.0d0)
else
tmp = (x / y) + (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 <= -8e+24) || !(t <= 0.095)) {
tmp = (x / y) + -2.0;
} else {
tmp = (x / y) + (2.0 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -8e+24) or not (t <= 0.095): tmp = (x / y) + -2.0 else: tmp = (x / y) + (2.0 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -8e+24) || !(t <= 0.095)) tmp = Float64(Float64(x / y) + -2.0); else tmp = Float64(Float64(x / y) + Float64(2.0 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -8e+24) || ~((t <= 0.095))) tmp = (x / y) + -2.0; else tmp = (x / y) + (2.0 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -8e+24], N[Not[LessEqual[t, 0.095]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + -2.0), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{+24} \lor \neg \left(t \leq 0.095\right):\\
\;\;\;\;\frac{x}{y} + -2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{2}{t}\\
\end{array}
\end{array}
if t < -7.9999999999999999e24 or 0.095000000000000001 < t Initial program 71.0%
Taylor expanded in t around inf 81.2%
if -7.9999999999999999e24 < t < 0.095000000000000001Initial program 99.7%
Taylor expanded in t around 0 99.9%
associate--l+99.9%
associate-*r/99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around 0 99.9%
associate--l+99.9%
associate-*r/99.9%
metadata-eval99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
associate-+r+99.9%
+-commutative99.9%
+-commutative99.9%
+-commutative99.9%
associate-+l+99.9%
metadata-eval99.9%
associate-*l/99.9%
metadata-eval99.9%
associate-*l/99.9%
associate-/r/99.9%
associate-/l*99.9%
metadata-eval99.9%
associate-*r/99.9%
associate-/r/99.9%
distribute-lft-in99.9%
Simplified99.9%
Taylor expanded in z around inf 62.4%
sub-neg62.4%
associate-*r/62.4%
metadata-eval62.4%
metadata-eval62.4%
Simplified62.4%
Taylor expanded in t around 0 61.3%
Final simplification72.4%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.85e-123) (not (<= t 3.4e-132))) (+ (/ x y) -2.0) (/ 2.0 t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.85e-123) || !(t <= 3.4e-132)) {
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 <= (-2.85d-123)) .or. (.not. (t <= 3.4d-132))) 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 <= -2.85e-123) || !(t <= 3.4e-132)) {
tmp = (x / y) + -2.0;
} else {
tmp = 2.0 / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.85e-123) or not (t <= 3.4e-132): tmp = (x / y) + -2.0 else: tmp = 2.0 / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.85e-123) || !(t <= 3.4e-132)) 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 <= -2.85e-123) || ~((t <= 3.4e-132))) tmp = (x / y) + -2.0; else tmp = 2.0 / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.85e-123], N[Not[LessEqual[t, 3.4e-132]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + -2.0), $MachinePrecision], N[(2.0 / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.85 \cdot 10^{-123} \lor \neg \left(t \leq 3.4 \cdot 10^{-132}\right):\\
\;\;\;\;\frac{x}{y} + -2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t}\\
\end{array}
\end{array}
if t < -2.85000000000000014e-123 or 3.39999999999999983e-132 < t Initial program 79.1%
Taylor expanded in t around inf 70.3%
if -2.85000000000000014e-123 < t < 3.39999999999999983e-132Initial program 99.7%
Taylor expanded in t around 0 88.7%
associate-*r/88.7%
metadata-eval88.7%
Simplified88.7%
div-inv88.7%
Applied egg-rr88.7%
Taylor expanded in z around inf 45.5%
Final simplification64.7%
(FPCore (x y z t) :precision binary64 (if (<= t -8.2e-8) -2.0 (if (<= t 0.095) (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -8.2e-8) {
tmp = -2.0;
} else if (t <= 0.095) {
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 <= (-8.2d-8)) then
tmp = -2.0d0
else if (t <= 0.095d0) 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 <= -8.2e-8) {
tmp = -2.0;
} else if (t <= 0.095) {
tmp = 2.0 / t;
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -8.2e-8: tmp = -2.0 elif t <= 0.095: tmp = 2.0 / t else: tmp = -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -8.2e-8) tmp = -2.0; elseif (t <= 0.095) 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 <= -8.2e-8) tmp = -2.0; elseif (t <= 0.095) tmp = 2.0 / t; else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -8.2e-8], -2.0, If[LessEqual[t, 0.095], N[(2.0 / t), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.2 \cdot 10^{-8}:\\
\;\;\;\;-2\\
\mathbf{elif}\;t \leq 0.095:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if t < -8.20000000000000063e-8 or 0.095000000000000001 < t Initial program 72.4%
Taylor expanded in z around inf 80.6%
div-sub80.6%
sub-neg80.6%
*-inverses80.6%
metadata-eval80.6%
Simplified80.6%
Taylor expanded in x around 0 37.1%
Taylor expanded in t around inf 36.6%
if -8.20000000000000063e-8 < t < 0.095000000000000001Initial program 99.7%
Taylor expanded in t around 0 74.4%
associate-*r/74.4%
metadata-eval74.4%
Simplified74.4%
div-inv74.4%
Applied egg-rr74.4%
Taylor expanded in z around inf 36.3%
Final simplification36.5%
(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 83.8%
Taylor expanded in z around inf 73.1%
div-sub73.1%
sub-neg73.1%
*-inverses73.1%
metadata-eval73.1%
Simplified73.1%
Taylor expanded in x around 0 37.3%
Taylor expanded in t around inf 22.4%
Final simplification22.4%
(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 2023275
(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))))