Average Error: 5.4 → 0.1
Time: 1.4min
Precision: binary64
Cost: 832
\[\frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3}\]
\[\frac{3 - x}{3} \cdot \left(\frac{1}{y} - \frac{x}{y}\right)\]
\frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3}
\frac{3 - x}{3} \cdot \left(\frac{1}{y} - \frac{x}{y}\right)
(FPCore (x y) :precision binary64 (/ (* (- 1.0 x) (- 3.0 x)) (* y 3.0)))
(FPCore (x y) :precision binary64 (* (/ (- 3.0 x) 3.0) (- (/ 1.0 y) (/ x y))))
double code(double x, double y) {
	return ((1.0 - x) * (3.0 - x)) / (y * 3.0);
}
double code(double x, double y) {
	return ((3.0 - x) / 3.0) * ((1.0 / 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

Target

Original5.4
Target0.1
Herbie0.1
\[\frac{1 - x}{y} \cdot \frac{3 - x}{3}\]
Alternative 1
Accuracy0.6
Cost1728
\[-\frac{\sqrt[3]{3 - x} \cdot \sqrt[3]{3 - x}}{\sqrt{3}} \cdot \left(\frac{-1 + x}{y} \cdot \frac{\sqrt[3]{3 - x}}{\sqrt{3}}\right)\]
Alternative 2
Accuracy1.3
Cost1344
\[\frac{\frac{x + -1}{\sqrt[3]{-y} \cdot \sqrt[3]{-y}}}{\sqrt[3]{-y}} \cdot \frac{3 - x}{3}\]
Alternative 3
Accuracy58.7
Cost1408
\[\left(\frac{\sqrt{x + -1}}{-\sqrt{y}} \cdot \frac{\sqrt{x + -1}}{\sqrt{y}}\right) \cdot \frac{3 - x}{3}\]

Derivation

  1. Initial program 5.4

    \[\frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3}\]
  2. Using strategy rm
  3. Applied times-frac_binary64_171340.1

    \[\leadsto \color{blue}{\frac{1 - x}{y} \cdot \frac{3 - x}{3}}\]
  4. Using strategy rm
  5. Applied frac-2neg_binary64_171390.1

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

    \[\leadsto \frac{\color{blue}{x + -1}}{-y} \cdot \frac{3 - x}{3}\]
  7. Using strategy rm
  8. Applied *-un-lft-identity_binary64_171280.1

    \[\leadsto \frac{x + -1}{-\color{blue}{1 \cdot y}} \cdot \frac{3 - x}{3}\]
  9. Applied distribute-lft-neg-in_binary64_170850.1

    \[\leadsto \frac{x + -1}{\color{blue}{\left(-1\right) \cdot y}} \cdot \frac{3 - x}{3}\]
  10. Applied *-un-lft-identity_binary64_171280.1

    \[\leadsto \frac{\color{blue}{1 \cdot \left(x + -1\right)}}{\left(-1\right) \cdot y} \cdot \frac{3 - x}{3}\]
  11. Applied times-frac_binary64_171340.1

    \[\leadsto \color{blue}{\left(\frac{1}{-1} \cdot \frac{x + -1}{y}\right)} \cdot \frac{3 - x}{3}\]
  12. Applied associate-*l*_binary64_170690.1

    \[\leadsto \color{blue}{\frac{1}{-1} \cdot \left(\frac{x + -1}{y} \cdot \frac{3 - x}{3}\right)}\]
  13. Simplified0.1

    \[\leadsto \frac{1}{-1} \cdot \color{blue}{\left(\frac{3 - x}{3} \cdot \frac{x + -1}{y}\right)}\]
  14. Taylor expanded around 0 0.1

    \[\leadsto \frac{1}{-1} \cdot \left(\frac{3 - x}{3} \cdot \color{blue}{\left(\frac{x}{y} - \frac{1}{y}\right)}\right)\]
  15. Final simplification0.1

    \[\leadsto \frac{3 - x}{3} \cdot \left(\frac{1}{y} - \frac{x}{y}\right)\]

Reproduce

herbie shell --seed 2020322 
(FPCore (x y)
  :name "Diagrams.TwoD.Arc:bezierFromSweepQ1 from diagrams-lib-1.3.0.3"
  :precision binary64

  :herbie-target
  (* (/ (- 1.0 x) y) (/ (- 3.0 x) 3.0))

  (/ (* (- 1.0 x) (- 3.0 x)) (* y 3.0)))