Average Error: 0.1 → 0.1
Time: 22.6s
Precision: binary64
Cost: 6848
\[\frac{1}{2} \cdot \left(x + y \cdot \sqrt{z}\right)\]
\[0.5 \cdot \left(x + \sqrt{z} \cdot y\right)\]
\frac{1}{2} \cdot \left(x + y \cdot \sqrt{z}\right)
0.5 \cdot \left(x + \sqrt{z} \cdot y\right)
(FPCore (x y z) :precision binary64 (* (/ 1.0 2.0) (+ x (* y (sqrt z)))))
(FPCore (x y z) :precision binary64 (* 0.5 (+ x (* (sqrt z) y))))
double code(double x, double y, double z) {
	return (1.0 / 2.0) * (x + (y * sqrt(z)));
}
double code(double x, double y, double z) {
	return 0.5 * (x + (sqrt(z) * y));
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Alternatives

Alternative 1
Error29.4
Cost6720
\[0.5 \cdot \left(x + \log 1\right)\]
Alternative 2
Error61.8
Cost64
\[-1\]
Alternative 3
Error61.8
Cost64
\[1\]

Error

Time

Derivation

  1. Initial program 0.1

    \[\frac{1}{2} \cdot \left(x + y \cdot \sqrt{z}\right)\]
  2. Using strategy rm
  3. Applied *-un-lft-identity_binary64_51930.1

    \[\leadsto \frac{1}{2} \cdot \left(x + \color{blue}{1 \cdot \left(y \cdot \sqrt{z}\right)}\right)\]
  4. Using strategy rm
  5. Applied *-commutative_binary64_51240.1

    \[\leadsto \frac{1}{2} \cdot \left(x + 1 \cdot \color{blue}{\left(\sqrt{z} \cdot y\right)}\right)\]
  6. Simplified0.1

    \[\leadsto \color{blue}{0.5 \cdot \left(x + \sqrt{z} \cdot y\right)}\]
  7. Final simplification0.1

    \[\leadsto 0.5 \cdot \left(x + \sqrt{z} \cdot y\right)\]

Reproduce

herbie shell --seed 2021040 
(FPCore (x y z)
  :name "Diagrams.Solve.Polynomial:quadForm from diagrams-solve-0.1, B"
  :precision binary64
  (* (/ 1.0 2.0) (+ x (* y (sqrt z)))))