Average Error: 0.0 → 0.0
Time: 11.1s
Precision: binary64
Cost: 1344
\[1 - \frac{1}{2 + \left(2 - \frac{\frac{2}{t}}{1 + \frac{1}{t}}\right) \cdot \left(2 - \frac{\frac{2}{t}}{1 + \frac{1}{t}}\right)} \]
\[1 + \frac{-1}{2 + \left(2 + \frac{2}{-1 - t}\right) \cdot \left(2 + \frac{-2}{1 + t}\right)} \]
(FPCore (t)
 :precision binary64
 (-
  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)))))))))
(FPCore (t)
 :precision binary64
 (+
  1.0
  (/ -1.0 (+ 2.0 (* (+ 2.0 (/ 2.0 (- -1.0 t))) (+ 2.0 (/ -2.0 (+ 1.0 t))))))))
double code(double t) {
	return 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)))))));
}
double code(double t) {
	return 1.0 + (-1.0 / (2.0 + ((2.0 + (2.0 / (-1.0 - t))) * (2.0 + (-2.0 / (1.0 + t))))));
}
real(8) function code(t)
    real(8), intent (in) :: t
    code = 1.0d0 - (1.0d0 / (2.0d0 + ((2.0d0 - ((2.0d0 / t) / (1.0d0 + (1.0d0 / t)))) * (2.0d0 - ((2.0d0 / t) / (1.0d0 + (1.0d0 / t)))))))
end function
real(8) function code(t)
    real(8), intent (in) :: t
    code = 1.0d0 + ((-1.0d0) / (2.0d0 + ((2.0d0 + (2.0d0 / ((-1.0d0) - t))) * (2.0d0 + ((-2.0d0) / (1.0d0 + t))))))
end function
public static double code(double t) {
	return 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)))))));
}
public static double code(double t) {
	return 1.0 + (-1.0 / (2.0 + ((2.0 + (2.0 / (-1.0 - t))) * (2.0 + (-2.0 / (1.0 + t))))));
}
def code(t):
	return 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)))))))
def code(t):
	return 1.0 + (-1.0 / (2.0 + ((2.0 + (2.0 / (-1.0 - t))) * (2.0 + (-2.0 / (1.0 + t))))))
function code(t)
	return Float64(1.0 - Float64(1.0 / Float64(2.0 + Float64(Float64(2.0 - Float64(Float64(2.0 / t) / Float64(1.0 + Float64(1.0 / t)))) * Float64(2.0 - Float64(Float64(2.0 / t) / Float64(1.0 + Float64(1.0 / t))))))))
end
function code(t)
	return Float64(1.0 + Float64(-1.0 / Float64(2.0 + Float64(Float64(2.0 + Float64(2.0 / Float64(-1.0 - t))) * Float64(2.0 + Float64(-2.0 / Float64(1.0 + t)))))))
end
function tmp = code(t)
	tmp = 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)))))));
end
function tmp = code(t)
	tmp = 1.0 + (-1.0 / (2.0 + ((2.0 + (2.0 / (-1.0 - t))) * (2.0 + (-2.0 / (1.0 + t))))));
end
code[t_] := N[(1.0 - N[(1.0 / N[(2.0 + 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[(N[(2.0 / t), $MachinePrecision] / N[(1.0 + N[(1.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[t_] := N[(1.0 + N[(-1.0 / N[(2.0 + N[(N[(2.0 + N[(2.0 / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 + N[(-2.0 / N[(1.0 + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
1 - \frac{1}{2 + \left(2 - \frac{\frac{2}{t}}{1 + \frac{1}{t}}\right) \cdot \left(2 - \frac{\frac{2}{t}}{1 + \frac{1}{t}}\right)}
1 + \frac{-1}{2 + \left(2 + \frac{2}{-1 - t}\right) \cdot \left(2 + \frac{-2}{1 + t}\right)}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[1 - \frac{1}{2 + \left(2 - \frac{\frac{2}{t}}{1 + \frac{1}{t}}\right) \cdot \left(2 - \frac{\frac{2}{t}}{1 + \frac{1}{t}}\right)} \]
  2. Applied egg-rr0.0

    \[\leadsto 1 - \frac{1}{2 + \left(2 - \frac{\frac{2}{t}}{1 + \frac{1}{t}}\right) \cdot \color{blue}{\left(2 + \frac{\frac{-2}{t}}{1 + \frac{1}{t}}\right)}} \]
  3. Simplified0.0

    \[\leadsto 1 - \frac{1}{2 + \left(2 - \frac{\frac{2}{t}}{1 + \frac{1}{t}}\right) \cdot \color{blue}{\left(2 + \frac{-2}{t + 1}\right)}} \]
    Proof
    (-.f64 1 (/.f64 1 (+.f64 2 (*.f64 (-.f64 2 (/.f64 (/.f64 2 t) (+.f64 1 (/.f64 1 t)))) (+.f64 2 (/.f64 -2 (+.f64 t 1))))))): 0 points increase in error, 0 points decrease in error
    (-.f64 1 (/.f64 1 (+.f64 2 (*.f64 (-.f64 2 (/.f64 (/.f64 2 t) (+.f64 1 (/.f64 1 t)))) (+.f64 2 (/.f64 -2 (+.f64 (Rewrite<= *-lft-identity_binary64 (*.f64 1 t)) 1))))))): 0 points increase in error, 0 points decrease in error
    (-.f64 1 (/.f64 1 (+.f64 2 (*.f64 (-.f64 2 (/.f64 (/.f64 2 t) (+.f64 1 (/.f64 1 t)))) (+.f64 2 (/.f64 -2 (+.f64 (*.f64 1 t) (Rewrite<= lft-mult-inverse_binary64 (*.f64 (/.f64 1 t) t))))))))): 0 points increase in error, 0 points decrease in error
    (-.f64 1 (/.f64 1 (+.f64 2 (*.f64 (-.f64 2 (/.f64 (/.f64 2 t) (+.f64 1 (/.f64 1 t)))) (+.f64 2 (/.f64 -2 (Rewrite<= distribute-rgt-in_binary64 (*.f64 t (+.f64 1 (/.f64 1 t)))))))))): 0 points increase in error, 0 points decrease in error
    (-.f64 1 (/.f64 1 (+.f64 2 (*.f64 (-.f64 2 (/.f64 (/.f64 2 t) (+.f64 1 (/.f64 1 t)))) (+.f64 2 (Rewrite=> associate-/r*_binary64 (/.f64 (/.f64 -2 t) (+.f64 1 (/.f64 1 t))))))))): 0 points increase in error, 0 points decrease in error
  4. Applied egg-rr0.0

    \[\leadsto 1 - \frac{1}{2 + \color{blue}{\left(4 + \left(2 \cdot \frac{\frac{-2}{t}}{1 + \frac{1}{t}} + \frac{2}{-1 - t} \cdot \left(2 + \frac{\frac{-2}{t}}{1 + \frac{1}{t}}\right)\right)\right)}} \]
  5. Simplified0.0

    \[\leadsto 1 - \frac{1}{2 + \color{blue}{\left(2 + \frac{2}{-1 - t}\right) \cdot \left(2 + \frac{-2}{t + 1}\right)}} \]
    Proof
    (-.f64 1 (/.f64 1 (+.f64 2 (*.f64 (+.f64 2 (/.f64 2 (-.f64 -1 t))) (+.f64 2 (/.f64 -2 (+.f64 t 1))))))): 0 points increase in error, 0 points decrease in error
    (-.f64 1 (/.f64 1 (+.f64 2 (*.f64 (+.f64 2 (/.f64 2 (-.f64 -1 t))) (+.f64 2 (/.f64 -2 (+.f64 (Rewrite<= *-rgt-identity_binary64 (*.f64 t 1)) 1))))))): 0 points increase in error, 0 points decrease in error
    (-.f64 1 (/.f64 1 (+.f64 2 (*.f64 (+.f64 2 (/.f64 2 (-.f64 -1 t))) (+.f64 2 (/.f64 -2 (+.f64 (*.f64 t 1) (Rewrite<= rgt-mult-inverse_binary64 (*.f64 t (/.f64 1 t)))))))))): 0 points increase in error, 0 points decrease in error
    (-.f64 1 (/.f64 1 (+.f64 2 (*.f64 (+.f64 2 (/.f64 2 (-.f64 -1 t))) (+.f64 2 (/.f64 -2 (Rewrite<= distribute-lft-in_binary64 (*.f64 t (+.f64 1 (/.f64 1 t)))))))))): 0 points increase in error, 0 points decrease in error
    (-.f64 1 (/.f64 1 (+.f64 2 (*.f64 (+.f64 2 (/.f64 2 (-.f64 -1 t))) (+.f64 2 (Rewrite=> associate-/r*_binary64 (/.f64 (/.f64 -2 t) (+.f64 1 (/.f64 1 t))))))))): 0 points increase in error, 0 points decrease in error
    (-.f64 1 (/.f64 1 (+.f64 2 (Rewrite=> *-commutative_binary64 (*.f64 (+.f64 2 (/.f64 (/.f64 -2 t) (+.f64 1 (/.f64 1 t)))) (+.f64 2 (/.f64 2 (-.f64 -1 t)))))))): 0 points increase in error, 0 points decrease in error
    (-.f64 1 (/.f64 1 (+.f64 2 (Rewrite=> distribute-rgt-in_binary64 (+.f64 (*.f64 2 (+.f64 2 (/.f64 (/.f64 -2 t) (+.f64 1 (/.f64 1 t))))) (*.f64 (/.f64 2 (-.f64 -1 t)) (+.f64 2 (/.f64 (/.f64 -2 t) (+.f64 1 (/.f64 1 t)))))))))): 0 points increase in error, 0 points decrease in error
    (-.f64 1 (/.f64 1 (+.f64 2 (+.f64 (Rewrite=> distribute-lft-in_binary64 (+.f64 (*.f64 2 2) (*.f64 2 (/.f64 (/.f64 -2 t) (+.f64 1 (/.f64 1 t)))))) (*.f64 (/.f64 2 (-.f64 -1 t)) (+.f64 2 (/.f64 (/.f64 -2 t) (+.f64 1 (/.f64 1 t))))))))): 0 points increase in error, 0 points decrease in error
    (-.f64 1 (/.f64 1 (+.f64 2 (+.f64 (+.f64 (Rewrite=> metadata-eval 4) (*.f64 2 (/.f64 (/.f64 -2 t) (+.f64 1 (/.f64 1 t))))) (*.f64 (/.f64 2 (-.f64 -1 t)) (+.f64 2 (/.f64 (/.f64 -2 t) (+.f64 1 (/.f64 1 t))))))))): 0 points increase in error, 0 points decrease in error
    (-.f64 1 (/.f64 1 (+.f64 2 (Rewrite<= associate-+r+_binary64 (+.f64 4 (+.f64 (*.f64 2 (/.f64 (/.f64 -2 t) (+.f64 1 (/.f64 1 t)))) (*.f64 (/.f64 2 (-.f64 -1 t)) (+.f64 2 (/.f64 (/.f64 -2 t) (+.f64 1 (/.f64 1 t))))))))))): 0 points increase in error, 0 points decrease in error
  6. Final simplification0.0

    \[\leadsto 1 + \frac{-1}{2 + \left(2 + \frac{2}{-1 - t}\right) \cdot \left(2 + \frac{-2}{1 + t}\right)} \]

Alternatives

Alternative 1
Error0.5
Cost1224
\[\begin{array}{l} \mathbf{if}\;t \leq -0.8:\\ \;\;\;\;\frac{\frac{0.037037037037037035}{t}}{t} + \left(0.8333333333333334 + \frac{-0.2222222222222222}{t}\right)\\ \mathbf{elif}\;t \leq 1.95:\\ \;\;\;\;1 + \frac{-1}{2 + \left(t \cdot t\right) \cdot \left(4 + t \cdot -8\right)}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{-1}{6 + \frac{-8}{t}}\\ \end{array} \]
Alternative 2
Error0.0
Cost1088
\[1 + \frac{-1}{\frac{\frac{4}{1 + t} + -8}{1 + t} + 6} \]
Alternative 3
Error0.5
Cost968
\[\begin{array}{l} \mathbf{if}\;t \leq -0.65:\\ \;\;\;\;\frac{\frac{0.037037037037037035}{t}}{t} + \left(0.8333333333333334 + \frac{-0.2222222222222222}{t}\right)\\ \mathbf{elif}\;t \leq 2.1:\\ \;\;\;\;1 + \frac{-1}{2 + 4 \cdot \left(t \cdot t\right)}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{-1}{6 + \frac{-8}{t}}\\ \end{array} \]
Alternative 4
Error0.5
Cost840
\[\begin{array}{l} \mathbf{if}\;t \leq -0.85:\\ \;\;\;\;\frac{1}{1.2 + \frac{0.32}{t}}\\ \mathbf{elif}\;t \leq 1.65:\\ \;\;\;\;t \cdot t + 0.5\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{-1}{6 + \frac{-8}{t}}\\ \end{array} \]
Alternative 5
Error0.5
Cost840
\[\begin{array}{l} \mathbf{if}\;t \leq -0.82:\\ \;\;\;\;\frac{\frac{0.037037037037037035}{t}}{t} + \left(0.8333333333333334 + \frac{-0.2222222222222222}{t}\right)\\ \mathbf{elif}\;t \leq 1.65:\\ \;\;\;\;t \cdot t + 0.5\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{-1}{6 + \frac{-8}{t}}\\ \end{array} \]
Alternative 6
Error0.5
Cost585
\[\begin{array}{l} \mathbf{if}\;t \leq -0.78 \lor \neg \left(t \leq 0.56\right):\\ \;\;\;\;0.8333333333333334 + \frac{-0.2222222222222222}{t}\\ \mathbf{else}:\\ \;\;\;\;t \cdot t + 0.5\\ \end{array} \]
Alternative 7
Error0.9
Cost584
\[\begin{array}{l} \mathbf{if}\;t \leq -0.9:\\ \;\;\;\;0.8333333333333334\\ \mathbf{elif}\;t \leq 0.58:\\ \;\;\;\;t \cdot t + 0.5\\ \mathbf{else}:\\ \;\;\;\;0.8333333333333334\\ \end{array} \]
Alternative 8
Error0.5
Cost584
\[\begin{array}{l} \mathbf{if}\;t \leq -0.78:\\ \;\;\;\;\left(1 + \frac{-0.2222222222222222}{t}\right) + -0.16666666666666666\\ \mathbf{elif}\;t \leq 0.56:\\ \;\;\;\;t \cdot t + 0.5\\ \mathbf{else}:\\ \;\;\;\;0.8333333333333334 + \frac{-0.2222222222222222}{t}\\ \end{array} \]
Alternative 9
Error0.5
Cost584
\[\begin{array}{l} \mathbf{if}\;t \leq -0.78:\\ \;\;\;\;1 + \left(-0.16666666666666666 + \frac{-0.2222222222222222}{t}\right)\\ \mathbf{elif}\;t \leq 0.56:\\ \;\;\;\;t \cdot t + 0.5\\ \mathbf{else}:\\ \;\;\;\;0.8333333333333334 + \frac{-0.2222222222222222}{t}\\ \end{array} \]
Alternative 10
Error0.5
Cost584
\[\begin{array}{l} \mathbf{if}\;t \leq -0.85:\\ \;\;\;\;\frac{1}{1.2 + \frac{0.32}{t}}\\ \mathbf{elif}\;t \leq 0.56:\\ \;\;\;\;t \cdot t + 0.5\\ \mathbf{else}:\\ \;\;\;\;0.8333333333333334 + \frac{-0.2222222222222222}{t}\\ \end{array} \]
Alternative 11
Error0.9
Cost328
\[\begin{array}{l} \mathbf{if}\;t \leq -0.33:\\ \;\;\;\;0.8333333333333334\\ \mathbf{elif}\;t \leq 1:\\ \;\;\;\;0.5\\ \mathbf{else}:\\ \;\;\;\;0.8333333333333334\\ \end{array} \]
Alternative 12
Error26.1
Cost64
\[0.5 \]

Error

Reproduce

herbie shell --seed 2022343 
(FPCore (t)
  :name "Kahan p13 Example 3"
  :precision binary64
  (- 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)))))))))