(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)
Results
Initial program 0.4
Simplified0.2
Taylor expanded in z around 0 0.2
Taylor expanded in y around 0 0.2
Simplified0.2
Final simplification0.2
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))))