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

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.3
Target0.0
Herbie0.1
\[\left(y + \frac{x}{z}\right) - \frac{y}{\frac{z}{x}} \]

Derivation

  1. Initial program 10.3

    \[\frac{x + y \cdot \left(z - x\right)}{z} \]
  2. Simplified10.3

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, z - x, x\right)}{z}} \]
  3. Taylor expanded in y around 0 3.5

    \[\leadsto \color{blue}{\left(y + \frac{x}{z}\right) - \frac{y \cdot x}{z}} \]
  4. Applied associate-/l*_binary640.0

    \[\leadsto \left(y + \frac{x}{z}\right) - \color{blue}{\frac{y}{\frac{z}{x}}} \]
  5. Applied clear-num_binary640.1

    \[\leadsto \left(y + \frac{x}{z}\right) - \color{blue}{\frac{1}{\frac{\frac{z}{x}}{y}}} \]
  6. Final simplification0.1

    \[\leadsto \left(y + \frac{x}{z}\right) - \frac{1}{\frac{\frac{z}{x}}{y}} \]

Reproduce

herbie shell --seed 2021313 
(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))