| Alternative 1 | |
|---|---|
| Error | 0.4 |
| Cost | 448 |
(FPCore (t) :precision binary64 (+ (* (+ 1.0 (* t 2e-16)) (+ 1.0 (* t 2e-16))) (- -1.0 (* 2.0 (* t 2e-16)))))
(FPCore (t) :precision binary64 (+ (/ (* (* t 2e-16) (* t 6e-16)) 4.0) (/ (* t (* t 4e-32)) 4.0)))
double code(double t) {
return ((1.0 + (t * 2e-16)) * (1.0 + (t * 2e-16))) + (-1.0 - (2.0 * (t * 2e-16)));
}
double code(double t) {
return (((t * 2e-16) * (t * 6e-16)) / 4.0) + ((t * (t * 4e-32)) / 4.0);
}
real(8) function code(t)
real(8), intent (in) :: t
code = ((1.0d0 + (t * 2d-16)) * (1.0d0 + (t * 2d-16))) + ((-1.0d0) - (2.0d0 * (t * 2d-16)))
end function
real(8) function code(t)
real(8), intent (in) :: t
code = (((t * 2d-16) * (t * 6d-16)) / 4.0d0) + ((t * (t * 4d-32)) / 4.0d0)
end function
public static double code(double t) {
return ((1.0 + (t * 2e-16)) * (1.0 + (t * 2e-16))) + (-1.0 - (2.0 * (t * 2e-16)));
}
public static double code(double t) {
return (((t * 2e-16) * (t * 6e-16)) / 4.0) + ((t * (t * 4e-32)) / 4.0);
}
def code(t): return ((1.0 + (t * 2e-16)) * (1.0 + (t * 2e-16))) + (-1.0 - (2.0 * (t * 2e-16)))
def code(t): return (((t * 2e-16) * (t * 6e-16)) / 4.0) + ((t * (t * 4e-32)) / 4.0)
function code(t) return Float64(Float64(Float64(1.0 + Float64(t * 2e-16)) * Float64(1.0 + Float64(t * 2e-16))) + Float64(-1.0 - Float64(2.0 * Float64(t * 2e-16)))) end
function code(t) return Float64(Float64(Float64(Float64(t * 2e-16) * Float64(t * 6e-16)) / 4.0) + Float64(Float64(t * Float64(t * 4e-32)) / 4.0)) end
function tmp = code(t) tmp = ((1.0 + (t * 2e-16)) * (1.0 + (t * 2e-16))) + (-1.0 - (2.0 * (t * 2e-16))); end
function tmp = code(t) tmp = (((t * 2e-16) * (t * 6e-16)) / 4.0) + ((t * (t * 4e-32)) / 4.0); end
code[t_] := N[(N[(N[(1.0 + N[(t * 2e-16), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(t * 2e-16), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 - N[(2.0 * N[(t * 2e-16), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[t_] := N[(N[(N[(N[(t * 2e-16), $MachinePrecision] * N[(t * 6e-16), $MachinePrecision]), $MachinePrecision] / 4.0), $MachinePrecision] + N[(N[(t * N[(t * 4e-32), $MachinePrecision]), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision]
\left(1 + t \cdot 2 \cdot 10^{-16}\right) \cdot \left(1 + t \cdot 2 \cdot 10^{-16}\right) + \left(-1 - 2 \cdot \left(t \cdot 2 \cdot 10^{-16}\right)\right)
\frac{\left(t \cdot 2 \cdot 10^{-16}\right) \cdot \left(t \cdot 6 \cdot 10^{-16}\right)}{4} + \frac{t \cdot \left(t \cdot 4 \cdot 10^{-32}\right)}{4}
Results
| Original | 61.8 |
|---|---|
| Target | 50.6 |
| Herbie | 0.4 |
Initial program 61.8
Simplified61.8
[Start]61.8 | \[ \left(1 + t \cdot 2 \cdot 10^{-16}\right) \cdot \left(1 + t \cdot 2 \cdot 10^{-16}\right) + \left(-1 - 2 \cdot \left(t \cdot 2 \cdot 10^{-16}\right)\right)
\] |
|---|---|
rational_best-simplify-1 [=>]61.8 | \[ \left(1 + t \cdot 2 \cdot 10^{-16}\right) \cdot \left(1 + t \cdot 2 \cdot 10^{-16}\right) + \left(-1 - 2 \cdot \color{blue}{\left(2 \cdot 10^{-16} \cdot t\right)}\right)
\] |
rational_best-simplify-50 [=>]61.8 | \[ \left(1 + t \cdot 2 \cdot 10^{-16}\right) \cdot \left(1 + t \cdot 2 \cdot 10^{-16}\right) + \left(-1 - \color{blue}{t \cdot \left(2 \cdot 10^{-16} \cdot 2\right)}\right)
\] |
metadata-eval [=>]61.8 | \[ \left(1 + t \cdot 2 \cdot 10^{-16}\right) \cdot \left(1 + t \cdot 2 \cdot 10^{-16}\right) + \left(-1 - t \cdot \color{blue}{4 \cdot 10^{-16}}\right)
\] |
Applied egg-rr61.8
Simplified57.6
[Start]61.8 | \[ \left(-0.5 - t \cdot 2 \cdot 10^{-16}\right) - \left(\left(1 + t \cdot 2 \cdot 10^{-16}\right) \cdot \left(-1 - t \cdot 2 \cdot 10^{-16}\right) + \left(t \cdot 2 \cdot 10^{-16} + 0.5\right)\right)
\] |
|---|---|
rational_best-simplify-48 [=>]57.6 | \[ \color{blue}{\left(-0.5 - \left(\left(1 + t \cdot 2 \cdot 10^{-16}\right) \cdot \left(-1 - t \cdot 2 \cdot 10^{-16}\right) + \left(t \cdot 2 \cdot 10^{-16} + 0.5\right)\right)\right) - t \cdot 2 \cdot 10^{-16}}
\] |
rational_best-simplify-47 [=>]57.6 | \[ \left(-0.5 - \color{blue}{\left(0.5 + \left(t \cdot 2 \cdot 10^{-16} + \left(1 + t \cdot 2 \cdot 10^{-16}\right) \cdot \left(-1 - t \cdot 2 \cdot 10^{-16}\right)\right)\right)}\right) - t \cdot 2 \cdot 10^{-16}
\] |
rational_best-simplify-57 [=>]57.6 | \[ \color{blue}{\left(\left(-0.5 - 0.5\right) + \left(-\left(t \cdot 2 \cdot 10^{-16} + \left(1 + t \cdot 2 \cdot 10^{-16}\right) \cdot \left(-1 - t \cdot 2 \cdot 10^{-16}\right)\right)\right)\right)} - t \cdot 2 \cdot 10^{-16}
\] |
metadata-eval [=>]57.6 | \[ \left(\color{blue}{-1} + \left(-\left(t \cdot 2 \cdot 10^{-16} + \left(1 + t \cdot 2 \cdot 10^{-16}\right) \cdot \left(-1 - t \cdot 2 \cdot 10^{-16}\right)\right)\right)\right) - t \cdot 2 \cdot 10^{-16}
\] |
rational_best-simplify-1 [=>]57.6 | \[ \left(-1 + \left(-\left(t \cdot 2 \cdot 10^{-16} + \color{blue}{\left(-1 - t \cdot 2 \cdot 10^{-16}\right) \cdot \left(1 + t \cdot 2 \cdot 10^{-16}\right)}\right)\right)\right) - t \cdot 2 \cdot 10^{-16}
\] |
rational_best-simplify-3 [=>]57.6 | \[ \left(-1 + \left(-\left(t \cdot 2 \cdot 10^{-16} + \left(-1 - t \cdot 2 \cdot 10^{-16}\right) \cdot \color{blue}{\left(t \cdot 2 \cdot 10^{-16} + 1\right)}\right)\right)\right) - t \cdot 2 \cdot 10^{-16}
\] |
Applied egg-rr61.8
Simplified0.5
[Start]61.8 | \[ -1 + \left(\left(-1 - t \cdot 2 \cdot 10^{-16}\right) \cdot \left(-1 - t \cdot 2 \cdot 10^{-16}\right) + t \cdot -4 \cdot 10^{-16}\right)
\] |
|---|---|
rational_best-simplify-3 [<=]61.8 | \[ \color{blue}{\left(\left(-1 - t \cdot 2 \cdot 10^{-16}\right) \cdot \left(-1 - t \cdot 2 \cdot 10^{-16}\right) + t \cdot -4 \cdot 10^{-16}\right) + -1}
\] |
rational_best-simplify-19 [=>]61.8 | \[ \color{blue}{\left(\left(-1 - t \cdot 2 \cdot 10^{-16}\right) \cdot \left(-1 - t \cdot 2 \cdot 10^{-16}\right) + t \cdot -4 \cdot 10^{-16}\right) - 1}
\] |
rational_best-simplify-59 [=>]61.8 | \[ \color{blue}{\left(t \cdot -4 \cdot 10^{-16} - \left(-\left(-1 - t \cdot 2 \cdot 10^{-16}\right) \cdot \left(-1 - t \cdot 2 \cdot 10^{-16}\right)\right)\right)} - 1
\] |
rational_best-simplify-52 [=>]57.6 | \[ \color{blue}{t \cdot -4 \cdot 10^{-16} - \left(1 + \left(-\left(-1 - t \cdot 2 \cdot 10^{-16}\right) \cdot \left(-1 - t \cdot 2 \cdot 10^{-16}\right)\right)\right)}
\] |
metadata-eval [<=]57.6 | \[ t \cdot \color{blue}{\left(-2 \cdot 10^{-16} + -2 \cdot 10^{-16}\right)} - \left(1 + \left(-\left(-1 - t \cdot 2 \cdot 10^{-16}\right) \cdot \left(-1 - t \cdot 2 \cdot 10^{-16}\right)\right)\right)
\] |
rational_best-simplify-63 [<=]57.6 | \[ \color{blue}{\left(-2 \cdot 10^{-16} \cdot t + -2 \cdot 10^{-16} \cdot t\right)} - \left(1 + \left(-\left(-1 - t \cdot 2 \cdot 10^{-16}\right) \cdot \left(-1 - t \cdot 2 \cdot 10^{-16}\right)\right)\right)
\] |
rational_best-simplify-1 [<=]57.6 | \[ \left(\color{blue}{t \cdot -2 \cdot 10^{-16}} + -2 \cdot 10^{-16} \cdot t\right) - \left(1 + \left(-\left(-1 - t \cdot 2 \cdot 10^{-16}\right) \cdot \left(-1 - t \cdot 2 \cdot 10^{-16}\right)\right)\right)
\] |
rational_best-simplify-1 [<=]57.6 | \[ \left(t \cdot -2 \cdot 10^{-16} + \color{blue}{t \cdot -2 \cdot 10^{-16}}\right) - \left(1 + \left(-\left(-1 - t \cdot 2 \cdot 10^{-16}\right) \cdot \left(-1 - t \cdot 2 \cdot 10^{-16}\right)\right)\right)
\] |
rational_best-simplify-76 [=>]61.8 | \[ \color{blue}{\left(t \cdot -2 \cdot 10^{-16} - 1\right) + \left(t \cdot -2 \cdot 10^{-16} - \left(-\left(-1 - t \cdot 2 \cdot 10^{-16}\right) \cdot \left(-1 - t \cdot 2 \cdot 10^{-16}\right)\right)\right)}
\] |
rational_best-simplify-18 [=>]61.8 | \[ \color{blue}{\left(t \cdot -2 \cdot 10^{-16} + -1\right)} + \left(t \cdot -2 \cdot 10^{-16} - \left(-\left(-1 - t \cdot 2 \cdot 10^{-16}\right) \cdot \left(-1 - t \cdot 2 \cdot 10^{-16}\right)\right)\right)
\] |
metadata-eval [<=]61.8 | \[ \left(t \cdot \color{blue}{\left(2 \cdot 10^{-16} \cdot -1\right)} + -1\right) + \left(t \cdot -2 \cdot 10^{-16} - \left(-\left(-1 - t \cdot 2 \cdot 10^{-16}\right) \cdot \left(-1 - t \cdot 2 \cdot 10^{-16}\right)\right)\right)
\] |
rational_best-simplify-50 [<=]61.8 | \[ \left(\color{blue}{-1 \cdot \left(2 \cdot 10^{-16} \cdot t\right)} + -1\right) + \left(t \cdot -2 \cdot 10^{-16} - \left(-\left(-1 - t \cdot 2 \cdot 10^{-16}\right) \cdot \left(-1 - t \cdot 2 \cdot 10^{-16}\right)\right)\right)
\] |
rational_best-simplify-1 [=>]61.8 | \[ \left(-1 \cdot \color{blue}{\left(t \cdot 2 \cdot 10^{-16}\right)} + -1\right) + \left(t \cdot -2 \cdot 10^{-16} - \left(-\left(-1 - t \cdot 2 \cdot 10^{-16}\right) \cdot \left(-1 - t \cdot 2 \cdot 10^{-16}\right)\right)\right)
\] |
rational_best-simplify-1 [<=]61.8 | \[ \left(\color{blue}{\left(t \cdot 2 \cdot 10^{-16}\right) \cdot -1} + -1\right) + \left(t \cdot -2 \cdot 10^{-16} - \left(-\left(-1 - t \cdot 2 \cdot 10^{-16}\right) \cdot \left(-1 - t \cdot 2 \cdot 10^{-16}\right)\right)\right)
\] |
rational_best-simplify-11 [<=]61.8 | \[ \left(\color{blue}{\left(-t \cdot 2 \cdot 10^{-16}\right)} + -1\right) + \left(t \cdot -2 \cdot 10^{-16} - \left(-\left(-1 - t \cdot 2 \cdot 10^{-16}\right) \cdot \left(-1 - t \cdot 2 \cdot 10^{-16}\right)\right)\right)
\] |
rational_best-simplify-14 [=>]61.8 | \[ \left(\color{blue}{\left(0 - t \cdot 2 \cdot 10^{-16}\right)} + -1\right) + \left(t \cdot -2 \cdot 10^{-16} - \left(-\left(-1 - t \cdot 2 \cdot 10^{-16}\right) \cdot \left(-1 - t \cdot 2 \cdot 10^{-16}\right)\right)\right)
\] |
metadata-eval [<=]61.8 | \[ \left(\left(0 - t \cdot 2 \cdot 10^{-16}\right) + \color{blue}{\left(-1\right)}\right) + \left(t \cdot -2 \cdot 10^{-16} - \left(-\left(-1 - t \cdot 2 \cdot 10^{-16}\right) \cdot \left(-1 - t \cdot 2 \cdot 10^{-16}\right)\right)\right)
\] |
rational_best-simplify-57 [<=]61.8 | \[ \color{blue}{\left(0 - \left(t \cdot 2 \cdot 10^{-16} + 1\right)\right)} + \left(t \cdot -2 \cdot 10^{-16} - \left(-\left(-1 - t \cdot 2 \cdot 10^{-16}\right) \cdot \left(-1 - t \cdot 2 \cdot 10^{-16}\right)\right)\right)
\] |
rational_best-simplify-21 [=>]61.8 | \[ \left(0 - \color{blue}{\left(t \cdot 2 \cdot 10^{-16} - -1\right)}\right) + \left(t \cdot -2 \cdot 10^{-16} - \left(-\left(-1 - t \cdot 2 \cdot 10^{-16}\right) \cdot \left(-1 - t \cdot 2 \cdot 10^{-16}\right)\right)\right)
\] |
rational_best-simplify-51 [=>]61.8 | \[ \color{blue}{\left(-1 - \left(t \cdot 2 \cdot 10^{-16} - 0\right)\right)} + \left(t \cdot -2 \cdot 10^{-16} - \left(-\left(-1 - t \cdot 2 \cdot 10^{-16}\right) \cdot \left(-1 - t \cdot 2 \cdot 10^{-16}\right)\right)\right)
\] |
rational_best-simplify-9 [=>]61.8 | \[ \left(-1 - \color{blue}{t \cdot 2 \cdot 10^{-16}}\right) + \left(t \cdot -2 \cdot 10^{-16} - \left(-\left(-1 - t \cdot 2 \cdot 10^{-16}\right) \cdot \left(-1 - t \cdot 2 \cdot 10^{-16}\right)\right)\right)
\] |
Applied egg-rr0.4
Final simplification0.4
| Alternative 1 | |
|---|---|
| Error | 0.4 |
| Cost | 448 |
| Alternative 2 | |
|---|---|
| Error | 0.4 |
| Cost | 320 |
| Alternative 3 | |
|---|---|
| Error | 0.4 |
| Cost | 320 |
herbie shell --seed 2023099
(FPCore (t)
:name "fma_test1"
:precision binary64
:pre (and (<= 0.9 t) (<= t 1.1))
:herbie-target
(fma (+ 1.0 (* t 2e-16)) (+ 1.0 (* t 2e-16)) (- -1.0 (* 2.0 (* t 2e-16))))
(+ (* (+ 1.0 (* t 2e-16)) (+ 1.0 (* t 2e-16))) (- -1.0 (* 2.0 (* t 2e-16)))))