
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) z)))
double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
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) * z)
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
def code(x, y, z): return x + (((y - x) * 6.0) * z)
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * z)) end
function tmp = code(x, y, z) tmp = x + (((y - x) * 6.0) * z); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) z)))
double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
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) * z)
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
def code(x, y, z): return x + (((y - x) * 6.0) * z)
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * z)) end
function tmp = code(x, y, z) tmp = x + (((y - x) * 6.0) * z); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
\end{array}
(FPCore (x y z) :precision binary64 (fma (* (- y x) z) 6.0 x))
double code(double x, double y, double z) {
return fma(((y - x) * z), 6.0, x);
}
function code(x, y, z) return fma(Float64(Float64(y - x) * z), 6.0, x) end
code[x_, y_, z_] := N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] * 6.0 + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(y - x\right) \cdot z, 6, x\right)
\end{array}
Initial program 99.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (if (<= z -0.2) (* (* (- y x) z) 6.0) (if (<= z 0.00015) (+ (* (* 6.0 y) z) x) (* (* 6.0 (- y x)) z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.2) {
tmp = ((y - x) * z) * 6.0;
} else if (z <= 0.00015) {
tmp = ((6.0 * y) * z) + x;
} else {
tmp = (6.0 * (y - x)) * z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-0.2d0)) then
tmp = ((y - x) * z) * 6.0d0
else if (z <= 0.00015d0) then
tmp = ((6.0d0 * y) * z) + x
else
tmp = (6.0d0 * (y - x)) * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.2) {
tmp = ((y - x) * z) * 6.0;
} else if (z <= 0.00015) {
tmp = ((6.0 * y) * z) + x;
} else {
tmp = (6.0 * (y - x)) * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.2: tmp = ((y - x) * z) * 6.0 elif z <= 0.00015: tmp = ((6.0 * y) * z) + x else: tmp = (6.0 * (y - x)) * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.2) tmp = Float64(Float64(Float64(y - x) * z) * 6.0); elseif (z <= 0.00015) tmp = Float64(Float64(Float64(6.0 * y) * z) + x); else tmp = Float64(Float64(6.0 * Float64(y - x)) * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.2) tmp = ((y - x) * z) * 6.0; elseif (z <= 0.00015) tmp = ((6.0 * y) * z) + x; else tmp = (6.0 * (y - x)) * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.2], N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] * 6.0), $MachinePrecision], If[LessEqual[z, 0.00015], N[(N[(N[(6.0 * y), $MachinePrecision] * z), $MachinePrecision] + x), $MachinePrecision], N[(N[(6.0 * N[(y - x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.2:\\
\;\;\;\;\left(\left(y - x\right) \cdot z\right) \cdot 6\\
\mathbf{elif}\;z \leq 0.00015:\\
\;\;\;\;\left(6 \cdot y\right) \cdot z + x\\
\mathbf{else}:\\
\;\;\;\;\left(6 \cdot \left(y - x\right)\right) \cdot z\\
\end{array}
\end{array}
if z < -0.20000000000000001Initial program 99.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6499.7
Applied rewrites99.7%
if -0.20000000000000001 < z < 1.49999999999999987e-4Initial program 99.2%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6498.7
Applied rewrites98.7%
if 1.49999999999999987e-4 < z Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
Taylor expanded in z around inf
associate-*r*N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
neg-mul-1N/A
distribute-lft-neg-inN/A
metadata-evalN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.0%
Final simplification99.0%
(FPCore (x y z) :precision binary64 (if (<= z -0.162) (* (* (- y x) z) 6.0) (if (<= z 0.00015) (fma (* y z) 6.0 x) (* (* 6.0 (- y x)) z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.162) {
tmp = ((y - x) * z) * 6.0;
} else if (z <= 0.00015) {
tmp = fma((y * z), 6.0, x);
} else {
tmp = (6.0 * (y - x)) * z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -0.162) tmp = Float64(Float64(Float64(y - x) * z) * 6.0); elseif (z <= 0.00015) tmp = fma(Float64(y * z), 6.0, x); else tmp = Float64(Float64(6.0 * Float64(y - x)) * z); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -0.162], N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] * 6.0), $MachinePrecision], If[LessEqual[z, 0.00015], N[(N[(y * z), $MachinePrecision] * 6.0 + x), $MachinePrecision], N[(N[(6.0 * N[(y - x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.162:\\
\;\;\;\;\left(\left(y - x\right) \cdot z\right) \cdot 6\\
\mathbf{elif}\;z \leq 0.00015:\\
\;\;\;\;\mathsf{fma}\left(y \cdot z, 6, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(6 \cdot \left(y - x\right)\right) \cdot z\\
\end{array}
\end{array}
if z < -0.162000000000000005Initial program 99.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6499.7
Applied rewrites99.7%
if -0.162000000000000005 < z < 1.49999999999999987e-4Initial program 99.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
Taylor expanded in y around inf
lower-*.f6498.7
Applied rewrites98.7%
if 1.49999999999999987e-4 < z Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
Taylor expanded in z around inf
associate-*r*N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
neg-mul-1N/A
distribute-lft-neg-inN/A
metadata-evalN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.0%
Final simplification99.0%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (* (- y x) z) 6.0))) (if (<= z -0.162) t_0 (if (<= z 0.00015) (fma (* y z) 6.0 x) t_0))))
double code(double x, double y, double z) {
double t_0 = ((y - x) * z) * 6.0;
double tmp;
if (z <= -0.162) {
tmp = t_0;
} else if (z <= 0.00015) {
tmp = fma((y * z), 6.0, x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(Float64(y - x) * z) * 6.0) tmp = 0.0 if (z <= -0.162) tmp = t_0; elseif (z <= 0.00015) tmp = fma(Float64(y * z), 6.0, x); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] * 6.0), $MachinePrecision]}, If[LessEqual[z, -0.162], t$95$0, If[LessEqual[z, 0.00015], N[(N[(y * z), $MachinePrecision] * 6.0 + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(y - x\right) \cdot z\right) \cdot 6\\
\mathbf{if}\;z \leq -0.162:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.00015:\\
\;\;\;\;\mathsf{fma}\left(y \cdot z, 6, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -0.162000000000000005 or 1.49999999999999987e-4 < z Initial program 99.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6499.3
Applied rewrites99.3%
if -0.162000000000000005 < z < 1.49999999999999987e-4Initial program 99.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
Taylor expanded in y around inf
lower-*.f6498.7
Applied rewrites98.7%
(FPCore (x y z) :precision binary64 (let* ((t_0 (fma (* x z) -6.0 x))) (if (<= x -3.8e+148) t_0 (if (<= x 2.6e+113) (fma (* y z) 6.0 x) t_0))))
double code(double x, double y, double z) {
double t_0 = fma((x * z), -6.0, x);
double tmp;
if (x <= -3.8e+148) {
tmp = t_0;
} else if (x <= 2.6e+113) {
tmp = fma((y * z), 6.0, x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fma(Float64(x * z), -6.0, x) tmp = 0.0 if (x <= -3.8e+148) tmp = t_0; elseif (x <= 2.6e+113) tmp = fma(Float64(y * z), 6.0, x); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x * z), $MachinePrecision] * -6.0 + x), $MachinePrecision]}, If[LessEqual[x, -3.8e+148], t$95$0, If[LessEqual[x, 2.6e+113], N[(N[(y * z), $MachinePrecision] * 6.0 + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(x \cdot z, -6, x\right)\\
\mathbf{if}\;x \leq -3.8 \cdot 10^{+148}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+113}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot z, 6, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -3.7999999999999998e148 or 2.5999999999999999e113 < x Initial program 98.8%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6497.4
Applied rewrites97.4%
if -3.7999999999999998e148 < x < 2.5999999999999999e113Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites99.7%
Taylor expanded in y around inf
lower-*.f6485.8
Applied rewrites85.8%
Final simplification89.3%
(FPCore (x y z) :precision binary64 (let* ((t_0 (fma (* x z) -6.0 x))) (if (<= x -1.7e-153) t_0 (if (<= x 3e-113) (* (* 6.0 y) z) t_0))))
double code(double x, double y, double z) {
double t_0 = fma((x * z), -6.0, x);
double tmp;
if (x <= -1.7e-153) {
tmp = t_0;
} else if (x <= 3e-113) {
tmp = (6.0 * y) * z;
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fma(Float64(x * z), -6.0, x) tmp = 0.0 if (x <= -1.7e-153) tmp = t_0; elseif (x <= 3e-113) tmp = Float64(Float64(6.0 * y) * z); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x * z), $MachinePrecision] * -6.0 + x), $MachinePrecision]}, If[LessEqual[x, -1.7e-153], t$95$0, If[LessEqual[x, 3e-113], N[(N[(6.0 * y), $MachinePrecision] * z), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(x \cdot z, -6, x\right)\\
\mathbf{if}\;x \leq -1.7 \cdot 10^{-153}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3 \cdot 10^{-113}:\\
\;\;\;\;\left(6 \cdot y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.6999999999999999e-153 or 3.0000000000000001e-113 < x Initial program 99.4%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6479.2
Applied rewrites79.2%
if -1.6999999999999999e-153 < x < 3.0000000000000001e-113Initial program 99.7%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f6479.8
Applied rewrites79.8%
Applied rewrites79.9%
Final simplification79.4%
(FPCore (x y z) :precision binary64 (if (<= x -3.8e+148) (* (* -6.0 z) x) (if (<= x 2.6e+113) (* (* 6.0 y) z) (* (* -6.0 x) z))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.8e+148) {
tmp = (-6.0 * z) * x;
} else if (x <= 2.6e+113) {
tmp = (6.0 * y) * z;
} else {
tmp = (-6.0 * x) * z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-3.8d+148)) then
tmp = ((-6.0d0) * z) * x
else if (x <= 2.6d+113) then
tmp = (6.0d0 * y) * z
else
tmp = ((-6.0d0) * x) * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -3.8e+148) {
tmp = (-6.0 * z) * x;
} else if (x <= 2.6e+113) {
tmp = (6.0 * y) * z;
} else {
tmp = (-6.0 * x) * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.8e+148: tmp = (-6.0 * z) * x elif x <= 2.6e+113: tmp = (6.0 * y) * z else: tmp = (-6.0 * x) * z return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.8e+148) tmp = Float64(Float64(-6.0 * z) * x); elseif (x <= 2.6e+113) tmp = Float64(Float64(6.0 * y) * z); else tmp = Float64(Float64(-6.0 * x) * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3.8e+148) tmp = (-6.0 * z) * x; elseif (x <= 2.6e+113) tmp = (6.0 * y) * z; else tmp = (-6.0 * x) * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.8e+148], N[(N[(-6.0 * z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, 2.6e+113], N[(N[(6.0 * y), $MachinePrecision] * z), $MachinePrecision], N[(N[(-6.0 * x), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{+148}:\\
\;\;\;\;\left(-6 \cdot z\right) \cdot x\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+113}:\\
\;\;\;\;\left(6 \cdot y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\left(-6 \cdot x\right) \cdot z\\
\end{array}
\end{array}
if x < -3.7999999999999998e148Initial program 99.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6455.5
Applied rewrites55.5%
Taylor expanded in y around 0
Applied rewrites52.4%
Applied rewrites52.5%
if -3.7999999999999998e148 < x < 2.5999999999999999e113Initial program 99.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f6458.2
Applied rewrites58.2%
Applied rewrites58.2%
if 2.5999999999999999e113 < x Initial program 98.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in z around inf
associate-*r*N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
neg-mul-1N/A
distribute-lft-neg-inN/A
metadata-evalN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites58.3%
Taylor expanded in y around 0
Applied rewrites56.1%
(FPCore (x y z) :precision binary64 (if (<= x -3.8e+148) (* (* -6.0 z) x) (if (<= x 2.6e+113) (* (* 6.0 y) z) (* -6.0 (* x z)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.8e+148) {
tmp = (-6.0 * z) * x;
} else if (x <= 2.6e+113) {
tmp = (6.0 * y) * z;
} else {
tmp = -6.0 * (x * z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-3.8d+148)) then
tmp = ((-6.0d0) * z) * x
else if (x <= 2.6d+113) then
tmp = (6.0d0 * y) * z
else
tmp = (-6.0d0) * (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -3.8e+148) {
tmp = (-6.0 * z) * x;
} else if (x <= 2.6e+113) {
tmp = (6.0 * y) * z;
} else {
tmp = -6.0 * (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.8e+148: tmp = (-6.0 * z) * x elif x <= 2.6e+113: tmp = (6.0 * y) * z else: tmp = -6.0 * (x * z) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.8e+148) tmp = Float64(Float64(-6.0 * z) * x); elseif (x <= 2.6e+113) tmp = Float64(Float64(6.0 * y) * z); else tmp = Float64(-6.0 * Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3.8e+148) tmp = (-6.0 * z) * x; elseif (x <= 2.6e+113) tmp = (6.0 * y) * z; else tmp = -6.0 * (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.8e+148], N[(N[(-6.0 * z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, 2.6e+113], N[(N[(6.0 * y), $MachinePrecision] * z), $MachinePrecision], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{+148}:\\
\;\;\;\;\left(-6 \cdot z\right) \cdot x\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+113}:\\
\;\;\;\;\left(6 \cdot y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if x < -3.7999999999999998e148Initial program 99.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6455.5
Applied rewrites55.5%
Taylor expanded in y around 0
Applied rewrites52.4%
Applied rewrites52.5%
if -3.7999999999999998e148 < x < 2.5999999999999999e113Initial program 99.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f6458.2
Applied rewrites58.2%
Applied rewrites58.2%
if 2.5999999999999999e113 < x Initial program 98.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6458.1
Applied rewrites58.1%
Taylor expanded in y around 0
Applied rewrites55.9%
Final simplification57.1%
(FPCore (x y z) :precision binary64 (* -6.0 (* x z)))
double code(double x, double y, double z) {
return -6.0 * (x * z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (-6.0d0) * (x * z)
end function
public static double code(double x, double y, double z) {
return -6.0 * (x * z);
}
def code(x, y, z): return -6.0 * (x * z)
function code(x, y, z) return Float64(-6.0 * Float64(x * z)) end
function tmp = code(x, y, z) tmp = -6.0 * (x * z); end
code[x_, y_, z_] := N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-6 \cdot \left(x \cdot z\right)
\end{array}
Initial program 99.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6467.4
Applied rewrites67.4%
Taylor expanded in y around 0
Applied rewrites29.0%
Final simplification29.0%
(FPCore (x y z) :precision binary64 (* (* -6.0 z) x))
double code(double x, double y, double z) {
return (-6.0 * z) * x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((-6.0d0) * z) * x
end function
public static double code(double x, double y, double z) {
return (-6.0 * z) * x;
}
def code(x, y, z): return (-6.0 * z) * x
function code(x, y, z) return Float64(Float64(-6.0 * z) * x) end
function tmp = code(x, y, z) tmp = (-6.0 * z) * x; end
code[x_, y_, z_] := N[(N[(-6.0 * z), $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
\\
\left(-6 \cdot z\right) \cdot x
\end{array}
Initial program 99.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6467.4
Applied rewrites67.4%
Taylor expanded in y around 0
Applied rewrites29.0%
Applied rewrites29.0%
(FPCore (x y z) :precision binary64 (- x (* (* 6.0 z) (- x y))))
double code(double x, double y, double z) {
return x - ((6.0 * z) * (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 - ((6.0d0 * z) * (x - y))
end function
public static double code(double x, double y, double z) {
return x - ((6.0 * z) * (x - y));
}
def code(x, y, z): return x - ((6.0 * z) * (x - y))
function code(x, y, z) return Float64(x - Float64(Float64(6.0 * z) * Float64(x - y))) end
function tmp = code(x, y, z) tmp = x - ((6.0 * z) * (x - y)); end
code[x_, y_, z_] := N[(x - N[(N[(6.0 * z), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(6 \cdot z\right) \cdot \left(x - y\right)
\end{array}
herbie shell --seed 2024235
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
:precision binary64
:alt
(! :herbie-platform default (- x (* (* 6 z) (- x y))))
(+ x (* (* (- y x) 6.0) z)))