
(FPCore (t) :precision binary64 (let* ((t_1 (- 2.0 (/ (/ 2.0 t) (+ 1.0 (/ 1.0 t)))))) (- 1.0 (/ 1.0 (+ 2.0 (* t_1 t_1))))))
double code(double t) {
double t_1 = 2.0 - ((2.0 / t) / (1.0 + (1.0 / t)));
return 1.0 - (1.0 / (2.0 + (t_1 * t_1)));
}
real(8) function code(t)
real(8), intent (in) :: t
real(8) :: t_1
t_1 = 2.0d0 - ((2.0d0 / t) / (1.0d0 + (1.0d0 / t)))
code = 1.0d0 - (1.0d0 / (2.0d0 + (t_1 * t_1)))
end function
public static double code(double t) {
double t_1 = 2.0 - ((2.0 / t) / (1.0 + (1.0 / t)));
return 1.0 - (1.0 / (2.0 + (t_1 * t_1)));
}
def code(t): t_1 = 2.0 - ((2.0 / t) / (1.0 + (1.0 / t))) return 1.0 - (1.0 / (2.0 + (t_1 * t_1)))
function code(t) t_1 = Float64(2.0 - Float64(Float64(2.0 / t) / Float64(1.0 + Float64(1.0 / t)))) return Float64(1.0 - Float64(1.0 / Float64(2.0 + Float64(t_1 * t_1)))) end
function tmp = code(t) t_1 = 2.0 - ((2.0 / t) / (1.0 + (1.0 / t))); tmp = 1.0 - (1.0 / (2.0 + (t_1 * t_1))); end
code[t_] := Block[{t$95$1 = N[(2.0 - N[(N[(2.0 / t), $MachinePrecision] / N[(1.0 + N[(1.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(1.0 - N[(1.0 / N[(2.0 + N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 - \frac{\frac{2}{t}}{1 + \frac{1}{t}}\\
1 - \frac{1}{2 + t\_1 \cdot t\_1}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (t) :precision binary64 (let* ((t_1 (- 2.0 (/ (/ 2.0 t) (+ 1.0 (/ 1.0 t)))))) (- 1.0 (/ 1.0 (+ 2.0 (* t_1 t_1))))))
double code(double t) {
double t_1 = 2.0 - ((2.0 / t) / (1.0 + (1.0 / t)));
return 1.0 - (1.0 / (2.0 + (t_1 * t_1)));
}
real(8) function code(t)
real(8), intent (in) :: t
real(8) :: t_1
t_1 = 2.0d0 - ((2.0d0 / t) / (1.0d0 + (1.0d0 / t)))
code = 1.0d0 - (1.0d0 / (2.0d0 + (t_1 * t_1)))
end function
public static double code(double t) {
double t_1 = 2.0 - ((2.0 / t) / (1.0 + (1.0 / t)));
return 1.0 - (1.0 / (2.0 + (t_1 * t_1)));
}
def code(t): t_1 = 2.0 - ((2.0 / t) / (1.0 + (1.0 / t))) return 1.0 - (1.0 / (2.0 + (t_1 * t_1)))
function code(t) t_1 = Float64(2.0 - Float64(Float64(2.0 / t) / Float64(1.0 + Float64(1.0 / t)))) return Float64(1.0 - Float64(1.0 / Float64(2.0 + Float64(t_1 * t_1)))) end
function tmp = code(t) t_1 = 2.0 - ((2.0 / t) / (1.0 + (1.0 / t))); tmp = 1.0 - (1.0 / (2.0 + (t_1 * t_1))); end
code[t_] := Block[{t$95$1 = N[(2.0 - N[(N[(2.0 / t), $MachinePrecision] / N[(1.0 + N[(1.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(1.0 - N[(1.0 / N[(2.0 + N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 - \frac{\frac{2}{t}}{1 + \frac{1}{t}}\\
1 - \frac{1}{2 + t\_1 \cdot t\_1}
\end{array}
\end{array}
(FPCore (t) :precision binary64 (let* ((t_1 (- 2.0 (/ (/ 2.0 t) (+ 1.0 (/ 1.0 t)))))) (- 1.0 (/ 1.0 (+ 2.0 (* t_1 t_1))))))
double code(double t) {
double t_1 = 2.0 - ((2.0 / t) / (1.0 + (1.0 / t)));
return 1.0 - (1.0 / (2.0 + (t_1 * t_1)));
}
real(8) function code(t)
real(8), intent (in) :: t
real(8) :: t_1
t_1 = 2.0d0 - ((2.0d0 / t) / (1.0d0 + (1.0d0 / t)))
code = 1.0d0 - (1.0d0 / (2.0d0 + (t_1 * t_1)))
end function
public static double code(double t) {
double t_1 = 2.0 - ((2.0 / t) / (1.0 + (1.0 / t)));
return 1.0 - (1.0 / (2.0 + (t_1 * t_1)));
}
def code(t): t_1 = 2.0 - ((2.0 / t) / (1.0 + (1.0 / t))) return 1.0 - (1.0 / (2.0 + (t_1 * t_1)))
function code(t) t_1 = Float64(2.0 - Float64(Float64(2.0 / t) / Float64(1.0 + Float64(1.0 / t)))) return Float64(1.0 - Float64(1.0 / Float64(2.0 + Float64(t_1 * t_1)))) end
function tmp = code(t) t_1 = 2.0 - ((2.0 / t) / (1.0 + (1.0 / t))); tmp = 1.0 - (1.0 / (2.0 + (t_1 * t_1))); end
code[t_] := Block[{t$95$1 = N[(2.0 - N[(N[(2.0 / t), $MachinePrecision] / N[(1.0 + N[(1.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(1.0 - N[(1.0 / N[(2.0 + N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 - \frac{\frac{2}{t}}{1 + \frac{1}{t}}\\
1 - \frac{1}{2 + t\_1 \cdot t\_1}
\end{array}
\end{array}
Initial program 100.0%
(FPCore (t) :precision binary64 (let* ((t_1 (/ (/ 2.0 t) (+ 1.0 (/ 1.0 t)))) (t_2 (- 2.0 t_1))) (if (<= t_1 0.1) (/ 1.0 (+ 2.0 (- 1.0 t_2))) (/ 1.0 (+ 2.0 (* t_2 t_2))))))
double code(double t) {
double t_1 = (2.0 / t) / (1.0 + (1.0 / t));
double t_2 = 2.0 - t_1;
double tmp;
if (t_1 <= 0.1) {
tmp = 1.0 / (2.0 + (1.0 - t_2));
} else {
tmp = 1.0 / (2.0 + (t_2 * t_2));
}
return tmp;
}
real(8) function code(t)
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (2.0d0 / t) / (1.0d0 + (1.0d0 / t))
t_2 = 2.0d0 - t_1
if (t_1 <= 0.1d0) then
tmp = 1.0d0 / (2.0d0 + (1.0d0 - t_2))
else
tmp = 1.0d0 / (2.0d0 + (t_2 * t_2))
end if
code = tmp
end function
public static double code(double t) {
double t_1 = (2.0 / t) / (1.0 + (1.0 / t));
double t_2 = 2.0 - t_1;
double tmp;
if (t_1 <= 0.1) {
tmp = 1.0 / (2.0 + (1.0 - t_2));
} else {
tmp = 1.0 / (2.0 + (t_2 * t_2));
}
return tmp;
}
def code(t): t_1 = (2.0 / t) / (1.0 + (1.0 / t)) t_2 = 2.0 - t_1 tmp = 0 if t_1 <= 0.1: tmp = 1.0 / (2.0 + (1.0 - t_2)) else: tmp = 1.0 / (2.0 + (t_2 * t_2)) return tmp
function code(t) t_1 = Float64(Float64(2.0 / t) / Float64(1.0 + Float64(1.0 / t))) t_2 = Float64(2.0 - t_1) tmp = 0.0 if (t_1 <= 0.1) tmp = Float64(1.0 / Float64(2.0 + Float64(1.0 - t_2))); else tmp = Float64(1.0 / Float64(2.0 + Float64(t_2 * t_2))); end return tmp end
function tmp_2 = code(t) t_1 = (2.0 / t) / (1.0 + (1.0 / t)); t_2 = 2.0 - t_1; tmp = 0.0; if (t_1 <= 0.1) tmp = 1.0 / (2.0 + (1.0 - t_2)); else tmp = 1.0 / (2.0 + (t_2 * t_2)); end tmp_2 = tmp; end
code[t_] := Block[{t$95$1 = N[(N[(2.0 / t), $MachinePrecision] / N[(1.0 + N[(1.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 - t$95$1), $MachinePrecision]}, If[LessEqual[t$95$1, 0.1], N[(1.0 / N[(2.0 + N[(1.0 - t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(2.0 + N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{2}{t}}{1 + \frac{1}{t}}\\
t_2 := 2 - t\_1\\
\mathbf{if}\;t\_1 \leq 0.1:\\
\;\;\;\;\frac{1}{2 + \left(1 - t\_2\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2 + t\_2 \cdot t\_2}\\
\end{array}
\end{array}
if (/.f64 (/.f64 #s(literal 2 binary64) t) (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) t))) < 0.10000000000000001Initial program 100.0%
Taylor expanded in t around 0
Applied rewrites16.8%
Taylor expanded in t around 0
Applied rewrites21.2%
if 0.10000000000000001 < (/.f64 (/.f64 #s(literal 2 binary64) t) (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) t))) Initial program 100.0%
Taylor expanded in t around 0
Applied rewrites98.2%
(FPCore (t) :precision binary64 (let* ((t_1 (- 2.0 (/ (/ 2.0 t) (+ 1.0 (/ 1.0 t))))) (t_2 (- 1.0 t_1))) (if (<= t_1 0.002) (/ 1.0 (+ 2.0 (- 1.0 t_2))) (/ 1.0 (+ 2.0 t_2)))))
double code(double t) {
double t_1 = 2.0 - ((2.0 / t) / (1.0 + (1.0 / t)));
double t_2 = 1.0 - t_1;
double tmp;
if (t_1 <= 0.002) {
tmp = 1.0 / (2.0 + (1.0 - t_2));
} else {
tmp = 1.0 / (2.0 + t_2);
}
return tmp;
}
real(8) function code(t)
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = 2.0d0 - ((2.0d0 / t) / (1.0d0 + (1.0d0 / t)))
t_2 = 1.0d0 - t_1
if (t_1 <= 0.002d0) then
tmp = 1.0d0 / (2.0d0 + (1.0d0 - t_2))
else
tmp = 1.0d0 / (2.0d0 + t_2)
end if
code = tmp
end function
public static double code(double t) {
double t_1 = 2.0 - ((2.0 / t) / (1.0 + (1.0 / t)));
double t_2 = 1.0 - t_1;
double tmp;
if (t_1 <= 0.002) {
tmp = 1.0 / (2.0 + (1.0 - t_2));
} else {
tmp = 1.0 / (2.0 + t_2);
}
return tmp;
}
def code(t): t_1 = 2.0 - ((2.0 / t) / (1.0 + (1.0 / t))) t_2 = 1.0 - t_1 tmp = 0 if t_1 <= 0.002: tmp = 1.0 / (2.0 + (1.0 - t_2)) else: tmp = 1.0 / (2.0 + t_2) return tmp
function code(t) t_1 = Float64(2.0 - Float64(Float64(2.0 / t) / Float64(1.0 + Float64(1.0 / t)))) t_2 = Float64(1.0 - t_1) tmp = 0.0 if (t_1 <= 0.002) tmp = Float64(1.0 / Float64(2.0 + Float64(1.0 - t_2))); else tmp = Float64(1.0 / Float64(2.0 + t_2)); end return tmp end
function tmp_2 = code(t) t_1 = 2.0 - ((2.0 / t) / (1.0 + (1.0 / t))); t_2 = 1.0 - t_1; tmp = 0.0; if (t_1 <= 0.002) tmp = 1.0 / (2.0 + (1.0 - t_2)); else tmp = 1.0 / (2.0 + t_2); end tmp_2 = tmp; end
code[t_] := Block[{t$95$1 = N[(2.0 - N[(N[(2.0 / t), $MachinePrecision] / N[(1.0 + N[(1.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - t$95$1), $MachinePrecision]}, If[LessEqual[t$95$1, 0.002], N[(1.0 / N[(2.0 + N[(1.0 - t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(2.0 + t$95$2), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 - \frac{\frac{2}{t}}{1 + \frac{1}{t}}\\
t_2 := 1 - t\_1\\
\mathbf{if}\;t\_1 \leq 0.002:\\
\;\;\;\;\frac{1}{2 + \left(1 - t\_2\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2 + t\_2}\\
\end{array}
\end{array}
if (-.f64 #s(literal 2 binary64) (/.f64 (/.f64 #s(literal 2 binary64) t) (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) t)))) < 2e-3Initial program 100.0%
Taylor expanded in t around 0
Applied rewrites98.2%
Taylor expanded in t around 0
Applied rewrites19.7%
Taylor expanded in t around 0
Applied rewrites96.7%
if 2e-3 < (-.f64 #s(literal 2 binary64) (/.f64 (/.f64 #s(literal 2 binary64) t) (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) t)))) Initial program 100.0%
Taylor expanded in t around 0
Applied rewrites16.8%
Taylor expanded in t around 0
Applied rewrites21.2%
(FPCore (t) :precision binary64 (let* ((t_1 (+ 1.0 (/ 1.0 t))) (t_2 (- 2.0 (/ (/ 2.0 t) t_1)))) (if (<= t_2 0.002) (- 1.0 t_2) (- 2.0 t_1))))
double code(double t) {
double t_1 = 1.0 + (1.0 / t);
double t_2 = 2.0 - ((2.0 / t) / t_1);
double tmp;
if (t_2 <= 0.002) {
tmp = 1.0 - t_2;
} else {
tmp = 2.0 - t_1;
}
return tmp;
}
real(8) function code(t)
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = 1.0d0 + (1.0d0 / t)
t_2 = 2.0d0 - ((2.0d0 / t) / t_1)
if (t_2 <= 0.002d0) then
tmp = 1.0d0 - t_2
else
tmp = 2.0d0 - t_1
end if
code = tmp
end function
public static double code(double t) {
double t_1 = 1.0 + (1.0 / t);
double t_2 = 2.0 - ((2.0 / t) / t_1);
double tmp;
if (t_2 <= 0.002) {
tmp = 1.0 - t_2;
} else {
tmp = 2.0 - t_1;
}
return tmp;
}
def code(t): t_1 = 1.0 + (1.0 / t) t_2 = 2.0 - ((2.0 / t) / t_1) tmp = 0 if t_2 <= 0.002: tmp = 1.0 - t_2 else: tmp = 2.0 - t_1 return tmp
function code(t) t_1 = Float64(1.0 + Float64(1.0 / t)) t_2 = Float64(2.0 - Float64(Float64(2.0 / t) / t_1)) tmp = 0.0 if (t_2 <= 0.002) tmp = Float64(1.0 - t_2); else tmp = Float64(2.0 - t_1); end return tmp end
function tmp_2 = code(t) t_1 = 1.0 + (1.0 / t); t_2 = 2.0 - ((2.0 / t) / t_1); tmp = 0.0; if (t_2 <= 0.002) tmp = 1.0 - t_2; else tmp = 2.0 - t_1; end tmp_2 = tmp; end
code[t_] := Block[{t$95$1 = N[(1.0 + N[(1.0 / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 - N[(N[(2.0 / t), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 0.002], N[(1.0 - t$95$2), $MachinePrecision], N[(2.0 - t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 + \frac{1}{t}\\
t_2 := 2 - \frac{\frac{2}{t}}{t\_1}\\
\mathbf{if}\;t\_2 \leq 0.002:\\
\;\;\;\;1 - t\_2\\
\mathbf{else}:\\
\;\;\;\;2 - t\_1\\
\end{array}
\end{array}
if (-.f64 #s(literal 2 binary64) (/.f64 (/.f64 #s(literal 2 binary64) t) (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) t)))) < 2e-3Initial program 100.0%
Taylor expanded in t around 0
Applied rewrites18.7%
if 2e-3 < (-.f64 #s(literal 2 binary64) (/.f64 (/.f64 #s(literal 2 binary64) t) (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) t)))) Initial program 100.0%
Taylor expanded in t around 0
Applied rewrites16.8%
Taylor expanded in t around 0
Applied rewrites18.1%
Taylor expanded in t around 0
Applied rewrites21.2%
(FPCore (t) :precision binary64 (let* ((t_1 (+ 1.0 (/ 1.0 t))) (t_2 (/ (/ 2.0 t) t_1))) (if (<= (- 2.0 t_2) 0.002) t_2 (- 2.0 t_1))))
double code(double t) {
double t_1 = 1.0 + (1.0 / t);
double t_2 = (2.0 / t) / t_1;
double tmp;
if ((2.0 - t_2) <= 0.002) {
tmp = t_2;
} else {
tmp = 2.0 - t_1;
}
return tmp;
}
real(8) function code(t)
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = 1.0d0 + (1.0d0 / t)
t_2 = (2.0d0 / t) / t_1
if ((2.0d0 - t_2) <= 0.002d0) then
tmp = t_2
else
tmp = 2.0d0 - t_1
end if
code = tmp
end function
public static double code(double t) {
double t_1 = 1.0 + (1.0 / t);
double t_2 = (2.0 / t) / t_1;
double tmp;
if ((2.0 - t_2) <= 0.002) {
tmp = t_2;
} else {
tmp = 2.0 - t_1;
}
return tmp;
}
def code(t): t_1 = 1.0 + (1.0 / t) t_2 = (2.0 / t) / t_1 tmp = 0 if (2.0 - t_2) <= 0.002: tmp = t_2 else: tmp = 2.0 - t_1 return tmp
function code(t) t_1 = Float64(1.0 + Float64(1.0 / t)) t_2 = Float64(Float64(2.0 / t) / t_1) tmp = 0.0 if (Float64(2.0 - t_2) <= 0.002) tmp = t_2; else tmp = Float64(2.0 - t_1); end return tmp end
function tmp_2 = code(t) t_1 = 1.0 + (1.0 / t); t_2 = (2.0 / t) / t_1; tmp = 0.0; if ((2.0 - t_2) <= 0.002) tmp = t_2; else tmp = 2.0 - t_1; end tmp_2 = tmp; end
code[t_] := Block[{t$95$1 = N[(1.0 + N[(1.0 / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(2.0 / t), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[N[(2.0 - t$95$2), $MachinePrecision], 0.002], t$95$2, N[(2.0 - t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 + \frac{1}{t}\\
t_2 := \frac{\frac{2}{t}}{t\_1}\\
\mathbf{if}\;2 - t\_2 \leq 0.002:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;2 - t\_1\\
\end{array}
\end{array}
if (-.f64 #s(literal 2 binary64) (/.f64 (/.f64 #s(literal 2 binary64) t) (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) t)))) < 2e-3Initial program 100.0%
Taylor expanded in t around 0
Applied rewrites3.8%
Taylor expanded in t around 0
Applied rewrites17.2%
if 2e-3 < (-.f64 #s(literal 2 binary64) (/.f64 (/.f64 #s(literal 2 binary64) t) (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) t)))) Initial program 100.0%
Taylor expanded in t around 0
Applied rewrites16.8%
Taylor expanded in t around 0
Applied rewrites18.1%
Taylor expanded in t around 0
Applied rewrites21.2%
(FPCore (t) :precision binary64 (/ 1.0 (+ 2.0 (- 1.0 (- 2.0 (/ (/ 2.0 t) (+ 1.0 (/ 1.0 t))))))))
double code(double t) {
return 1.0 / (2.0 + (1.0 - (2.0 - ((2.0 / t) / (1.0 + (1.0 / t))))));
}
real(8) function code(t)
real(8), intent (in) :: t
code = 1.0d0 / (2.0d0 + (1.0d0 - (2.0d0 - ((2.0d0 / t) / (1.0d0 + (1.0d0 / t))))))
end function
public static double code(double t) {
return 1.0 / (2.0 + (1.0 - (2.0 - ((2.0 / t) / (1.0 + (1.0 / t))))));
}
def code(t): return 1.0 / (2.0 + (1.0 - (2.0 - ((2.0 / t) / (1.0 + (1.0 / t))))))
function code(t) return Float64(1.0 / Float64(2.0 + Float64(1.0 - Float64(2.0 - Float64(Float64(2.0 / t) / Float64(1.0 + Float64(1.0 / t))))))) end
function tmp = code(t) tmp = 1.0 / (2.0 + (1.0 - (2.0 - ((2.0 / t) / (1.0 + (1.0 / t)))))); end
code[t_] := N[(1.0 / N[(2.0 + N[(1.0 - N[(2.0 - N[(N[(2.0 / t), $MachinePrecision] / N[(1.0 + N[(1.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{2 + \left(1 - \left(2 - \frac{\frac{2}{t}}{1 + \frac{1}{t}}\right)\right)}
\end{array}
Initial program 100.0%
Taylor expanded in t around 0
Applied rewrites56.9%
Taylor expanded in t around 0
Applied rewrites20.5%
(FPCore (t) :precision binary64 (+ 2.0 (- 1.0 (- 2.0 (/ (/ 2.0 t) (+ 1.0 (/ 1.0 t)))))))
double code(double t) {
return 2.0 + (1.0 - (2.0 - ((2.0 / t) / (1.0 + (1.0 / t)))));
}
real(8) function code(t)
real(8), intent (in) :: t
code = 2.0d0 + (1.0d0 - (2.0d0 - ((2.0d0 / t) / (1.0d0 + (1.0d0 / t)))))
end function
public static double code(double t) {
return 2.0 + (1.0 - (2.0 - ((2.0 / t) / (1.0 + (1.0 / t)))));
}
def code(t): return 2.0 + (1.0 - (2.0 - ((2.0 / t) / (1.0 + (1.0 / t)))))
function code(t) return Float64(2.0 + Float64(1.0 - Float64(2.0 - Float64(Float64(2.0 / t) / Float64(1.0 + Float64(1.0 / t)))))) end
function tmp = code(t) tmp = 2.0 + (1.0 - (2.0 - ((2.0 / t) / (1.0 + (1.0 / t))))); end
code[t_] := N[(2.0 + N[(1.0 - N[(2.0 - N[(N[(2.0 / t), $MachinePrecision] / N[(1.0 + N[(1.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 + \left(1 - \left(2 - \frac{\frac{2}{t}}{1 + \frac{1}{t}}\right)\right)
\end{array}
Initial program 100.0%
Taylor expanded in t around 0
Applied rewrites10.4%
Taylor expanded in t around 0
Applied rewrites10.9%
Taylor expanded in t around 0
Applied rewrites19.0%
(FPCore (t) :precision binary64 (/ 1.0 (- 2.0 (+ 1.0 (/ 1.0 t)))))
double code(double t) {
return 1.0 / (2.0 - (1.0 + (1.0 / t)));
}
real(8) function code(t)
real(8), intent (in) :: t
code = 1.0d0 / (2.0d0 - (1.0d0 + (1.0d0 / t)))
end function
public static double code(double t) {
return 1.0 / (2.0 - (1.0 + (1.0 / t)));
}
def code(t): return 1.0 / (2.0 - (1.0 + (1.0 / t)))
function code(t) return Float64(1.0 / Float64(2.0 - Float64(1.0 + Float64(1.0 / t)))) end
function tmp = code(t) tmp = 1.0 / (2.0 - (1.0 + (1.0 / t))); end
code[t_] := N[(1.0 / N[(2.0 - N[(1.0 + N[(1.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{2 - \left(1 + \frac{1}{t}\right)}
\end{array}
Initial program 100.0%
Taylor expanded in t around 0
Applied rewrites56.9%
Taylor expanded in t around 0
Applied rewrites20.5%
Taylor expanded in t around 0
Applied rewrites56.6%
Taylor expanded in t around 0
Applied rewrites12.8%
(FPCore (t) :precision binary64 (/ 1.0 (+ 1.0 (/ 1.0 t))))
double code(double t) {
return 1.0 / (1.0 + (1.0 / t));
}
real(8) function code(t)
real(8), intent (in) :: t
code = 1.0d0 / (1.0d0 + (1.0d0 / t))
end function
public static double code(double t) {
return 1.0 / (1.0 + (1.0 / t));
}
def code(t): return 1.0 / (1.0 + (1.0 / t))
function code(t) return Float64(1.0 / Float64(1.0 + Float64(1.0 / t))) end
function tmp = code(t) tmp = 1.0 / (1.0 + (1.0 / t)); end
code[t_] := N[(1.0 / N[(1.0 + N[(1.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{1 + \frac{1}{t}}
\end{array}
Initial program 100.0%
Taylor expanded in t around 0
Applied rewrites56.9%
Taylor expanded in t around 0
Applied rewrites20.5%
Taylor expanded in t around 0
Applied rewrites56.6%
Taylor expanded in t around 0
Applied rewrites12.7%
(FPCore (t) :precision binary64 (- 2.0 (+ 1.0 (/ 1.0 t))))
double code(double t) {
return 2.0 - (1.0 + (1.0 / t));
}
real(8) function code(t)
real(8), intent (in) :: t
code = 2.0d0 - (1.0d0 + (1.0d0 / t))
end function
public static double code(double t) {
return 2.0 - (1.0 + (1.0 / t));
}
def code(t): return 2.0 - (1.0 + (1.0 / t))
function code(t) return Float64(2.0 - Float64(1.0 + Float64(1.0 / t))) end
function tmp = code(t) tmp = 2.0 - (1.0 + (1.0 / t)); end
code[t_] := N[(2.0 - N[(1.0 + N[(1.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 - \left(1 + \frac{1}{t}\right)
\end{array}
Initial program 100.0%
Taylor expanded in t around 0
Applied rewrites10.4%
Taylor expanded in t around 0
Applied rewrites10.9%
Taylor expanded in t around 0
Applied rewrites12.5%
(FPCore (t) :precision binary64 (+ 1.0 (/ 1.0 t)))
double code(double t) {
return 1.0 + (1.0 / t);
}
real(8) function code(t)
real(8), intent (in) :: t
code = 1.0d0 + (1.0d0 / t)
end function
public static double code(double t) {
return 1.0 + (1.0 / t);
}
def code(t): return 1.0 + (1.0 / t)
function code(t) return Float64(1.0 + Float64(1.0 / t)) end
function tmp = code(t) tmp = 1.0 + (1.0 / t); end
code[t_] := N[(1.0 + N[(1.0 / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{1}{t}
\end{array}
Initial program 100.0%
Taylor expanded in t around 0
Applied rewrites10.4%
Taylor expanded in t around 0
Applied rewrites10.4%
Taylor expanded in t around 0
Applied rewrites12.4%
(FPCore (t) :precision binary64 (/ 2.0 t))
double code(double t) {
return 2.0 / t;
}
real(8) function code(t)
real(8), intent (in) :: t
code = 2.0d0 / t
end function
public static double code(double t) {
return 2.0 / t;
}
def code(t): return 2.0 / t
function code(t) return Float64(2.0 / t) end
function tmp = code(t) tmp = 2.0 / t; end
code[t_] := N[(2.0 / t), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{t}
\end{array}
Initial program 100.0%
Taylor expanded in t around 0
Applied rewrites10.4%
Taylor expanded in t around 0
Applied rewrites10.9%
Taylor expanded in t around 0
Applied rewrites3.6%
(FPCore (t) :precision binary64 (/ 1.0 t))
double code(double t) {
return 1.0 / t;
}
real(8) function code(t)
real(8), intent (in) :: t
code = 1.0d0 / t
end function
public static double code(double t) {
return 1.0 / t;
}
def code(t): return 1.0 / t
function code(t) return Float64(1.0 / t) end
function tmp = code(t) tmp = 1.0 / t; end
code[t_] := N[(1.0 / t), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{t}
\end{array}
Initial program 100.0%
Taylor expanded in t around 0
Applied rewrites10.4%
Taylor expanded in t around 0
Applied rewrites10.4%
Taylor expanded in t around 0
Applied rewrites3.6%
herbie shell --seed 2024321
(FPCore (t)
:name "Kahan p13 Example 3"
:precision binary64
:pre (TRUE)
(- 1.0 (/ 1.0 (+ 2.0 (* (- 2.0 (/ (/ 2.0 t) (+ 1.0 (/ 1.0 t)))) (- 2.0 (/ (/ 2.0 t) (+ 1.0 (/ 1.0 t)))))))))