Average Error: 0.1 → 0.1
Time: 3.5s
Precision: binary64
Cost: 704
\[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
\[3 - \left(x \cdot 12 + x \cdot \left(x \cdot -9\right)\right)\]
3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
3 - \left(x \cdot 12 + x \cdot \left(x \cdot -9\right)\right)
(FPCore (x) :precision binary64 (* 3.0 (+ (- (* (* x 3.0) x) (* x 4.0)) 1.0)))
(FPCore (x) :precision binary64 (- 3.0 (+ (* x 12.0) (* x (* x -9.0)))))
double code(double x) {
	return 3.0 * ((((x * 3.0) * x) - (x * 4.0)) + 1.0);
}
double code(double x) {
	return 3.0 - ((x * 12.0) + (x * (x * -9.0)));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.1
Target0.1
Herbie0.1
\[3 + \left(\left(9 \cdot x\right) \cdot x - 12 \cdot x\right)\]

Alternatives

Alternative 1
Error0.4
Cost20544
\[3 - \sqrt[3]{12 + x \cdot -9} \cdot \left(x \cdot \left(\sqrt[3]{12 + x \cdot -9} \cdot \sqrt[3]{12 + x \cdot -9}\right)\right)\]
Alternative 2
Error0.4
Cost20032
\[3 - \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\left(12 + x \cdot -9\right) \cdot \sqrt[3]{x}\right)\]
Alternative 3
Error0.9
Cost14272
\[\sqrt{3 \cdot \left(x \cdot \left(x \cdot 3 + -4\right) + 1\right)} \cdot \sqrt{3 \cdot \left(x \cdot \left(x \cdot 3 + -4\right) + 1\right)}\]
Alternative 4
Error10.7
Cost13760
\[3 - \sqrt{12 + x \cdot -9} \cdot \left(x \cdot \sqrt{12 + x \cdot -9}\right)\]
Alternative 5
Error0.9
Cost13632
\[\sqrt{3} \cdot \left(\sqrt{3} \cdot \left(x \cdot \left(x \cdot 3 + -4\right) + 1\right)\right)\]
Alternative 6
Error32.2
Cost13504
\[3 - \sqrt{x} \cdot \left(\left(12 + x \cdot -9\right) \cdot \sqrt{x}\right)\]
Alternative 7
Error7.1
Cost1216
\[3 - \left(x \cdot \left(144 - x \cdot \left(x \cdot 81\right)\right)\right) \cdot \frac{1}{x \cdot 9 + 12}\]
Alternative 8
Error0.2
Cost1088
\[3 - x \cdot \frac{144 - 81 \cdot \left(x \cdot x\right)}{x \cdot 9 + 12}\]
Alternative 9
Error7.1
Cost1088
\[3 - \frac{x \cdot \left(144 - x \cdot \left(x \cdot 81\right)\right)}{x \cdot 9 + 12}\]
Alternative 10
Error0.2
Cost1088
\[3 - x \cdot \frac{144 - x \cdot \left(x \cdot 81\right)}{x \cdot 9 + 12}\]
Alternative 11
Error43.4
Cost960
\[3 - x \cdot \frac{144 - x \cdot \left(x \cdot 81\right)}{x \cdot 9}\]
Alternative 12
Error43.4
Cost960
\[3 - x \cdot \frac{144 - 81 \cdot \left(x \cdot x\right)}{x \cdot 9}\]
Alternative 13
Error0.1
Cost832
\[3 \cdot \left(1 + \left(x \cdot \left(x \cdot 3\right) - x \cdot 4\right)\right)\]
Alternative 14
Error0.1
Cost704
\[3 + 3 \cdot \left(x \cdot \left(x \cdot 3 + -4\right)\right)\]
Alternative 15
Error0.1
Cost576
\[3 - x \cdot \left(12 + x \cdot -9\right)\]
Alternative 16
Error2.1
Cost576
\[3 \cdot \left(1 + x \cdot \left(x \cdot 3\right)\right)\]
Alternative 17
Error41.9
Cost448
\[x \cdot \left(x \cdot 9 + -12\right)\]
Alternative 18
Error2.0
Cost448
\[x \cdot \left(x \cdot 9\right) + 3\]
Alternative 19
Error42.2
Cost320
\[x \cdot \left(x \cdot 9\right)\]
Alternative 20
Error20.7
Cost320
\[3 - x \cdot 12\]
Alternative 21
Error20.9
Cost64
\[3\]
Alternative 22
Error55.2
Cost64
\[1\]
Alternative 23
Error62.2
Cost64
\[0\]
Alternative 24
Error63.1
Cost64
\[-1\]

Error

Derivation

  1. Initial program 0.1

    \[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
  2. Simplified0.1

    \[\leadsto \color{blue}{3 - x \cdot \left(12 + x \cdot -9\right)}\]
  3. Using strategy rm
  4. Applied distribute-rgt-in_binary64_140070.1

    \[\leadsto 3 - \color{blue}{\left(12 \cdot x + \left(x \cdot -9\right) \cdot x\right)}\]
  5. Simplified0.1

    \[\leadsto 3 - \left(\color{blue}{x \cdot 12} + \left(x \cdot -9\right) \cdot x\right)\]
  6. Simplified0.1

    \[\leadsto 3 - \left(x \cdot 12 + \color{blue}{x \cdot \left(x \cdot -9\right)}\right)\]
  7. Simplified0.1

    \[\leadsto \color{blue}{3 - \left(x \cdot 12 + x \cdot \left(x \cdot -9\right)\right)}\]
  8. Final simplification0.1

    \[\leadsto 3 - \left(x \cdot 12 + x \cdot \left(x \cdot -9\right)\right)\]

Reproduce

herbie shell --seed 2021042 
(FPCore (x)
  :name "Diagrams.Tangent:$catParam from diagrams-lib-1.3.0.3, D"
  :precision binary64

  :herbie-target
  (+ 3.0 (- (* (* 9.0 x) x) (* 12.0 x)))

  (* 3.0 (+ (- (* (* x 3.0) x) (* x 4.0)) 1.0)))