Average Error: 0.0 → 0.0
Time: 1.8s
Precision: binary64
Cost: 448
\[x \cdot x - y \cdot y\]
\[\left(x + y\right) \cdot \left(x - y\right)\]
x \cdot x - y \cdot y
\left(x + y\right) \cdot \left(x - y\right)
(FPCore (x y) :precision binary64 (- (* x x) (* y y)))
(FPCore (x y) :precision binary64 (* (+ x y) (- x y)))
double code(double x, double y) {
	return (x * x) - (y * y);
}
double code(double x, double y) {
	return (x + y) * (x - y);
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Alternatives

Alternative 1
Error0.0
Cost448
\[x \cdot x - y \cdot y\]
Alternative 2
Error12.8
Cost849
\[\begin{array}{l} \mathbf{if}\;x \leq -3.224450515213971 \cdot 10^{-37} \lor \neg \left(x \leq -5.926855860335571 \cdot 10^{-51} \lor \neg \left(x \leq -5.2058524450127765 \cdot 10^{-65}\right) \land x \leq 7.150922772501069 \cdot 10^{-13}\right):\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;-y \cdot y\\ \end{array}\]
Alternative 3
Error28.5
Cost192
\[x \cdot x\]
Alternative 4
Error55.3
Cost64
\[0\]
Alternative 5
Error61.8
Cost64
\[1\]

Error

Derivation

  1. Initial program 0.0

    \[x \cdot x - y \cdot y\]
  2. Using strategy rm
  3. Applied difference-of-squares_binary64_48210.0

    \[\leadsto \color{blue}{\left(x + y\right) \cdot \left(x - y\right)}\]
  4. Simplified0.0

    \[\leadsto \color{blue}{\left(x + y\right) \cdot \left(x - y\right)}\]
  5. Final simplification0.0

    \[\leadsto \left(x + y\right) \cdot \left(x - y\right)\]

Reproduce

herbie shell --seed 2021044 
(FPCore (x y)
  :name "Examples.Basics.BasicTests:f2 from sbv-4.4"
  :precision binary64
  (- (* x x) (* y y)))