Average Error: 15.3 → 0.0
Time: 1.8s
Precision: binary64
\[\frac{x}{x \cdot x + 1} \]
\[\frac{\frac{x}{\mathsf{hypot}\left(1, x\right)}}{\mathsf{hypot}\left(1, x\right)} \]
\frac{x}{x \cdot x + 1}
\frac{\frac{x}{\mathsf{hypot}\left(1, x\right)}}{\mathsf{hypot}\left(1, x\right)}
(FPCore (x) :precision binary64 (/ x (+ (* x x) 1.0)))
(FPCore (x) :precision binary64 (/ (/ x (hypot 1.0 x)) (hypot 1.0 x)))
double code(double x) {
	return x / ((x * x) + 1.0);
}
double code(double x) {
	return (x / hypot(1.0, x)) / hypot(1.0, x);
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 15.3

    \[\frac{x}{x \cdot x + 1} \]
  2. Simplified15.3

    \[\leadsto \color{blue}{\frac{x}{\mathsf{fma}\left(x, x, 1\right)}} \]
  3. Applied add-sqr-sqrt_binary6415.3

    \[\leadsto \frac{x}{\color{blue}{\sqrt{\mathsf{fma}\left(x, x, 1\right)} \cdot \sqrt{\mathsf{fma}\left(x, x, 1\right)}}} \]
  4. Applied *-un-lft-identity_binary6415.3

    \[\leadsto \frac{\color{blue}{1 \cdot x}}{\sqrt{\mathsf{fma}\left(x, x, 1\right)} \cdot \sqrt{\mathsf{fma}\left(x, x, 1\right)}} \]
  5. Applied times-frac_binary6415.2

    \[\leadsto \color{blue}{\frac{1}{\sqrt{\mathsf{fma}\left(x, x, 1\right)}} \cdot \frac{x}{\sqrt{\mathsf{fma}\left(x, x, 1\right)}}} \]
  6. Simplified15.2

    \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(1, x\right)}} \cdot \frac{x}{\sqrt{\mathsf{fma}\left(x, x, 1\right)}} \]
  7. Simplified0.0

    \[\leadsto \frac{1}{\mathsf{hypot}\left(1, x\right)} \cdot \color{blue}{\frac{x}{\mathsf{hypot}\left(1, x\right)}} \]
  8. Applied associate-*l/_binary640.0

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

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

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

Reproduce

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

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

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