Average Error: 8.5 → 0.1
Time: 20.1s
Precision: 64
Internal precision: 128
\[\frac{x \cdot \left(\frac{x}{y} + 1.0\right)}{x + 1.0}\]
\[\frac{x}{1.0 + x} \cdot \left(\frac{x}{y} + 1.0\right)\]

Error

Bits error versus x

Bits error versus y

Target

Original8.5
Comparison0.1
Herbie0.1
\[ \frac{x}{1} \cdot \frac{\frac{x}{y} + 1.0}{x + 1.0} \]

Derivation

  1. Initial program 8.5

    \[\frac{x \cdot \left(\frac{x}{y} + 1.0\right)}{x + 1.0}\]
  2. Applied taylor 15.4

    \[\leadsto \frac{1.0 \cdot x + \frac{{x}^2}{y}}{x + 1.0}\]
  3. Taylor expanded around 0 15.4

    \[\leadsto \frac{\color{blue}{1.0 \cdot x + \frac{{x}^2}{y}}}{x + 1.0}\]
  4. Applied simplify 0.1

    \[\leadsto \color{blue}{\frac{x}{1.0 + x} \cdot \left(\frac{x}{y} + 1.0\right)}\]
  5. Removed slow pow expressions

Runtime

Time bar (total: 20.1s) Debug log

Please include this information when filing a bug report:

herbie --seed '#(297729913 3023023530 2613867112 2590282343 2660048218 1412861797)'
(FPCore (x y)
  :name "Codec.Picture.Types:toneMapping from JuicyPixels-3.2.6.1"

  :target
  (* (/ x 1) (/ (+ (/ x y) 1.0) (+ x 1.0)))

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