Average Error: 0.0 → 0.0
Time: 3.3s
Precision: binary64
Cost: 704
\[x - \frac{y}{1 + \frac{x \cdot y}{2}}\]
\[x - \frac{y}{1 + \frac{x \cdot y}{2}}\]
x - \frac{y}{1 + \frac{x \cdot y}{2}}
x - \frac{y}{1 + \frac{x \cdot y}{2}}
(FPCore (x y) :precision binary64 (- x (/ y (+ 1.0 (/ (* x y) 2.0)))))
(FPCore (x y) :precision binary64 (- x (/ y (+ 1.0 (/ (* x y) 2.0)))))
double code(double x, double y) {
	return x - (y / (1.0 + ((x * y) / 2.0)));
}
double code(double x, double y) {
	return x - (y / (1.0 + ((x * y) / 2.0)));
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Alternatives

Alternative 1
Error5.7
Cost648
\[\begin{array}{l} \mathbf{if}\;y \leq -3.545134243483185 \cdot 10^{+104} \lor \neg \left(y \leq 2.9796951571665817 \cdot 10^{+63}\right):\\ \;\;\;\;x - \frac{2}{x}\\ \mathbf{else}:\\ \;\;\;\;x - y\\ \end{array}\]
Alternative 2
Error8.0
Cost834
\[\begin{array}{l} \mathbf{if}\;x \leq -4.564557606821874 \cdot 10^{-08}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.3146011246479754:\\ \;\;\;\;x - y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array}\]
Alternative 3
Error13.3
Cost770
\[\begin{array}{l} \mathbf{if}\;x \leq -8.576064509687241 \cdot 10^{-138}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 2.0183392620009757 \cdot 10^{-82}:\\ \;\;\;\;-y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array}\]
Alternative 4
Error23.6
Cost64
\[x\]
Alternative 5
Error61.7
Cost64
\[1\]

Error

Derivation

  1. Initial program 0.0

    \[x - \frac{y}{1 + \frac{x \cdot y}{2}}\]
  2. Simplified0.0

    \[\leadsto \color{blue}{x - \frac{y}{1 + \frac{x \cdot y}{2}}}\]
  3. Final simplification0.0

    \[\leadsto x - \frac{y}{1 + \frac{x \cdot y}{2}}\]

Reproduce

herbie shell --seed 2021044 
(FPCore (x y)
  :name "Data.Number.Erf:$cinvnormcdf from erf-2.0.0.0, B"
  :precision binary64
  (- x (/ y (+ 1.0 (/ (* x y) 2.0)))))