Average Error: 0.1 → 0.1
Time: 4.4s
Precision: binary64
Cost: 6848
\[\frac{1}{2} \cdot \left(x + y \cdot \sqrt{z}\right)\]
\[0.5 \cdot \left(x + y \cdot \sqrt{z}\right)\]
\frac{1}{2} \cdot \left(x + y \cdot \sqrt{z}\right)
0.5 \cdot \left(x + y \cdot \sqrt{z}\right)
(FPCore (x y z) :precision binary64 (* (/ 1.0 2.0) (+ x (* y (sqrt z)))))
(FPCore (x y z) :precision binary64 (* 0.5 (+ x (* y (sqrt z)))))
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 + (y * sqrt(z)));
}

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
Error15.8
Cost7313
\[\begin{array}{l} \mathbf{if}\;x \leq -2.8447717318394253 \cdot 10^{+26} \lor \neg \left(x \leq -4.812826712146534 \cdot 10^{-24} \lor \neg \left(x \leq -5.276988727068237 \cdot 10^{-51}\right) \land x \leq 3.603416283246761 \cdot 10^{+22}\right):\\ \;\;\;\;0.5 \cdot x\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(y \cdot \sqrt{z}\right)\\ \end{array}\]
Alternative 2
Error29.8
Cost192
\[0.5 \cdot x\]
Alternative 3
Error61.8
Cost64
\[-1\]
Alternative 4
Error61.8
Cost64
\[1\]

Error

Derivation

  1. Initial program 0.1

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

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

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

Reproduce

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