?

Average Accuracy: 3.4% → 99.4%
Time: 4.0s
Precision: binary64
Cost: 448

?

\[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) \]
\[2 \cdot 10^{-16} \cdot \left(t \cdot \left(t \cdot 2 \cdot 10^{-16}\right)\right) \]
(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 (* 2e-16 (* t (* t 2e-16))))
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 2e-16 * (t * (t * 2e-16));
}
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 = 2d-16 * (t * (t * 2d-16))
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 2e-16 * (t * (t * 2e-16));
}
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 2e-16 * (t * (t * 2e-16))
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(2e-16 * Float64(t * Float64(t * 2e-16)))
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 = 2e-16 * (t * (t * 2e-16));
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[(2e-16 * N[(t * N[(t * 2e-16), $MachinePrecision]), $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)
2 \cdot 10^{-16} \cdot \left(t \cdot \left(t \cdot 2 \cdot 10^{-16}\right)\right)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original3.4%
Target21.0%
Herbie99.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 3.4%

    \[\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. Simplified99.3%

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

    [Start]3.4

    \[ \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) \]

    cancel-sign-sub-inv [=>]3.4

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

    distribute-rgt-in [=>]3.4

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

    cancel-sign-sub-inv [<=]3.4

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

    associate-+l+ [=>]3.4

    \[ \color{blue}{1 \cdot \left(1 + t \cdot 2 \cdot 10^{-16}\right) + \left(\left(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)\right)} \]

    *-lft-identity [=>]3.4

    \[ \color{blue}{\left(1 + t \cdot 2 \cdot 10^{-16}\right)} + \left(\left(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)\right) \]

    +-commutative [=>]3.4

    \[ \color{blue}{\left(\left(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)\right) + \left(1 + t \cdot 2 \cdot 10^{-16}\right)} \]

    associate-+r+ [<=]1.7

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

    *-commutative [=>]1.7

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

    associate-*l* [=>]1.7

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

    +-commutative [=>]1.7

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

    associate-+r- [=>]10.0

    \[ 2 \cdot 10^{-16} \cdot \left(t \cdot \left(1 + t \cdot 2 \cdot 10^{-16}\right)\right) + \color{blue}{\left(\left(\left(1 + t \cdot 2 \cdot 10^{-16}\right) + -1\right) - 2 \cdot \left(t \cdot 2 \cdot 10^{-16}\right)\right)} \]
  3. Applied egg-rr99.2%

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

    [Start]99.3

    \[ t \cdot \left(t \cdot 4 \cdot 10^{-32}\right) \]

    add-sqr-sqrt [=>]99.0

    \[ \color{blue}{\sqrt{t \cdot \left(t \cdot 4 \cdot 10^{-32}\right)} \cdot \sqrt{t \cdot \left(t \cdot 4 \cdot 10^{-32}\right)}} \]

    pow2 [=>]99.0

    \[ \color{blue}{{\left(\sqrt{t \cdot \left(t \cdot 4 \cdot 10^{-32}\right)}\right)}^{2}} \]

    associate-*r* [=>]99.0

    \[ {\left(\sqrt{\color{blue}{\left(t \cdot t\right) \cdot 4 \cdot 10^{-32}}}\right)}^{2} \]

    sqrt-prod [=>]99.2

    \[ {\color{blue}{\left(\sqrt{t \cdot t} \cdot \sqrt{4 \cdot 10^{-32}}\right)}}^{2} \]

    sqrt-unprod [<=]98.4

    \[ {\left(\color{blue}{\left(\sqrt{t} \cdot \sqrt{t}\right)} \cdot \sqrt{4 \cdot 10^{-32}}\right)}^{2} \]

    add-sqr-sqrt [<=]99.2

    \[ {\left(\color{blue}{t} \cdot \sqrt{4 \cdot 10^{-32}}\right)}^{2} \]

    metadata-eval [=>]99.2

    \[ {\left(t \cdot \color{blue}{2 \cdot 10^{-16}}\right)}^{2} \]
  4. Applied egg-rr99.4%

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

    [Start]99.2

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

    unpow2 [=>]99.2

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

    associate-*r* [=>]99.4

    \[ \color{blue}{\left(\left(t \cdot 2 \cdot 10^{-16}\right) \cdot t\right) \cdot 2 \cdot 10^{-16}} \]
  5. Final simplification99.4%

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

Alternatives

Alternative 1
Accuracy99.4%
Cost448
\[t \cdot \left(2 \cdot 10^{-16} \cdot \left(t \cdot 2 \cdot 10^{-16}\right)\right) \]
Alternative 2
Accuracy99.3%
Cost320
\[4 \cdot 10^{-32} \cdot \left(t \cdot t\right) \]

Error

Reproduce?

herbie shell --seed 2023126 
(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)))))