Average Error: 10.1 → 3.5
Time: 2.4s
Precision: binary64
\[\frac{x + y \cdot \left(z - x\right)}{z}\]
\[y - \frac{y \cdot x - x}{z}\]
\frac{x + y \cdot \left(z - x\right)}{z}
y - \frac{y \cdot x - x}{z}
(FPCore (x y z) :precision binary64 (/ (+ x (* y (- z x))) z))
(FPCore (x y z) :precision binary64 (- y (/ (- (* y x) x) z)))
double code(double x, double y, double z) {
	return (x + (y * (z - x))) / z;
}
double code(double x, double y, double z) {
	return y - (((y * x) - x) / z);
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original10.1
Target0.0
Herbie3.5
\[\left(y + \frac{x}{z}\right) - \frac{y}{\frac{z}{x}}\]

Derivation

  1. Initial program 10.1

    \[\frac{x + y \cdot \left(z - x\right)}{z}\]
  2. Using strategy rm
  3. Applied clear-num_binary6410.3

    \[\leadsto \color{blue}{\frac{1}{\frac{z}{x + y \cdot \left(z - x\right)}}}\]
  4. Taylor expanded around 0 3.5

    \[\leadsto \color{blue}{\left(\frac{x}{z} + y\right) - \frac{x \cdot y}{z}}\]
  5. Simplified3.5

    \[\leadsto \color{blue}{y - \frac{x \cdot y - x}{z}}\]
  6. Final simplification3.5

    \[\leadsto y - \frac{y \cdot x - x}{z}\]

Reproduce

herbie shell --seed 2020224 
(FPCore (x y z)
  :name "Diagrams.Backend.Rasterific:rasterificRadialGradient from diagrams-rasterific-1.3.1.3"
  :precision binary64

  :herbie-target
  (- (+ y (/ x z)) (/ y (/ z x)))

  (/ (+ x (* y (- z x))) z))