Average Error: 0.2 → 0.2
Time: 13.1s
Precision: binary64
Cost: 320
\[\left(x \cdot 3\right) \cdot x\]
\[x \cdot \left(x \cdot 3\right)\]
\left(x \cdot 3\right) \cdot x
x \cdot \left(x \cdot 3\right)
(FPCore (x) :precision binary64 (* (* x 3.0) x))
(FPCore (x) :precision binary64 (* x (* x 3.0)))
double code(double x) {
	return (x * 3.0) * x;
}
double code(double x) {
	return x * (x * 3.0);
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Alternatives

Alternative 1
Error0.2
Cost320
\[3 \cdot \left(x \cdot x\right)\]
Alternative 2
Error42.1
Cost64
\[0\]
Alternative 3
Error61.0
Cost64
\[1\]

Error

Time

Derivation

  1. Initial program 0.2

    \[\left(x \cdot 3\right) \cdot x\]
  2. Using strategy rm
  3. Applied *-un-lft-identity_binary64_45110.2

    \[\leadsto \color{blue}{1 \cdot \left(\left(x \cdot 3\right) \cdot x\right)}\]
  4. Using strategy rm
  5. Applied pow1_binary64_45720.2

    \[\leadsto 1 \cdot \color{blue}{{\left(\left(x \cdot 3\right) \cdot x\right)}^{1}}\]
  6. Using strategy rm
  7. Applied *-un-lft-identity_binary64_45110.2

    \[\leadsto 1 \cdot {\color{blue}{\left(1 \cdot \left(\left(x \cdot 3\right) \cdot x\right)\right)}}^{1}\]
  8. Using strategy rm
  9. Applied associate-*l*_binary64_44520.2

    \[\leadsto 1 \cdot {\left(1 \cdot \color{blue}{\left(x \cdot \left(3 \cdot x\right)\right)}\right)}^{1}\]
  10. Simplified0.2

    \[\leadsto 1 \cdot {\left(1 \cdot \left(x \cdot \color{blue}{\left(x \cdot 3\right)}\right)\right)}^{1}\]
  11. Simplified0.2

    \[\leadsto \color{blue}{x \cdot \left(x \cdot 3\right)}\]
  12. Final simplification0.2

    \[\leadsto x \cdot \left(x \cdot 3\right)\]

Reproduce

herbie shell --seed 2021065 
(FPCore (x)
  :name "Diagrams.Tangent:$catParam from diagrams-lib-1.3.0.3, F"
  :precision binary64
  (* (* x 3.0) x))