Average Error: 15.2 → 0.0
Time: 2.6s
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

Original15.2
Target0.1
Herbie0.0
\[\frac{1}{x + \frac{1}{x}} \]

Derivation

  1. Initial program 15.2

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

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

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

Alternatives

Alternative 1
Error0.9
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -682642.4728031768:\\ \;\;\;\;\frac{1}{x}\\ \mathbf{elif}\;x \leq 2.6903770676420974 \cdot 10^{-8}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x}\\ \end{array} \]
Alternative 2
Error0.1
Cost448
\[\frac{1}{x + \frac{1}{x}} \]
Alternative 3
Error31.1
Cost64
\[x \]

Error

Reproduce

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

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

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