Average Error: 9.8 → 0.0
Time: 2.7s
Precision: binary64
\[\frac{x + y \cdot \left(z - x\right)}{z}\]
\[y - \frac{x}{z} \cdot \left(y + -1\right)\]
\frac{x + y \cdot \left(z - x\right)}{z}
y - \frac{x}{z} \cdot \left(y + -1\right)
(FPCore (x y z) :precision binary64 (/ (+ x (* y (- z x))) z))
(FPCore (x y z) :precision binary64 (- y (* (/ x z) (+ y -1.0))))
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) * (y + -1.0));
}

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

Original9.8
Target0.0
Herbie0.0
\[\left(y + \frac{x}{z}\right) - \frac{y}{\frac{z}{x}}\]

Derivation

  1. Initial program 9.8

    \[\frac{x + y \cdot \left(z - x\right)}{z}\]
  2. Taylor expanded around 0 3.4

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

    \[\leadsto \color{blue}{y - \frac{x \cdot y - x}{z}}\]
  4. Using strategy rm
  5. Applied div-sub_binary64_205433.4

    \[\leadsto y - \color{blue}{\left(\frac{x \cdot y}{z} - \frac{x}{z}\right)}\]
  6. Taylor expanded around 0 3.4

    \[\leadsto y - \color{blue}{\left(\frac{x \cdot y}{z} - \frac{x}{z}\right)}\]
  7. Simplified0.0

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

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

Reproduce

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