
(FPCore (t) :precision binary64 (let* ((t_1 (- 2.0 (/ (/ 2.0 t) (+ 1.0 (/ 1.0 t))))) (t_2 (* t_1 t_1))) (/ (+ 1.0 t_2) (+ 2.0 t_2))))
double code(double t) {
double t_1 = 2.0 - ((2.0 / t) / (1.0 + (1.0 / t)));
double t_2 = t_1 * t_1;
return (1.0 + t_2) / (2.0 + t_2);
}
real(8) function code(t)
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
t_1 = 2.0d0 - ((2.0d0 / t) / (1.0d0 + (1.0d0 / t)))
t_2 = t_1 * t_1
code = (1.0d0 + t_2) / (2.0d0 + t_2)
end function
public static double code(double t) {
double t_1 = 2.0 - ((2.0 / t) / (1.0 + (1.0 / t)));
double t_2 = t_1 * t_1;
return (1.0 + t_2) / (2.0 + t_2);
}
def code(t): t_1 = 2.0 - ((2.0 / t) / (1.0 + (1.0 / t))) t_2 = t_1 * t_1 return (1.0 + t_2) / (2.0 + t_2)
function code(t) t_1 = Float64(2.0 - Float64(Float64(2.0 / t) / Float64(1.0 + Float64(1.0 / t)))) t_2 = Float64(t_1 * t_1) return Float64(Float64(1.0 + t_2) / Float64(2.0 + t_2)) end
function tmp = code(t) t_1 = 2.0 - ((2.0 / t) / (1.0 + (1.0 / t))); t_2 = t_1 * t_1; tmp = (1.0 + t_2) / (2.0 + t_2); 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[(t$95$1 * t$95$1), $MachinePrecision]}, N[(N[(1.0 + t$95$2), $MachinePrecision] / 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 := t\_1 \cdot t\_1\\
\frac{1 + t\_2}{2 + t\_2}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (t) :precision binary64 (let* ((t_1 (- 2.0 (/ (/ 2.0 t) (+ 1.0 (/ 1.0 t))))) (t_2 (* t_1 t_1))) (/ (+ 1.0 t_2) (+ 2.0 t_2))))
double code(double t) {
double t_1 = 2.0 - ((2.0 / t) / (1.0 + (1.0 / t)));
double t_2 = t_1 * t_1;
return (1.0 + t_2) / (2.0 + t_2);
}
real(8) function code(t)
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
t_1 = 2.0d0 - ((2.0d0 / t) / (1.0d0 + (1.0d0 / t)))
t_2 = t_1 * t_1
code = (1.0d0 + t_2) / (2.0d0 + t_2)
end function
public static double code(double t) {
double t_1 = 2.0 - ((2.0 / t) / (1.0 + (1.0 / t)));
double t_2 = t_1 * t_1;
return (1.0 + t_2) / (2.0 + t_2);
}
def code(t): t_1 = 2.0 - ((2.0 / t) / (1.0 + (1.0 / t))) t_2 = t_1 * t_1 return (1.0 + t_2) / (2.0 + t_2)
function code(t) t_1 = Float64(2.0 - Float64(Float64(2.0 / t) / Float64(1.0 + Float64(1.0 / t)))) t_2 = Float64(t_1 * t_1) return Float64(Float64(1.0 + t_2) / Float64(2.0 + t_2)) end
function tmp = code(t) t_1 = 2.0 - ((2.0 / t) / (1.0 + (1.0 / t))); t_2 = t_1 * t_1; tmp = (1.0 + t_2) / (2.0 + t_2); 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[(t$95$1 * t$95$1), $MachinePrecision]}, N[(N[(1.0 + t$95$2), $MachinePrecision] / 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 := t\_1 \cdot t\_1\\
\frac{1 + t\_2}{2 + t\_2}
\end{array}
\end{array}
(FPCore (t)
:precision binary64
(let* ((t_1 (- -1.0 (/ 1.0 t))) (t_2 (+ 2.0 (/ (/ 2.0 t) t_1))))
(/
(+ 1.0 (* t_2 (+ 2.0 (/ 2.0 (* t t_1)))))
(+ 2.0 (* t_2 (+ 2.0 (/ 2.0 (- -1.0 t))))))))
double code(double t) {
double t_1 = -1.0 - (1.0 / t);
double t_2 = 2.0 + ((2.0 / t) / t_1);
return (1.0 + (t_2 * (2.0 + (2.0 / (t * t_1))))) / (2.0 + (t_2 * (2.0 + (2.0 / (-1.0 - t)))));
}
real(8) function code(t)
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
t_1 = (-1.0d0) - (1.0d0 / t)
t_2 = 2.0d0 + ((2.0d0 / t) / t_1)
code = (1.0d0 + (t_2 * (2.0d0 + (2.0d0 / (t * t_1))))) / (2.0d0 + (t_2 * (2.0d0 + (2.0d0 / ((-1.0d0) - t)))))
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);
return (1.0 + (t_2 * (2.0 + (2.0 / (t * t_1))))) / (2.0 + (t_2 * (2.0 + (2.0 / (-1.0 - t)))));
}
def code(t): t_1 = -1.0 - (1.0 / t) t_2 = 2.0 + ((2.0 / t) / t_1) return (1.0 + (t_2 * (2.0 + (2.0 / (t * t_1))))) / (2.0 + (t_2 * (2.0 + (2.0 / (-1.0 - t)))))
function code(t) t_1 = Float64(-1.0 - Float64(1.0 / t)) t_2 = Float64(2.0 + Float64(Float64(2.0 / t) / t_1)) return Float64(Float64(1.0 + Float64(t_2 * Float64(2.0 + Float64(2.0 / Float64(t * t_1))))) / Float64(2.0 + Float64(t_2 * Float64(2.0 + Float64(2.0 / Float64(-1.0 - t)))))) end
function tmp = code(t) t_1 = -1.0 - (1.0 / t); t_2 = 2.0 + ((2.0 / t) / t_1); tmp = (1.0 + (t_2 * (2.0 + (2.0 / (t * t_1))))) / (2.0 + (t_2 * (2.0 + (2.0 / (-1.0 - t))))); 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]}, N[(N[(1.0 + N[(t$95$2 * N[(2.0 + N[(2.0 / N[(t * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 + N[(t$95$2 * N[(2.0 + N[(2.0 / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -1 - \frac{1}{t}\\
t_2 := 2 + \frac{\frac{2}{t}}{t\_1}\\
\frac{1 + t\_2 \cdot \left(2 + \frac{2}{t \cdot t\_1}\right)}{2 + t\_2 \cdot \left(2 + \frac{2}{-1 - t}\right)}
\end{array}
\end{array}
Initial program 100.0%
associate-/l/100.0%
div-inv100.0%
*-commutative100.0%
Applied egg-rr100.0%
frac-2neg100.0%
div-inv100.0%
distribute-rgt-neg-in100.0%
mul-1-neg100.0%
div-inv100.0%
add-sqr-sqrt41.0%
sqrt-unprod67.8%
frac-times67.8%
metadata-eval67.8%
metadata-eval67.8%
frac-times67.8%
sqrt-unprod58.1%
add-sqr-sqrt97.9%
div-inv97.9%
distribute-neg-in97.9%
metadata-eval97.9%
mul-1-neg97.9%
div-inv97.9%
+-commutative97.9%
*-un-lft-identity97.9%
associate-/r*97.9%
+-commutative97.9%
distribute-lft-in97.9%
Applied egg-rr100.0%
*-lft-identity100.0%
*-inverses100.0%
Simplified100.0%
un-div-inv100.0%
*-commutative100.0%
associate-/l/100.0%
Applied egg-rr100.0%
associate-/l/100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (t)
:precision binary64
(let* ((t_1
(*
(+ 2.0 (/ (/ 2.0 t) (- -1.0 (/ 1.0 t))))
(+ 2.0 (/ 2.0 (- -1.0 t))))))
(/ (+ 1.0 t_1) (+ 2.0 t_1))))
double code(double t) {
double t_1 = (2.0 + ((2.0 / t) / (-1.0 - (1.0 / t)))) * (2.0 + (2.0 / (-1.0 - t)));
return (1.0 + t_1) / (2.0 + 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)))) * (2.0d0 + (2.0d0 / ((-1.0d0) - t)))
code = (1.0d0 + t_1) / (2.0d0 + t_1)
end function
public static double code(double t) {
double t_1 = (2.0 + ((2.0 / t) / (-1.0 - (1.0 / t)))) * (2.0 + (2.0 / (-1.0 - t)));
return (1.0 + t_1) / (2.0 + t_1);
}
def code(t): t_1 = (2.0 + ((2.0 / t) / (-1.0 - (1.0 / t)))) * (2.0 + (2.0 / (-1.0 - t))) return (1.0 + t_1) / (2.0 + t_1)
function code(t) t_1 = Float64(Float64(2.0 + Float64(Float64(2.0 / t) / Float64(-1.0 - Float64(1.0 / t)))) * Float64(2.0 + Float64(2.0 / Float64(-1.0 - t)))) return Float64(Float64(1.0 + t_1) / Float64(2.0 + t_1)) end
function tmp = code(t) t_1 = (2.0 + ((2.0 / t) / (-1.0 - (1.0 / t)))) * (2.0 + (2.0 / (-1.0 - t))); tmp = (1.0 + t_1) / (2.0 + t_1); end
code[t_] := Block[{t$95$1 = N[(N[(2.0 + N[(N[(2.0 / t), $MachinePrecision] / N[(-1.0 - N[(1.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 + N[(2.0 / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(1.0 + t$95$1), $MachinePrecision] / N[(2.0 + t$95$1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(2 + \frac{\frac{2}{t}}{-1 - \frac{1}{t}}\right) \cdot \left(2 + \frac{2}{-1 - t}\right)\\
\frac{1 + t\_1}{2 + t\_1}
\end{array}
\end{array}
Initial program 100.0%
associate-/l/100.0%
div-inv100.0%
*-commutative100.0%
Applied egg-rr100.0%
frac-2neg100.0%
div-inv100.0%
distribute-rgt-neg-in100.0%
mul-1-neg100.0%
div-inv100.0%
add-sqr-sqrt41.0%
sqrt-unprod67.8%
frac-times67.8%
metadata-eval67.8%
metadata-eval67.8%
frac-times67.8%
sqrt-unprod58.1%
add-sqr-sqrt97.9%
div-inv97.9%
distribute-neg-in97.9%
metadata-eval97.9%
mul-1-neg97.9%
div-inv97.9%
+-commutative97.9%
*-un-lft-identity97.9%
associate-/r*97.9%
+-commutative97.9%
distribute-lft-in97.9%
Applied egg-rr100.0%
*-lft-identity100.0%
*-inverses100.0%
Simplified100.0%
un-div-inv100.0%
distribute-rgt-in100.0%
*-un-lft-identity100.0%
inv-pow100.0%
pow-plus100.0%
metadata-eval100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (t)
:precision binary64
(let* ((t_1 (+ 2.0 (/ (/ 2.0 t) (- -1.0 (/ 1.0 t))))))
(/
(+ 1.0 (* t_1 (+ 2.0 (/ -2.0 t))))
(+ 2.0 (* t_1 (+ 2.0 (/ 2.0 (- -1.0 t))))))))
double code(double t) {
double t_1 = 2.0 + ((2.0 / t) / (-1.0 - (1.0 / t)));
return (1.0 + (t_1 * (2.0 + (-2.0 / t)))) / (2.0 + (t_1 * (2.0 + (2.0 / (-1.0 - t)))));
}
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 + (t_1 * (2.0d0 + ((-2.0d0) / t)))) / (2.0d0 + (t_1 * (2.0d0 + (2.0d0 / ((-1.0d0) - t)))))
end function
public static double code(double t) {
double t_1 = 2.0 + ((2.0 / t) / (-1.0 - (1.0 / t)));
return (1.0 + (t_1 * (2.0 + (-2.0 / t)))) / (2.0 + (t_1 * (2.0 + (2.0 / (-1.0 - t)))));
}
def code(t): t_1 = 2.0 + ((2.0 / t) / (-1.0 - (1.0 / t))) return (1.0 + (t_1 * (2.0 + (-2.0 / t)))) / (2.0 + (t_1 * (2.0 + (2.0 / (-1.0 - t)))))
function code(t) t_1 = Float64(2.0 + Float64(Float64(2.0 / t) / Float64(-1.0 - Float64(1.0 / t)))) return Float64(Float64(1.0 + Float64(t_1 * Float64(2.0 + Float64(-2.0 / t)))) / Float64(2.0 + Float64(t_1 * Float64(2.0 + Float64(2.0 / Float64(-1.0 - t)))))) end
function tmp = code(t) t_1 = 2.0 + ((2.0 / t) / (-1.0 - (1.0 / t))); tmp = (1.0 + (t_1 * (2.0 + (-2.0 / t)))) / (2.0 + (t_1 * (2.0 + (2.0 / (-1.0 - t))))); 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[(N[(1.0 + N[(t$95$1 * N[(2.0 + N[(-2.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 + N[(t$95$1 * N[(2.0 + N[(2.0 / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 + \frac{\frac{2}{t}}{-1 - \frac{1}{t}}\\
\frac{1 + t\_1 \cdot \left(2 + \frac{-2}{t}\right)}{2 + t\_1 \cdot \left(2 + \frac{2}{-1 - t}\right)}
\end{array}
\end{array}
Initial program 100.0%
associate-/l/100.0%
div-inv100.0%
*-commutative100.0%
Applied egg-rr100.0%
frac-2neg100.0%
div-inv100.0%
distribute-rgt-neg-in100.0%
mul-1-neg100.0%
div-inv100.0%
add-sqr-sqrt41.0%
sqrt-unprod67.8%
frac-times67.8%
metadata-eval67.8%
metadata-eval67.8%
frac-times67.8%
sqrt-unprod58.1%
add-sqr-sqrt97.9%
div-inv97.9%
distribute-neg-in97.9%
metadata-eval97.9%
mul-1-neg97.9%
div-inv97.9%
+-commutative97.9%
*-un-lft-identity97.9%
associate-/r*97.9%
+-commutative97.9%
distribute-lft-in97.9%
Applied egg-rr100.0%
*-lft-identity100.0%
*-inverses100.0%
Simplified100.0%
Taylor expanded in t around inf 97.5%
sub-neg97.5%
associate-*r/97.5%
metadata-eval97.5%
distribute-neg-frac97.5%
metadata-eval97.5%
Simplified97.5%
Final simplification97.5%
(FPCore (t)
:precision binary64
(+
0.8333333333333334
(/
1.0
(*
t
(-
(/
(-
(/
(-
(/ (- (* 0.003472222222222222 (/ -1.0 t)) 0.020833333333333332) t)
0.125)
t)
0.75)
t)
4.5)))))
double code(double t) {
return 0.8333333333333334 + (1.0 / (t * ((((((((0.003472222222222222 * (-1.0 / t)) - 0.020833333333333332) / t) - 0.125) / t) - 0.75) / t) - 4.5)));
}
real(8) function code(t)
real(8), intent (in) :: t
code = 0.8333333333333334d0 + (1.0d0 / (t * ((((((((0.003472222222222222d0 * ((-1.0d0) / t)) - 0.020833333333333332d0) / t) - 0.125d0) / t) - 0.75d0) / t) - 4.5d0)))
end function
public static double code(double t) {
return 0.8333333333333334 + (1.0 / (t * ((((((((0.003472222222222222 * (-1.0 / t)) - 0.020833333333333332) / t) - 0.125) / t) - 0.75) / t) - 4.5)));
}
def code(t): return 0.8333333333333334 + (1.0 / (t * ((((((((0.003472222222222222 * (-1.0 / t)) - 0.020833333333333332) / t) - 0.125) / t) - 0.75) / t) - 4.5)))
function code(t) return Float64(0.8333333333333334 + Float64(1.0 / Float64(t * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(0.003472222222222222 * Float64(-1.0 / t)) - 0.020833333333333332) / t) - 0.125) / t) - 0.75) / t) - 4.5)))) end
function tmp = code(t) tmp = 0.8333333333333334 + (1.0 / (t * ((((((((0.003472222222222222 * (-1.0 / t)) - 0.020833333333333332) / t) - 0.125) / t) - 0.75) / t) - 4.5))); end
code[t_] := N[(0.8333333333333334 + N[(1.0 / N[(t * N[(N[(N[(N[(N[(N[(N[(N[(0.003472222222222222 * N[(-1.0 / t), $MachinePrecision]), $MachinePrecision] - 0.020833333333333332), $MachinePrecision] / t), $MachinePrecision] - 0.125), $MachinePrecision] / t), $MachinePrecision] - 0.75), $MachinePrecision] / t), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.8333333333333334 + \frac{1}{t \cdot \left(\frac{\frac{\frac{0.003472222222222222 \cdot \frac{-1}{t} - 0.020833333333333332}{t} - 0.125}{t} - 0.75}{t} - 4.5\right)}
\end{array}
Initial program 100.0%
Taylor expanded in t around -inf 44.2%
mul-1-neg44.2%
unsub-neg44.2%
sub-neg44.2%
associate-*r/44.2%
metadata-eval44.2%
distribute-neg-frac44.2%
metadata-eval44.2%
Simplified44.2%
clear-num44.2%
inv-pow44.2%
Applied egg-rr44.2%
unpow-144.2%
Simplified44.2%
Taylor expanded in t around -inf 53.2%
Final simplification53.2%
(FPCore (t)
:precision binary64
(if (or (<= t -0.22) (not (<= t 0.09)))
(-
0.8333333333333334
(/ (+ 0.2222222222222222 (/ -0.037037037037037035 t)) t))
(+ 0.8333333333333334 (* t -8.0))))
double code(double t) {
double tmp;
if ((t <= -0.22) || !(t <= 0.09)) {
tmp = 0.8333333333333334 - ((0.2222222222222222 + (-0.037037037037037035 / t)) / t);
} else {
tmp = 0.8333333333333334 + (t * -8.0);
}
return tmp;
}
real(8) function code(t)
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-0.22d0)) .or. (.not. (t <= 0.09d0))) then
tmp = 0.8333333333333334d0 - ((0.2222222222222222d0 + ((-0.037037037037037035d0) / t)) / t)
else
tmp = 0.8333333333333334d0 + (t * (-8.0d0))
end if
code = tmp
end function
public static double code(double t) {
double tmp;
if ((t <= -0.22) || !(t <= 0.09)) {
tmp = 0.8333333333333334 - ((0.2222222222222222 + (-0.037037037037037035 / t)) / t);
} else {
tmp = 0.8333333333333334 + (t * -8.0);
}
return tmp;
}
def code(t): tmp = 0 if (t <= -0.22) or not (t <= 0.09): tmp = 0.8333333333333334 - ((0.2222222222222222 + (-0.037037037037037035 / t)) / t) else: tmp = 0.8333333333333334 + (t * -8.0) return tmp
function code(t) tmp = 0.0 if ((t <= -0.22) || !(t <= 0.09)) tmp = Float64(0.8333333333333334 - Float64(Float64(0.2222222222222222 + Float64(-0.037037037037037035 / t)) / t)); else tmp = Float64(0.8333333333333334 + Float64(t * -8.0)); end return tmp end
function tmp_2 = code(t) tmp = 0.0; if ((t <= -0.22) || ~((t <= 0.09))) tmp = 0.8333333333333334 - ((0.2222222222222222 + (-0.037037037037037035 / t)) / t); else tmp = 0.8333333333333334 + (t * -8.0); end tmp_2 = tmp; end
code[t_] := If[Or[LessEqual[t, -0.22], N[Not[LessEqual[t, 0.09]], $MachinePrecision]], N[(0.8333333333333334 - N[(N[(0.2222222222222222 + N[(-0.037037037037037035 / t), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(0.8333333333333334 + N[(t * -8.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.22 \lor \neg \left(t \leq 0.09\right):\\
\;\;\;\;0.8333333333333334 - \frac{0.2222222222222222 + \frac{-0.037037037037037035}{t}}{t}\\
\mathbf{else}:\\
\;\;\;\;0.8333333333333334 + t \cdot -8\\
\end{array}
\end{array}
if t < -0.220000000000000001 or 0.089999999999999997 < t Initial program 100.0%
Taylor expanded in t around -inf 98.4%
mul-1-neg98.4%
unsub-neg98.4%
sub-neg98.4%
associate-*r/98.4%
metadata-eval98.4%
distribute-neg-frac98.4%
metadata-eval98.4%
Simplified98.4%
if -0.220000000000000001 < t < 0.089999999999999997Initial program 100.0%
Taylor expanded in t around -inf 4.0%
mul-1-neg4.0%
unsub-neg4.0%
sub-neg4.0%
associate-*r/4.0%
metadata-eval4.0%
distribute-neg-frac4.0%
metadata-eval4.0%
Simplified4.0%
clear-num4.0%
inv-pow4.0%
Applied egg-rr4.0%
unpow-14.0%
Simplified4.0%
Taylor expanded in t around -inf 19.7%
Taylor expanded in t around 0 19.7%
*-commutative19.7%
Simplified19.7%
Final simplification53.2%
(FPCore (t) :precision binary64 (+ 0.8333333333333334 (/ 1.0 (* t (- (/ (- (* 0.125 (/ -1.0 t)) 0.75) t) 4.5)))))
double code(double t) {
return 0.8333333333333334 + (1.0 / (t * ((((0.125 * (-1.0 / t)) - 0.75) / t) - 4.5)));
}
real(8) function code(t)
real(8), intent (in) :: t
code = 0.8333333333333334d0 + (1.0d0 / (t * ((((0.125d0 * ((-1.0d0) / t)) - 0.75d0) / t) - 4.5d0)))
end function
public static double code(double t) {
return 0.8333333333333334 + (1.0 / (t * ((((0.125 * (-1.0 / t)) - 0.75) / t) - 4.5)));
}
def code(t): return 0.8333333333333334 + (1.0 / (t * ((((0.125 * (-1.0 / t)) - 0.75) / t) - 4.5)))
function code(t) return Float64(0.8333333333333334 + Float64(1.0 / Float64(t * Float64(Float64(Float64(Float64(0.125 * Float64(-1.0 / t)) - 0.75) / t) - 4.5)))) end
function tmp = code(t) tmp = 0.8333333333333334 + (1.0 / (t * ((((0.125 * (-1.0 / t)) - 0.75) / t) - 4.5))); end
code[t_] := N[(0.8333333333333334 + N[(1.0 / N[(t * N[(N[(N[(N[(0.125 * N[(-1.0 / t), $MachinePrecision]), $MachinePrecision] - 0.75), $MachinePrecision] / t), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.8333333333333334 + \frac{1}{t \cdot \left(\frac{0.125 \cdot \frac{-1}{t} - 0.75}{t} - 4.5\right)}
\end{array}
Initial program 100.0%
Taylor expanded in t around -inf 44.2%
mul-1-neg44.2%
unsub-neg44.2%
sub-neg44.2%
associate-*r/44.2%
metadata-eval44.2%
distribute-neg-frac44.2%
metadata-eval44.2%
Simplified44.2%
clear-num44.2%
inv-pow44.2%
Applied egg-rr44.2%
unpow-144.2%
Simplified44.2%
Taylor expanded in t around -inf 53.2%
Final simplification53.2%
(FPCore (t) :precision binary64 (+ -1.0 (+ 1.8333333333333333 (/ 1.0 (* t (+ -4.5 (/ (+ -0.75 (/ -0.125 t)) t)))))))
double code(double t) {
return -1.0 + (1.8333333333333333 + (1.0 / (t * (-4.5 + ((-0.75 + (-0.125 / t)) / t)))));
}
real(8) function code(t)
real(8), intent (in) :: t
code = (-1.0d0) + (1.8333333333333333d0 + (1.0d0 / (t * ((-4.5d0) + (((-0.75d0) + ((-0.125d0) / t)) / t)))))
end function
public static double code(double t) {
return -1.0 + (1.8333333333333333 + (1.0 / (t * (-4.5 + ((-0.75 + (-0.125 / t)) / t)))));
}
def code(t): return -1.0 + (1.8333333333333333 + (1.0 / (t * (-4.5 + ((-0.75 + (-0.125 / t)) / t)))))
function code(t) return Float64(-1.0 + Float64(1.8333333333333333 + Float64(1.0 / Float64(t * Float64(-4.5 + Float64(Float64(-0.75 + Float64(-0.125 / t)) / t)))))) end
function tmp = code(t) tmp = -1.0 + (1.8333333333333333 + (1.0 / (t * (-4.5 + ((-0.75 + (-0.125 / t)) / t))))); end
code[t_] := N[(-1.0 + N[(1.8333333333333333 + N[(1.0 / N[(t * N[(-4.5 + N[(N[(-0.75 + N[(-0.125 / t), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-1 + \left(1.8333333333333333 + \frac{1}{t \cdot \left(-4.5 + \frac{-0.75 + \frac{-0.125}{t}}{t}\right)}\right)
\end{array}
Initial program 100.0%
Taylor expanded in t around -inf 44.2%
mul-1-neg44.2%
unsub-neg44.2%
sub-neg44.2%
associate-*r/44.2%
metadata-eval44.2%
distribute-neg-frac44.2%
metadata-eval44.2%
Simplified44.2%
clear-num44.2%
inv-pow44.2%
Applied egg-rr44.2%
unpow-144.2%
Simplified44.2%
Taylor expanded in t around -inf 53.2%
expm1-log1p-u52.5%
associate-/r*52.5%
metadata-eval52.5%
fmm-def52.5%
un-div-inv52.5%
metadata-eval52.5%
Applied egg-rr52.5%
expm1-undefine52.6%
sub-neg52.6%
Simplified52.5%
Final simplification52.5%
(FPCore (t) :precision binary64 (if (or (<= t -0.17) (not (<= t 0.165))) (- 0.8333333333333334 (/ 0.2222222222222222 t)) (+ 0.8333333333333334 (* t -8.0))))
double code(double t) {
double tmp;
if ((t <= -0.17) || !(t <= 0.165)) {
tmp = 0.8333333333333334 - (0.2222222222222222 / t);
} else {
tmp = 0.8333333333333334 + (t * -8.0);
}
return tmp;
}
real(8) function code(t)
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-0.17d0)) .or. (.not. (t <= 0.165d0))) then
tmp = 0.8333333333333334d0 - (0.2222222222222222d0 / t)
else
tmp = 0.8333333333333334d0 + (t * (-8.0d0))
end if
code = tmp
end function
public static double code(double t) {
double tmp;
if ((t <= -0.17) || !(t <= 0.165)) {
tmp = 0.8333333333333334 - (0.2222222222222222 / t);
} else {
tmp = 0.8333333333333334 + (t * -8.0);
}
return tmp;
}
def code(t): tmp = 0 if (t <= -0.17) or not (t <= 0.165): tmp = 0.8333333333333334 - (0.2222222222222222 / t) else: tmp = 0.8333333333333334 + (t * -8.0) return tmp
function code(t) tmp = 0.0 if ((t <= -0.17) || !(t <= 0.165)) tmp = Float64(0.8333333333333334 - Float64(0.2222222222222222 / t)); else tmp = Float64(0.8333333333333334 + Float64(t * -8.0)); end return tmp end
function tmp_2 = code(t) tmp = 0.0; if ((t <= -0.17) || ~((t <= 0.165))) tmp = 0.8333333333333334 - (0.2222222222222222 / t); else tmp = 0.8333333333333334 + (t * -8.0); end tmp_2 = tmp; end
code[t_] := If[Or[LessEqual[t, -0.17], N[Not[LessEqual[t, 0.165]], $MachinePrecision]], N[(0.8333333333333334 - N[(0.2222222222222222 / t), $MachinePrecision]), $MachinePrecision], N[(0.8333333333333334 + N[(t * -8.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.17 \lor \neg \left(t \leq 0.165\right):\\
\;\;\;\;0.8333333333333334 - \frac{0.2222222222222222}{t}\\
\mathbf{else}:\\
\;\;\;\;0.8333333333333334 + t \cdot -8\\
\end{array}
\end{array}
if t < -0.170000000000000012 or 0.165000000000000008 < t Initial program 100.0%
Taylor expanded in t around inf 98.0%
associate-*r/98.0%
metadata-eval98.0%
Simplified98.0%
if -0.170000000000000012 < t < 0.165000000000000008Initial program 100.0%
Taylor expanded in t around -inf 4.0%
mul-1-neg4.0%
unsub-neg4.0%
sub-neg4.0%
associate-*r/4.0%
metadata-eval4.0%
distribute-neg-frac4.0%
metadata-eval4.0%
Simplified4.0%
clear-num4.0%
inv-pow4.0%
Applied egg-rr4.0%
unpow-14.0%
Simplified4.0%
Taylor expanded in t around -inf 19.7%
Taylor expanded in t around 0 19.7%
*-commutative19.7%
Simplified19.7%
Final simplification53.0%
(FPCore (t) :precision binary64 (/ (+ 1.0 (- 4.0 (/ 8.0 t))) (- 6.0 (/ 8.0 t))))
double code(double t) {
return (1.0 + (4.0 - (8.0 / t))) / (6.0 - (8.0 / t));
}
real(8) function code(t)
real(8), intent (in) :: t
code = (1.0d0 + (4.0d0 - (8.0d0 / t))) / (6.0d0 - (8.0d0 / t))
end function
public static double code(double t) {
return (1.0 + (4.0 - (8.0 / t))) / (6.0 - (8.0 / t));
}
def code(t): return (1.0 + (4.0 - (8.0 / t))) / (6.0 - (8.0 / t))
function code(t) return Float64(Float64(1.0 + Float64(4.0 - Float64(8.0 / t))) / Float64(6.0 - Float64(8.0 / t))) end
function tmp = code(t) tmp = (1.0 + (4.0 - (8.0 / t))) / (6.0 - (8.0 / t)); end
code[t_] := N[(N[(1.0 + N[(4.0 - N[(8.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(6.0 - N[(8.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1 + \left(4 - \frac{8}{t}\right)}{6 - \frac{8}{t}}
\end{array}
Initial program 100.0%
Taylor expanded in t around inf 43.6%
associate-*r/43.6%
metadata-eval43.6%
Simplified43.6%
Taylor expanded in t around inf 52.4%
associate-*r/52.4%
metadata-eval52.4%
Simplified52.4%
(FPCore (t) :precision binary64 (* (+ 5.0 (/ -8.0 t)) (/ 1.0 (+ 6.0 (/ -8.0 t)))))
double code(double t) {
return (5.0 + (-8.0 / t)) * (1.0 / (6.0 + (-8.0 / t)));
}
real(8) function code(t)
real(8), intent (in) :: t
code = (5.0d0 + ((-8.0d0) / t)) * (1.0d0 / (6.0d0 + ((-8.0d0) / t)))
end function
public static double code(double t) {
return (5.0 + (-8.0 / t)) * (1.0 / (6.0 + (-8.0 / t)));
}
def code(t): return (5.0 + (-8.0 / t)) * (1.0 / (6.0 + (-8.0 / t)))
function code(t) return Float64(Float64(5.0 + Float64(-8.0 / t)) * Float64(1.0 / Float64(6.0 + Float64(-8.0 / t)))) end
function tmp = code(t) tmp = (5.0 + (-8.0 / t)) * (1.0 / (6.0 + (-8.0 / t))); end
code[t_] := N[(N[(5.0 + N[(-8.0 / t), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(6.0 + N[(-8.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(5 + \frac{-8}{t}\right) \cdot \frac{1}{6 + \frac{-8}{t}}
\end{array}
Initial program 100.0%
Taylor expanded in t around inf 43.6%
associate-*r/43.6%
metadata-eval43.6%
Simplified43.6%
Taylor expanded in t around inf 52.4%
associate-*r/52.4%
metadata-eval52.4%
Simplified52.4%
div-inv51.7%
associate-+r-51.7%
sub-neg51.7%
metadata-eval51.7%
distribute-neg-frac51.7%
metadata-eval51.7%
sub-neg51.7%
distribute-neg-frac51.7%
metadata-eval51.7%
Applied egg-rr51.7%
(FPCore (t) :precision binary64 (+ 0.8333333333333334 (* t -8.0)))
double code(double t) {
return 0.8333333333333334 + (t * -8.0);
}
real(8) function code(t)
real(8), intent (in) :: t
code = 0.8333333333333334d0 + (t * (-8.0d0))
end function
public static double code(double t) {
return 0.8333333333333334 + (t * -8.0);
}
def code(t): return 0.8333333333333334 + (t * -8.0)
function code(t) return Float64(0.8333333333333334 + Float64(t * -8.0)) end
function tmp = code(t) tmp = 0.8333333333333334 + (t * -8.0); end
code[t_] := N[(0.8333333333333334 + N[(t * -8.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.8333333333333334 + t \cdot -8
\end{array}
Initial program 100.0%
Taylor expanded in t around -inf 44.2%
mul-1-neg44.2%
unsub-neg44.2%
sub-neg44.2%
associate-*r/44.2%
metadata-eval44.2%
distribute-neg-frac44.2%
metadata-eval44.2%
Simplified44.2%
clear-num44.2%
inv-pow44.2%
Applied egg-rr44.2%
unpow-144.2%
Simplified44.2%
Taylor expanded in t around -inf 53.2%
Taylor expanded in t around 0 12.4%
*-commutative12.4%
Simplified12.4%
herbie shell --seed 2024179
(FPCore (t)
:name "Kahan p13 Example 2"
:precision binary64
(/ (+ 1.0 (* (- 2.0 (/ (/ 2.0 t) (+ 1.0 (/ 1.0 t)))) (- 2.0 (/ (/ 2.0 t) (+ 1.0 (/ 1.0 t)))))) (+ 2.0 (* (- 2.0 (/ (/ 2.0 t) (+ 1.0 (/ 1.0 t)))) (- 2.0 (/ (/ 2.0 t) (+ 1.0 (/ 1.0 t))))))))