Average Error: 0.2 → 0.1
Time: 3.3s
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 \left(x \cdot -9\right) + x \cdot 12\right)\]
3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
3 - \left(x \cdot \left(x \cdot -9\right) + x \cdot 12\right)
(FPCore (x) :precision binary64 (* 3.0 (+ (- (* (* x 3.0) x) (* x 4.0)) 1.0)))
(FPCore (x) :precision binary64 (- 3.0 (+ (* x (* x -9.0)) (* x 12.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 * (x * -9.0)) + (x * 12.0));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Alternatives

Alternative 1
Error0.1
Cost576
\[3 + x \cdot \left(x \cdot 9 + -12\right)\]
Alternative 2
Error2.0
Cost448
\[3 - x \cdot \left(x \cdot -9\right)\]
Alternative 3
Error1.0
Cost776
\[\begin{array}{l} \mathbf{if}\;x \leq -0.5794851105037966 \lor \neg \left(x \leq 0.5833920888216977\right):\\ \;\;\;\;x \cdot \left(x \cdot 9 + -12\right)\\ \mathbf{else}:\\ \;\;\;\;3 - x \cdot 12\\ \end{array}\]
Alternative 4
Error1.5
Cost962
\[\begin{array}{l} \mathbf{if}\;x \leq -1.5553162295378504:\\ \;\;\;\;9 \cdot \left(x \cdot x\right)\\ \mathbf{elif}\;x \leq 0.9869624985097121:\\ \;\;\;\;3 - x \cdot 12\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(x \cdot 9\right)\\ \end{array}\]
Alternative 5
Error1.5
Cost648
\[\begin{array}{l} \mathbf{if}\;x \leq -1.5553162295378504 \lor \neg \left(x \leq 0.9869624985097121\right):\\ \;\;\;\;9 \cdot \left(x \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;3 - x \cdot 12\\ \end{array}\]
Alternative 6
Error2.0
Cost648
\[\begin{array}{l} \mathbf{if}\;x \leq -0.5794851105037966 \lor \neg \left(x \leq 0.19643895996024488\right):\\ \;\;\;\;9 \cdot \left(x \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;3\\ \end{array}\]
Alternative 7
Error21.6
Cost64
\[3\]
Alternative 8
Error55.3
Cost64
\[1\]

Error

Derivation

  1. Initial program 0.2

    \[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_187830.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 \left(x \cdot -9\right) + x \cdot 12\right)}\]
  8. Final simplification0.1

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

Reproduce

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