?

Average Accuracy: 76.9% → 100.0%
Time: 4.3s
Precision: binary64
Cost: 13376

?

\[\frac{x}{x \cdot x + 1} \]
\[\frac{1}{\mathsf{hypot}\left(1, x\right)} \cdot \frac{x}{\mathsf{hypot}\left(1, x\right)} \]
(FPCore (x) :precision binary64 (/ x (+ (* x x) 1.0)))
(FPCore (x) :precision binary64 (* (/ 1.0 (hypot 1.0 x)) (/ x (hypot 1.0 x))))
double code(double x) {
	return x / ((x * x) + 1.0);
}
double code(double x) {
	return (1.0 / hypot(1.0, x)) * (x / hypot(1.0, x));
}
public static double code(double x) {
	return x / ((x * x) + 1.0);
}
public static double code(double x) {
	return (1.0 / Math.hypot(1.0, x)) * (x / Math.hypot(1.0, x));
}
def code(x):
	return x / ((x * x) + 1.0)
def code(x):
	return (1.0 / math.hypot(1.0, x)) * (x / math.hypot(1.0, x))
function code(x)
	return Float64(x / Float64(Float64(x * x) + 1.0))
end
function code(x)
	return Float64(Float64(1.0 / hypot(1.0, x)) * Float64(x / hypot(1.0, x)))
end
function tmp = code(x)
	tmp = x / ((x * x) + 1.0);
end
function tmp = code(x)
	tmp = (1.0 / hypot(1.0, x)) * (x / hypot(1.0, x));
end
code[x_] := N[(x / N[(N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
code[x_] := N[(N[(1.0 / N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision] * N[(x / N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x}{x \cdot x + 1}
\frac{1}{\mathsf{hypot}\left(1, x\right)} \cdot \frac{x}{\mathsf{hypot}\left(1, x\right)}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original76.9%
Target99.9%
Herbie100.0%
\[\frac{1}{x + \frac{1}{x}} \]

Derivation?

  1. Initial program 76.9%

    \[\frac{x}{x \cdot x + 1} \]
  2. Applied egg-rr100.0%

    \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(1, x\right)} \cdot \frac{x}{\mathsf{hypot}\left(1, x\right)}} \]
    Proof

    [Start]76.9

    \[ \frac{x}{x \cdot x + 1} \]

    *-un-lft-identity [=>]76.9

    \[ \frac{\color{blue}{1 \cdot x}}{x \cdot x + 1} \]

    add-sqr-sqrt [=>]76.9

    \[ \frac{1 \cdot x}{\color{blue}{\sqrt{x \cdot x + 1} \cdot \sqrt{x \cdot x + 1}}} \]

    times-frac [=>]77.0

    \[ \color{blue}{\frac{1}{\sqrt{x \cdot x + 1}} \cdot \frac{x}{\sqrt{x \cdot x + 1}}} \]

    +-commutative [=>]77.0

    \[ \frac{1}{\sqrt{\color{blue}{1 + x \cdot x}}} \cdot \frac{x}{\sqrt{x \cdot x + 1}} \]

    hypot-1-def [=>]77.0

    \[ \frac{1}{\color{blue}{\mathsf{hypot}\left(1, x\right)}} \cdot \frac{x}{\sqrt{x \cdot x + 1}} \]

    +-commutative [=>]77.0

    \[ \frac{1}{\mathsf{hypot}\left(1, x\right)} \cdot \frac{x}{\sqrt{\color{blue}{1 + x \cdot x}}} \]

    hypot-1-def [=>]100.0

    \[ \frac{1}{\mathsf{hypot}\left(1, x\right)} \cdot \frac{x}{\color{blue}{\mathsf{hypot}\left(1, x\right)}} \]
  3. Final simplification100.0%

    \[\leadsto \frac{1}{\mathsf{hypot}\left(1, x\right)} \cdot \frac{x}{\mathsf{hypot}\left(1, x\right)} \]

Alternatives

Alternative 1
Accuracy99.2%
Cost712
\[\begin{array}{l} \mathbf{if}\;x \leq -0.86:\\ \;\;\;\;\frac{1}{x}\\ \mathbf{elif}\;x \leq 0.85:\\ \;\;\;\;x \cdot \left(1 - x \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x}\\ \end{array} \]
Alternative 2
Accuracy99.0%
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{1}{x}\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x}\\ \end{array} \]
Alternative 3
Accuracy99.9%
Cost448
\[\frac{1}{x + \frac{1}{x}} \]
Alternative 4
Accuracy51.8%
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023144 
(FPCore (x)
  :name "x / (x^2 + 1)"
  :precision binary64

  :herbie-target
  (/ 1.0 (+ x (/ 1.0 x)))

  (/ x (+ (* x x) 1.0)))