?

Average Accuracy: 99.9% → 100.0%
Time: 5.9s
Precision: binary64
Cost: 6592

?

\[x - \frac{3}{8} \cdot y \]
\[\mathsf{fma}\left(y, -0.375, x\right) \]
(FPCore (x y) :precision binary64 (- x (* (/ 3.0 8.0) y)))
(FPCore (x y) :precision binary64 (fma y -0.375 x))
double code(double x, double y) {
	return x - ((3.0 / 8.0) * y);
}
double code(double x, double y) {
	return fma(y, -0.375, x);
}
function code(x, y)
	return Float64(x - Float64(Float64(3.0 / 8.0) * y))
end
function code(x, y)
	return fma(y, -0.375, x)
end
code[x_, y_] := N[(x - N[(N[(3.0 / 8.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := N[(y * -0.375 + x), $MachinePrecision]
x - \frac{3}{8} \cdot y
\mathsf{fma}\left(y, -0.375, x\right)

Error?

Bogosity?

Bogosity

Derivation?

  1. Initial program 99.9%

    \[x - \frac{3}{8} \cdot y \]
  2. Simplified100.0%

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, -0.375, x\right)} \]
    Proof

    [Start]99.9

    \[ x - \frac{3}{8} \cdot y \]

    sub-neg [=>]99.9

    \[ \color{blue}{x + \left(-\frac{3}{8} \cdot y\right)} \]

    +-commutative [=>]99.9

    \[ \color{blue}{\left(-\frac{3}{8} \cdot y\right) + x} \]

    *-commutative [=>]99.9

    \[ \left(-\color{blue}{y \cdot \frac{3}{8}}\right) + x \]

    distribute-rgt-neg-in [=>]99.9

    \[ \color{blue}{y \cdot \left(-\frac{3}{8}\right)} + x \]

    fma-def [=>]100.0

    \[ \color{blue}{\mathsf{fma}\left(y, -\frac{3}{8}, x\right)} \]

    metadata-eval [=>]100.0

    \[ \mathsf{fma}\left(y, -\color{blue}{0.375}, x\right) \]

    metadata-eval [=>]100.0

    \[ \mathsf{fma}\left(y, \color{blue}{-0.375}, x\right) \]
  3. Final simplification100.0%

    \[\leadsto \mathsf{fma}\left(y, -0.375, x\right) \]

Alternatives

Alternative 1
Accuracy72.1%
Cost720
\[\begin{array}{l} \mathbf{if}\;x \leq -1.8 \cdot 10^{-24}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 2.35 \cdot 10^{-145}:\\ \;\;\;\;y \cdot -0.375\\ \mathbf{elif}\;x \leq 1.8 \cdot 10^{-76}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 4.2 \cdot 10^{+48}:\\ \;\;\;\;y \cdot -0.375\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 2
Accuracy99.9%
Cost320
\[x + y \cdot -0.375 \]
Alternative 3
Accuracy51.4%
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023160 
(FPCore (x y)
  :name "Diagrams.Solve.Polynomial:quartForm  from diagrams-solve-0.1, A"
  :precision binary64
  (- x (* (/ 3.0 8.0) y)))