| Alternative 1 | |
|---|---|
| Error | 0.6 |
| Cost | 584 |
\[\begin{array}{l}
t_1 := 0.8333333333333334 - \frac{0.2222222222222222}{t}\\
\mathbf{if}\;t \leq -0.49:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 0.68:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
(FPCore (t) :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))))))
(FPCore (t) :precision binary64 (let* ((t_1 (/ t (+ t 1.0)))) (+ (/ -2.0 (+ 4.0 (* 8.0 (* t_1 t_1)))) 1.0)))
double code(double t) {
return (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))));
}
double code(double t) {
double t_1 = t / (t + 1.0);
return (-2.0 / (4.0 + (8.0 * (t_1 * t_1)))) + 1.0;
}
real(8) function code(t)
real(8), intent (in) :: t
code = (1.0d0 + (((2.0d0 * t) / (1.0d0 + t)) * ((2.0d0 * t) / (1.0d0 + t)))) / (2.0d0 + (((2.0d0 * t) / (1.0d0 + t)) * ((2.0d0 * t) / (1.0d0 + t))))
end function
real(8) function code(t)
real(8), intent (in) :: t
real(8) :: t_1
t_1 = t / (t + 1.0d0)
code = ((-2.0d0) / (4.0d0 + (8.0d0 * (t_1 * t_1)))) + 1.0d0
end function
public static double code(double t) {
return (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))));
}
public static double code(double t) {
double t_1 = t / (t + 1.0);
return (-2.0 / (4.0 + (8.0 * (t_1 * t_1)))) + 1.0;
}
def code(t): return (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))))
def code(t): t_1 = t / (t + 1.0) return (-2.0 / (4.0 + (8.0 * (t_1 * t_1)))) + 1.0
function code(t) return Float64(Float64(1.0 + Float64(Float64(Float64(2.0 * t) / Float64(1.0 + t)) * Float64(Float64(2.0 * t) / Float64(1.0 + t)))) / Float64(2.0 + Float64(Float64(Float64(2.0 * t) / Float64(1.0 + t)) * Float64(Float64(2.0 * t) / Float64(1.0 + t))))) end
function code(t) t_1 = Float64(t / Float64(t + 1.0)) return Float64(Float64(-2.0 / Float64(4.0 + Float64(8.0 * Float64(t_1 * t_1)))) + 1.0) end
function tmp = code(t) tmp = (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)))); end
function tmp = code(t) t_1 = t / (t + 1.0); tmp = (-2.0 / (4.0 + (8.0 * (t_1 * t_1)))) + 1.0; end
code[t_] := N[(N[(1.0 + N[(N[(N[(2.0 * t), $MachinePrecision] / N[(1.0 + t), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * t), $MachinePrecision] / N[(1.0 + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 + N[(N[(N[(2.0 * t), $MachinePrecision] / N[(1.0 + t), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * t), $MachinePrecision] / N[(1.0 + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[t_] := Block[{t$95$1 = N[(t / N[(t + 1.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(-2.0 / N[(4.0 + N[(8.0 * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]]
\frac{1 + \frac{2 \cdot t}{1 + t} \cdot \frac{2 \cdot t}{1 + t}}{2 + \frac{2 \cdot t}{1 + t} \cdot \frac{2 \cdot t}{1 + t}}
\begin{array}{l}
t_1 := \frac{t}{t + 1}\\
\frac{-2}{4 + 8 \cdot \left(t_1 \cdot t_1\right)} + 1
\end{array}
Results
Initial program 0.0
Simplified0.0
[Start]0.0 | \[ \frac{1 + \frac{2 \cdot t}{1 + t} \cdot \frac{2 \cdot t}{1 + t}}{2 + \frac{2 \cdot t}{1 + t} \cdot \frac{2 \cdot t}{1 + t}}
\] |
|---|---|
rational.json-simplify-2 [=>]0.0 | \[ \frac{1 + \frac{2 \cdot t}{1 + t} \cdot \frac{\color{blue}{t \cdot 2}}{1 + t}}{2 + \frac{2 \cdot t}{1 + t} \cdot \frac{2 \cdot t}{1 + t}}
\] |
rational.json-simplify-49 [=>]0.0 | \[ \frac{1 + \frac{2 \cdot t}{1 + t} \cdot \color{blue}{\left(2 \cdot \frac{t}{1 + t}\right)}}{2 + \frac{2 \cdot t}{1 + t} \cdot \frac{2 \cdot t}{1 + t}}
\] |
rational.json-simplify-2 [=>]0.0 | \[ \frac{1 + \frac{2 \cdot t}{1 + t} \cdot \color{blue}{\left(\frac{t}{1 + t} \cdot 2\right)}}{2 + \frac{2 \cdot t}{1 + t} \cdot \frac{2 \cdot t}{1 + t}}
\] |
rational.json-simplify-43 [=>]0.0 | \[ \frac{1 + \color{blue}{\frac{t}{1 + t} \cdot \left(2 \cdot \frac{2 \cdot t}{1 + t}\right)}}{2 + \frac{2 \cdot t}{1 + t} \cdot \frac{2 \cdot t}{1 + t}}
\] |
rational.json-simplify-2 [=>]0.0 | \[ \frac{1 + \frac{t}{1 + t} \cdot \left(2 \cdot \frac{\color{blue}{t \cdot 2}}{1 + t}\right)}{2 + \frac{2 \cdot t}{1 + t} \cdot \frac{2 \cdot t}{1 + t}}
\] |
rational.json-simplify-49 [=>]0.0 | \[ \frac{1 + \frac{t}{1 + t} \cdot \left(2 \cdot \color{blue}{\left(2 \cdot \frac{t}{1 + t}\right)}\right)}{2 + \frac{2 \cdot t}{1 + t} \cdot \frac{2 \cdot t}{1 + t}}
\] |
rational.json-simplify-2 [=>]0.0 | \[ \frac{1 + \frac{t}{1 + t} \cdot \left(2 \cdot \color{blue}{\left(\frac{t}{1 + t} \cdot 2\right)}\right)}{2 + \frac{2 \cdot t}{1 + t} \cdot \frac{2 \cdot t}{1 + t}}
\] |
rational.json-simplify-43 [=>]0.0 | \[ \frac{1 + \frac{t}{1 + t} \cdot \color{blue}{\left(\frac{t}{1 + t} \cdot \left(2 \cdot 2\right)\right)}}{2 + \frac{2 \cdot t}{1 + t} \cdot \frac{2 \cdot t}{1 + t}}
\] |
metadata-eval [=>]0.0 | \[ \frac{1 + \frac{t}{1 + t} \cdot \left(\frac{t}{1 + t} \cdot \color{blue}{4}\right)}{2 + \frac{2 \cdot t}{1 + t} \cdot \frac{2 \cdot t}{1 + t}}
\] |
rational.json-simplify-2 [=>]0.0 | \[ \frac{1 + \frac{t}{1 + t} \cdot \left(\frac{t}{1 + t} \cdot 4\right)}{2 + \frac{2 \cdot t}{1 + t} \cdot \frac{\color{blue}{t \cdot 2}}{1 + t}}
\] |
rational.json-simplify-49 [=>]0.0 | \[ \frac{1 + \frac{t}{1 + t} \cdot \left(\frac{t}{1 + t} \cdot 4\right)}{2 + \frac{2 \cdot t}{1 + t} \cdot \color{blue}{\left(2 \cdot \frac{t}{1 + t}\right)}}
\] |
rational.json-simplify-2 [=>]0.0 | \[ \frac{1 + \frac{t}{1 + t} \cdot \left(\frac{t}{1 + t} \cdot 4\right)}{2 + \frac{2 \cdot t}{1 + t} \cdot \color{blue}{\left(\frac{t}{1 + t} \cdot 2\right)}}
\] |
rational.json-simplify-43 [=>]0.0 | \[ \frac{1 + \frac{t}{1 + t} \cdot \left(\frac{t}{1 + t} \cdot 4\right)}{2 + \color{blue}{\frac{t}{1 + t} \cdot \left(2 \cdot \frac{2 \cdot t}{1 + t}\right)}}
\] |
Applied egg-rr0.5
Simplified0.0
[Start]0.5 | \[ -1 + \left(1 - \frac{-1 - \frac{t}{t + 1} \cdot \left(\frac{t}{t + 1} \cdot 4\right)}{\frac{t}{t + 1} \cdot \left(\frac{t}{t + 1} \cdot 4\right) + 2}\right)
\] |
|---|---|
rational.json-simplify-1 [=>]0.5 | \[ \color{blue}{\left(1 - \frac{-1 - \frac{t}{t + 1} \cdot \left(\frac{t}{t + 1} \cdot 4\right)}{\frac{t}{t + 1} \cdot \left(\frac{t}{t + 1} \cdot 4\right) + 2}\right) + -1}
\] |
rational.json-simplify-15 [=>]0.5 | \[ \color{blue}{\left(1 - \frac{-1 - \frac{t}{t + 1} \cdot \left(\frac{t}{t + 1} \cdot 4\right)}{\frac{t}{t + 1} \cdot \left(\frac{t}{t + 1} \cdot 4\right) + 2}\right) - 1}
\] |
rational.json-simplify-42 [=>]0.0 | \[ \color{blue}{\left(1 - 1\right) - \frac{-1 - \frac{t}{t + 1} \cdot \left(\frac{t}{t + 1} \cdot 4\right)}{\frac{t}{t + 1} \cdot \left(\frac{t}{t + 1} \cdot 4\right) + 2}}
\] |
metadata-eval [=>]0.0 | \[ \color{blue}{0} - \frac{-1 - \frac{t}{t + 1} \cdot \left(\frac{t}{t + 1} \cdot 4\right)}{\frac{t}{t + 1} \cdot \left(\frac{t}{t + 1} \cdot 4\right) + 2}
\] |
rational.json-simplify-12 [<=]0.0 | \[ \color{blue}{-\frac{-1 - \frac{t}{t + 1} \cdot \left(\frac{t}{t + 1} \cdot 4\right)}{\frac{t}{t + 1} \cdot \left(\frac{t}{t + 1} \cdot 4\right) + 2}}
\] |
rational.json-simplify-10 [=>]0.0 | \[ \color{blue}{\frac{\frac{-1 - \frac{t}{t + 1} \cdot \left(\frac{t}{t + 1} \cdot 4\right)}{\frac{t}{t + 1} \cdot \left(\frac{t}{t + 1} \cdot 4\right) + 2}}{-1}}
\] |
rational.json-simplify-44 [=>]0.0 | \[ \color{blue}{\frac{\frac{-1 - \frac{t}{t + 1} \cdot \left(\frac{t}{t + 1} \cdot 4\right)}{-1}}{\frac{t}{t + 1} \cdot \left(\frac{t}{t + 1} \cdot 4\right) + 2}}
\] |
Final simplification0.0
| Alternative 1 | |
|---|---|
| Error | 0.6 |
| Cost | 584 |
| Alternative 2 | |
|---|---|
| Error | 0.6 |
| Cost | 584 |
| Alternative 3 | |
|---|---|
| Error | 1.0 |
| Cost | 328 |
| Alternative 4 | |
|---|---|
| Error | 26.1 |
| Cost | 64 |
herbie shell --seed 2023074
(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))))))