Average Error: 0.4 → 0.2
Time: 3.6s
Precision: binary64
\[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
\[4 \cdot \left(y - x\right) + \left(x + z \cdot \left(6 \cdot \left(x - y\right)\right)\right) \]
(FPCore (x y z)
 :precision binary64
 (+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))
(FPCore (x y z)
 :precision binary64
 (+ (* 4.0 (- y x)) (+ x (* z (* 6.0 (- x y))))))
double code(double x, double y, double z) {
	return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
}
double code(double x, double y, double z) {
	return (4.0 * (y - x)) + (x + (z * (6.0 * (x - y))));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x + (((y - x) * 6.0d0) * ((2.0d0 / 3.0d0) - z))
end function
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (4.0d0 * (y - x)) + (x + (z * (6.0d0 * (x - y))))
end function
public static double code(double x, double y, double z) {
	return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
}
public static double code(double x, double y, double z) {
	return (4.0 * (y - x)) + (x + (z * (6.0 * (x - y))));
}
def code(x, y, z):
	return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z))
def code(x, y, z):
	return (4.0 * (y - x)) + (x + (z * (6.0 * (x - y))))
function code(x, y, z)
	return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * Float64(Float64(2.0 / 3.0) - z)))
end
function code(x, y, z)
	return Float64(Float64(4.0 * Float64(y - x)) + Float64(x + Float64(z * Float64(6.0 * Float64(x - y)))))
end
function tmp = code(x, y, z)
	tmp = x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
end
function tmp = code(x, y, z)
	tmp = (4.0 * (y - x)) + (x + (z * (6.0 * (x - y))));
end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * N[(N[(2.0 / 3.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(N[(4.0 * N[(y - x), $MachinePrecision]), $MachinePrecision] + N[(x + N[(z * N[(6.0 * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)
4 \cdot \left(y - x\right) + \left(x + z \cdot \left(6 \cdot \left(x - y\right)\right)\right)

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.4

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

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

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

    \[\leadsto 4 \cdot \left(y - x\right) + \left(\color{blue}{\left(6 \cdot \left(z \cdot x\right) + -6 \cdot \left(y \cdot z\right)\right)} + x\right) \]
  5. Simplified0.2

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

    \[\leadsto 4 \cdot \left(y - x\right) + \left(x + z \cdot \left(6 \cdot \left(x - y\right)\right)\right) \]

Reproduce

herbie shell --seed 2022210 
(FPCore (x y z)
  :name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, D"
  :precision binary64
  (+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))