
(FPCore (t) :precision binary64 (let* ((t_1 (/ (* 2.0 t) (+ 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 * t) / (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 * t) / (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 * t) / (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 * t) / (1.0 + t) t_2 = t_1 * t_1 return (1.0 + t_2) / (2.0 + t_2)
function code(t) t_1 = Float64(Float64(2.0 * t) / 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 * t) / (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[(N[(2.0 * t), $MachinePrecision] / N[(1.0 + t), $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 := \frac{2 \cdot t}{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 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (t) :precision binary64 (let* ((t_1 (/ (* 2.0 t) (+ 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 * t) / (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 * t) / (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 * t) / (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 * t) / (1.0 + t) t_2 = t_1 * t_1 return (1.0 + t_2) / (2.0 + t_2)
function code(t) t_1 = Float64(Float64(2.0 * t) / 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 * t) / (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[(N[(2.0 * t), $MachinePrecision] / N[(1.0 + t), $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 := \frac{2 \cdot t}{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 (/ (* (/ t (+ t 1.0)) 4.0) (+ t 1.0)))) (/ (fma t t_1 1.0) (fma t t_1 2.0))))
double code(double t) {
double t_1 = ((t / (t + 1.0)) * 4.0) / (t + 1.0);
return fma(t, t_1, 1.0) / fma(t, t_1, 2.0);
}
function code(t) t_1 = Float64(Float64(Float64(t / Float64(t + 1.0)) * 4.0) / Float64(t + 1.0)) return Float64(fma(t, t_1, 1.0) / fma(t, t_1, 2.0)) end
code[t_] := Block[{t$95$1 = N[(N[(N[(t / N[(t + 1.0), $MachinePrecision]), $MachinePrecision] * 4.0), $MachinePrecision] / N[(t + 1.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(t * t$95$1 + 1.0), $MachinePrecision] / N[(t * t$95$1 + 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{t}{t + 1} \cdot 4}{t + 1}\\
\frac{\mathsf{fma}\left(t, t\_1, 1\right)}{\mathsf{fma}\left(t, t\_1, 2\right)}
\end{array}
\end{array}
Initial program 100.0%
+-commutative100.0%
associate-/l*100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*l/100.0%
associate-/l*100.0%
fma-define100.0%
associate-/l*100.0%
*-commutative100.0%
associate-*l*100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (t) :precision binary64 (let* ((t_1 (/ t (+ t 1.0))) (t_2 (* 4.0 (* t_1 t_1)))) (/ (+ t_2 1.0) (+ 2.0 t_2))))
double code(double t) {
double t_1 = t / (t + 1.0);
double t_2 = 4.0 * (t_1 * t_1);
return (t_2 + 1.0) / (2.0 + t_2);
}
real(8) function code(t)
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
t_1 = t / (t + 1.0d0)
t_2 = 4.0d0 * (t_1 * t_1)
code = (t_2 + 1.0d0) / (2.0d0 + t_2)
end function
public static double code(double t) {
double t_1 = t / (t + 1.0);
double t_2 = 4.0 * (t_1 * t_1);
return (t_2 + 1.0) / (2.0 + t_2);
}
def code(t): t_1 = t / (t + 1.0) t_2 = 4.0 * (t_1 * t_1) return (t_2 + 1.0) / (2.0 + t_2)
function code(t) t_1 = Float64(t / Float64(t + 1.0)) t_2 = Float64(4.0 * Float64(t_1 * t_1)) return Float64(Float64(t_2 + 1.0) / Float64(2.0 + t_2)) end
function tmp = code(t) t_1 = t / (t + 1.0); t_2 = 4.0 * (t_1 * t_1); tmp = (t_2 + 1.0) / (2.0 + t_2); end
code[t_] := Block[{t$95$1 = N[(t / N[(t + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(4.0 * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]}, N[(N[(t$95$2 + 1.0), $MachinePrecision] / N[(2.0 + t$95$2), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{t + 1}\\
t_2 := 4 \cdot \left(t\_1 \cdot t\_1\right)\\
\frac{t\_2 + 1}{2 + t\_2}
\end{array}
\end{array}
Initial program 100.0%
associate-/l*100.0%
associate-/l*100.0%
swap-sqr100.0%
metadata-eval100.0%
associate-/l*100.0%
associate-/l*100.0%
swap-sqr100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (t)
:precision binary64
(if (<= t -0.78)
(- 0.8333333333333334 (/ 0.2222222222222222 t))
(if (<= t 0.45)
(+ (* t 0.125) 1.0)
(+
0.8333333333333334
(/
(-
(/ (+ 0.037037037037037035 (/ 0.04938271604938271 t)) t)
0.2222222222222222)
t)))))
double code(double t) {
double tmp;
if (t <= -0.78) {
tmp = 0.8333333333333334 - (0.2222222222222222 / t);
} else if (t <= 0.45) {
tmp = (t * 0.125) + 1.0;
} else {
tmp = 0.8333333333333334 + ((((0.037037037037037035 + (0.04938271604938271 / t)) / t) - 0.2222222222222222) / t);
}
return tmp;
}
real(8) function code(t)
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-0.78d0)) then
tmp = 0.8333333333333334d0 - (0.2222222222222222d0 / t)
else if (t <= 0.45d0) then
tmp = (t * 0.125d0) + 1.0d0
else
tmp = 0.8333333333333334d0 + ((((0.037037037037037035d0 + (0.04938271604938271d0 / t)) / t) - 0.2222222222222222d0) / t)
end if
code = tmp
end function
public static double code(double t) {
double tmp;
if (t <= -0.78) {
tmp = 0.8333333333333334 - (0.2222222222222222 / t);
} else if (t <= 0.45) {
tmp = (t * 0.125) + 1.0;
} else {
tmp = 0.8333333333333334 + ((((0.037037037037037035 + (0.04938271604938271 / t)) / t) - 0.2222222222222222) / t);
}
return tmp;
}
def code(t): tmp = 0 if t <= -0.78: tmp = 0.8333333333333334 - (0.2222222222222222 / t) elif t <= 0.45: tmp = (t * 0.125) + 1.0 else: tmp = 0.8333333333333334 + ((((0.037037037037037035 + (0.04938271604938271 / t)) / t) - 0.2222222222222222) / t) return tmp
function code(t) tmp = 0.0 if (t <= -0.78) tmp = Float64(0.8333333333333334 - Float64(0.2222222222222222 / t)); elseif (t <= 0.45) tmp = Float64(Float64(t * 0.125) + 1.0); else tmp = Float64(0.8333333333333334 + Float64(Float64(Float64(Float64(0.037037037037037035 + Float64(0.04938271604938271 / t)) / t) - 0.2222222222222222) / t)); end return tmp end
function tmp_2 = code(t) tmp = 0.0; if (t <= -0.78) tmp = 0.8333333333333334 - (0.2222222222222222 / t); elseif (t <= 0.45) tmp = (t * 0.125) + 1.0; else tmp = 0.8333333333333334 + ((((0.037037037037037035 + (0.04938271604938271 / t)) / t) - 0.2222222222222222) / t); end tmp_2 = tmp; end
code[t_] := If[LessEqual[t, -0.78], N[(0.8333333333333334 - N[(0.2222222222222222 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 0.45], N[(N[(t * 0.125), $MachinePrecision] + 1.0), $MachinePrecision], N[(0.8333333333333334 + N[(N[(N[(N[(0.037037037037037035 + N[(0.04938271604938271 / t), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] - 0.2222222222222222), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.78:\\
\;\;\;\;0.8333333333333334 - \frac{0.2222222222222222}{t}\\
\mathbf{elif}\;t \leq 0.45:\\
\;\;\;\;t \cdot 0.125 + 1\\
\mathbf{else}:\\
\;\;\;\;0.8333333333333334 + \frac{\frac{0.037037037037037035 + \frac{0.04938271604938271}{t}}{t} - 0.2222222222222222}{t}\\
\end{array}
\end{array}
if t < -0.78000000000000003Initial program 100.0%
+-commutative100.0%
associate-/l*100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*l/100.0%
associate-/l*100.0%
fma-define100.0%
associate-/l*100.0%
*-commutative100.0%
associate-*l*100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in t around inf 100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
if -0.78000000000000003 < t < 0.450000000000000011Initial program 100.0%
associate-/l*100.0%
associate-/l*100.0%
swap-sqr100.0%
metadata-eval100.0%
associate-/l*100.0%
associate-/l*100.0%
swap-sqr100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in t around inf 3.8%
associate-*r/3.8%
metadata-eval3.8%
Simplified3.8%
Taylor expanded in t around inf 18.8%
associate-*r/18.8%
metadata-eval18.8%
Simplified18.8%
Taylor expanded in t around 0 18.8%
*-commutative18.8%
Simplified18.8%
if 0.450000000000000011 < t Initial program 99.9%
+-commutative99.9%
associate-/l*99.9%
associate-*r*99.9%
*-commutative99.9%
associate-*l/99.9%
associate-/l*99.9%
fma-define99.9%
associate-/l*99.9%
*-commutative99.9%
associate-*l*99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified100.0%
Taylor expanded in t around -inf 99.5%
mul-1-neg99.5%
unsub-neg99.5%
mul-1-neg99.5%
unsub-neg99.5%
associate-*r/99.5%
metadata-eval99.5%
Simplified99.5%
Final simplification55.8%
(FPCore (t)
:precision binary64
(if (<= t -0.78)
(- 0.8333333333333334 (/ 0.2222222222222222 t))
(if (<= t 0.15)
(+ (* t 0.125) 1.0)
(-
0.8333333333333334
(/ (+ 0.2222222222222222 (/ -0.037037037037037035 t)) t)))))
double code(double t) {
double tmp;
if (t <= -0.78) {
tmp = 0.8333333333333334 - (0.2222222222222222 / t);
} else if (t <= 0.15) {
tmp = (t * 0.125) + 1.0;
} else {
tmp = 0.8333333333333334 - ((0.2222222222222222 + (-0.037037037037037035 / t)) / t);
}
return tmp;
}
real(8) function code(t)
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-0.78d0)) then
tmp = 0.8333333333333334d0 - (0.2222222222222222d0 / t)
else if (t <= 0.15d0) then
tmp = (t * 0.125d0) + 1.0d0
else
tmp = 0.8333333333333334d0 - ((0.2222222222222222d0 + ((-0.037037037037037035d0) / t)) / t)
end if
code = tmp
end function
public static double code(double t) {
double tmp;
if (t <= -0.78) {
tmp = 0.8333333333333334 - (0.2222222222222222 / t);
} else if (t <= 0.15) {
tmp = (t * 0.125) + 1.0;
} else {
tmp = 0.8333333333333334 - ((0.2222222222222222 + (-0.037037037037037035 / t)) / t);
}
return tmp;
}
def code(t): tmp = 0 if t <= -0.78: tmp = 0.8333333333333334 - (0.2222222222222222 / t) elif t <= 0.15: tmp = (t * 0.125) + 1.0 else: tmp = 0.8333333333333334 - ((0.2222222222222222 + (-0.037037037037037035 / t)) / t) return tmp
function code(t) tmp = 0.0 if (t <= -0.78) tmp = Float64(0.8333333333333334 - Float64(0.2222222222222222 / t)); elseif (t <= 0.15) tmp = Float64(Float64(t * 0.125) + 1.0); else tmp = Float64(0.8333333333333334 - Float64(Float64(0.2222222222222222 + Float64(-0.037037037037037035 / t)) / t)); end return tmp end
function tmp_2 = code(t) tmp = 0.0; if (t <= -0.78) tmp = 0.8333333333333334 - (0.2222222222222222 / t); elseif (t <= 0.15) tmp = (t * 0.125) + 1.0; else tmp = 0.8333333333333334 - ((0.2222222222222222 + (-0.037037037037037035 / t)) / t); end tmp_2 = tmp; end
code[t_] := If[LessEqual[t, -0.78], N[(0.8333333333333334 - N[(0.2222222222222222 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 0.15], N[(N[(t * 0.125), $MachinePrecision] + 1.0), $MachinePrecision], N[(0.8333333333333334 - N[(N[(0.2222222222222222 + N[(-0.037037037037037035 / t), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.78:\\
\;\;\;\;0.8333333333333334 - \frac{0.2222222222222222}{t}\\
\mathbf{elif}\;t \leq 0.15:\\
\;\;\;\;t \cdot 0.125 + 1\\
\mathbf{else}:\\
\;\;\;\;0.8333333333333334 - \frac{0.2222222222222222 + \frac{-0.037037037037037035}{t}}{t}\\
\end{array}
\end{array}
if t < -0.78000000000000003Initial program 100.0%
+-commutative100.0%
associate-/l*100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*l/100.0%
associate-/l*100.0%
fma-define100.0%
associate-/l*100.0%
*-commutative100.0%
associate-*l*100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in t around inf 100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
if -0.78000000000000003 < t < 0.149999999999999994Initial program 100.0%
associate-/l*100.0%
associate-/l*100.0%
swap-sqr100.0%
metadata-eval100.0%
associate-/l*100.0%
associate-/l*100.0%
swap-sqr100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in t around inf 3.8%
associate-*r/3.8%
metadata-eval3.8%
Simplified3.8%
Taylor expanded in t around inf 18.8%
associate-*r/18.8%
metadata-eval18.8%
Simplified18.8%
Taylor expanded in t around 0 18.8%
*-commutative18.8%
Simplified18.8%
if 0.149999999999999994 < t Initial program 99.9%
+-commutative99.9%
associate-/l*99.9%
associate-*r*99.9%
*-commutative99.9%
associate-*l/99.9%
associate-/l*99.9%
fma-define99.9%
associate-/l*99.9%
*-commutative99.9%
associate-*l*99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified100.0%
Taylor expanded in t around -inf 99.0%
mul-1-neg99.0%
unsub-neg99.0%
sub-neg99.0%
associate-*r/99.0%
metadata-eval99.0%
distribute-neg-frac99.0%
metadata-eval99.0%
Simplified99.0%
Final simplification55.6%
(FPCore (t) :precision binary64 (if (or (<= t -0.78) (not (<= t 0.42))) (- 0.8333333333333334 (/ 0.2222222222222222 t)) (+ (* t 0.125) 1.0)))
double code(double t) {
double tmp;
if ((t <= -0.78) || !(t <= 0.42)) {
tmp = 0.8333333333333334 - (0.2222222222222222 / t);
} else {
tmp = (t * 0.125) + 1.0;
}
return tmp;
}
real(8) function code(t)
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-0.78d0)) .or. (.not. (t <= 0.42d0))) then
tmp = 0.8333333333333334d0 - (0.2222222222222222d0 / t)
else
tmp = (t * 0.125d0) + 1.0d0
end if
code = tmp
end function
public static double code(double t) {
double tmp;
if ((t <= -0.78) || !(t <= 0.42)) {
tmp = 0.8333333333333334 - (0.2222222222222222 / t);
} else {
tmp = (t * 0.125) + 1.0;
}
return tmp;
}
def code(t): tmp = 0 if (t <= -0.78) or not (t <= 0.42): tmp = 0.8333333333333334 - (0.2222222222222222 / t) else: tmp = (t * 0.125) + 1.0 return tmp
function code(t) tmp = 0.0 if ((t <= -0.78) || !(t <= 0.42)) tmp = Float64(0.8333333333333334 - Float64(0.2222222222222222 / t)); else tmp = Float64(Float64(t * 0.125) + 1.0); end return tmp end
function tmp_2 = code(t) tmp = 0.0; if ((t <= -0.78) || ~((t <= 0.42))) tmp = 0.8333333333333334 - (0.2222222222222222 / t); else tmp = (t * 0.125) + 1.0; end tmp_2 = tmp; end
code[t_] := If[Or[LessEqual[t, -0.78], N[Not[LessEqual[t, 0.42]], $MachinePrecision]], N[(0.8333333333333334 - N[(0.2222222222222222 / t), $MachinePrecision]), $MachinePrecision], N[(N[(t * 0.125), $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.78 \lor \neg \left(t \leq 0.42\right):\\
\;\;\;\;0.8333333333333334 - \frac{0.2222222222222222}{t}\\
\mathbf{else}:\\
\;\;\;\;t \cdot 0.125 + 1\\
\end{array}
\end{array}
if t < -0.78000000000000003 or 0.419999999999999984 < t Initial program 100.0%
+-commutative100.0%
associate-/l*100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*l/100.0%
associate-/l*100.0%
fma-define100.0%
associate-/l*100.0%
*-commutative100.0%
associate-*l*100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in t around inf 99.2%
associate-*r/99.2%
metadata-eval99.2%
Simplified99.2%
if -0.78000000000000003 < t < 0.419999999999999984Initial program 100.0%
associate-/l*100.0%
associate-/l*100.0%
swap-sqr100.0%
metadata-eval100.0%
associate-/l*100.0%
associate-/l*100.0%
swap-sqr100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in t around inf 3.8%
associate-*r/3.8%
metadata-eval3.8%
Simplified3.8%
Taylor expanded in t around inf 18.8%
associate-*r/18.8%
metadata-eval18.8%
Simplified18.8%
Taylor expanded in t around 0 18.8%
*-commutative18.8%
Simplified18.8%
Final simplification55.5%
(FPCore (t) :precision binary64 (/ (+ (* 4.0 (- 1.0 (/ 2.0 t))) 1.0) (- 6.0 (/ 8.0 t))))
double code(double t) {
return ((4.0 * (1.0 - (2.0 / t))) + 1.0) / (6.0 - (8.0 / t));
}
real(8) function code(t)
real(8), intent (in) :: t
code = ((4.0d0 * (1.0d0 - (2.0d0 / t))) + 1.0d0) / (6.0d0 - (8.0d0 / t))
end function
public static double code(double t) {
return ((4.0 * (1.0 - (2.0 / t))) + 1.0) / (6.0 - (8.0 / t));
}
def code(t): return ((4.0 * (1.0 - (2.0 / t))) + 1.0) / (6.0 - (8.0 / t))
function code(t) return Float64(Float64(Float64(4.0 * Float64(1.0 - Float64(2.0 / t))) + 1.0) / Float64(6.0 - Float64(8.0 / t))) end
function tmp = code(t) tmp = ((4.0 * (1.0 - (2.0 / t))) + 1.0) / (6.0 - (8.0 / t)); end
code[t_] := N[(N[(N[(4.0 * N[(1.0 - N[(2.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(6.0 - N[(8.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{4 \cdot \left(1 - \frac{2}{t}\right) + 1}{6 - \frac{8}{t}}
\end{array}
Initial program 100.0%
associate-/l*100.0%
associate-/l*100.0%
swap-sqr100.0%
metadata-eval100.0%
associate-/l*100.0%
associate-/l*100.0%
swap-sqr100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in t around inf 47.4%
associate-*r/47.4%
metadata-eval47.4%
Simplified47.4%
Taylor expanded in t around inf 55.5%
associate-*r/55.5%
metadata-eval55.5%
Simplified55.5%
Final simplification55.5%
(FPCore (t) :precision binary64 (/ (/ (- (* t 5.0) 8.0) t) (- 6.0 (/ 8.0 t))))
double code(double t) {
return (((t * 5.0) - 8.0) / t) / (6.0 - (8.0 / t));
}
real(8) function code(t)
real(8), intent (in) :: t
code = (((t * 5.0d0) - 8.0d0) / t) / (6.0d0 - (8.0d0 / t))
end function
public static double code(double t) {
return (((t * 5.0) - 8.0) / t) / (6.0 - (8.0 / t));
}
def code(t): return (((t * 5.0) - 8.0) / t) / (6.0 - (8.0 / t))
function code(t) return Float64(Float64(Float64(Float64(t * 5.0) - 8.0) / t) / Float64(6.0 - Float64(8.0 / t))) end
function tmp = code(t) tmp = (((t * 5.0) - 8.0) / t) / (6.0 - (8.0 / t)); end
code[t_] := N[(N[(N[(N[(t * 5.0), $MachinePrecision] - 8.0), $MachinePrecision] / t), $MachinePrecision] / N[(6.0 - N[(8.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{t \cdot 5 - 8}{t}}{6 - \frac{8}{t}}
\end{array}
Initial program 100.0%
associate-/l*100.0%
associate-/l*100.0%
swap-sqr100.0%
metadata-eval100.0%
associate-/l*100.0%
associate-/l*100.0%
swap-sqr100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in t around inf 47.4%
associate-*r/47.4%
metadata-eval47.4%
Simplified47.4%
Taylor expanded in t around inf 55.5%
associate-*r/55.5%
metadata-eval55.5%
Simplified55.5%
Taylor expanded in t around 0 55.5%
Final simplification55.5%
(FPCore (t) :precision binary64 (+ (* t 0.125) 1.0))
double code(double t) {
return (t * 0.125) + 1.0;
}
real(8) function code(t)
real(8), intent (in) :: t
code = (t * 0.125d0) + 1.0d0
end function
public static double code(double t) {
return (t * 0.125) + 1.0;
}
def code(t): return (t * 0.125) + 1.0
function code(t) return Float64(Float64(t * 0.125) + 1.0) end
function tmp = code(t) tmp = (t * 0.125) + 1.0; end
code[t_] := N[(N[(t * 0.125), $MachinePrecision] + 1.0), $MachinePrecision]
\begin{array}{l}
\\
t \cdot 0.125 + 1
\end{array}
Initial program 100.0%
associate-/l*100.0%
associate-/l*100.0%
swap-sqr100.0%
metadata-eval100.0%
associate-/l*100.0%
associate-/l*100.0%
swap-sqr100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in t around inf 47.4%
associate-*r/47.4%
metadata-eval47.4%
Simplified47.4%
Taylor expanded in t around inf 55.5%
associate-*r/55.5%
metadata-eval55.5%
Simplified55.5%
Taylor expanded in t around 0 11.8%
*-commutative11.8%
Simplified11.8%
Final simplification11.8%
herbie shell --seed 2024179
(FPCore (t)
:name "Kahan p13 Example 1"
:precision binary64
(/ (+ 1.0 (* (/ (* 2.0 t) (+ 1.0 t)) (/ (* 2.0 t) (+ 1.0 t)))) (+ 2.0 (* (/ (* 2.0 t) (+ 1.0 t)) (/ (* 2.0 t) (+ 1.0 t))))))