Average Error: 10.1 → 0.0
Time: 2.6s
Precision: binary64
\[\frac{x + y \cdot \left(z - x\right)}{z}\]
\[y + \frac{x}{z} \cdot \left(1 - y\right)\]
\frac{x + y \cdot \left(z - x\right)}{z}
y + \frac{x}{z} \cdot \left(1 - y\right)
(FPCore (x y z) :precision binary64 (/ (+ x (* y (- z x))) z))
(FPCore (x y z) :precision binary64 (+ y (* (/ x z) (- 1.0 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 - 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.1
Target0.0
Herbie0.0
\[\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 div-inv_binary6410.2

    \[\leadsto \color{blue}{\left(x + y \cdot \left(z - x\right)\right) \cdot \frac{1}{z}}\]
  4. Using strategy rm
  5. Applied add-cube-cbrt_binary6410.7

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

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

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

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

Reproduce

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