?

Average Error: 61.8 → 0.4
Time: 29.5s
Precision: binary64
Cost: 1088

?

\[0.9 \leq t \land t \leq 1.1\]
\[\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} \]
(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}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original61.8
Target50.6
Herbie0.4
\[\mathsf{fma}\left(1 + t \cdot 2 \cdot 10^{-16}, 1 + t \cdot 2 \cdot 10^{-16}, -1 - 2 \cdot \left(t \cdot 2 \cdot 10^{-16}\right)\right) \]

Derivation?

  1. Initial program 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) \]
  2. Simplified61.8

    \[\leadsto \color{blue}{\left(1 + t \cdot 2 \cdot 10^{-16}\right) \cdot \left(1 + t \cdot 2 \cdot 10^{-16}\right) + \left(-1 - t \cdot 4 \cdot 10^{-16}\right)} \]
    Proof

    [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) \]
  3. Applied egg-rr61.8

    \[\leadsto \color{blue}{\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)} \]
  4. Simplified57.6

    \[\leadsto \color{blue}{\left(-1 + \left(-\left(t \cdot 2 \cdot 10^{-16} + \left(-1 - t \cdot 2 \cdot 10^{-16}\right) \cdot \left(t \cdot 2 \cdot 10^{-16} + 1\right)\right)\right)\right) - t \cdot 2 \cdot 10^{-16}} \]
    Proof

    [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} \]
  5. Applied egg-rr61.8

    \[\leadsto \color{blue}{-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)} \]
  6. Simplified0.5

    \[\leadsto \color{blue}{\left(t \cdot 2 \cdot 10^{-16}\right) \cdot \left(t \cdot 2 \cdot 10^{-16}\right)} \]
    Proof

    [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) \]
  7. Applied egg-rr0.4

    \[\leadsto \color{blue}{\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}} \]
  8. Final simplification0.4

    \[\leadsto \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} \]

Alternatives

Alternative 1
Error0.4
Cost448
\[t \cdot \left(\left(t \cdot 3.2 \cdot 10^{-15}\right) \cdot 1.25 \cdot 10^{-17}\right) \]
Alternative 2
Error0.4
Cost320
\[4 \cdot 10^{-32} \cdot \left(t \cdot t\right) \]
Alternative 3
Error0.4
Cost320
\[t \cdot \left(4 \cdot 10^{-32} \cdot t\right) \]

Error

Reproduce?

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)))))