
(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 12 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 (+ x (fma (* 6.0 y) z (* (* -6.0 x) z))))
double code(double x, double y, double z) {
return x + fma((6.0 * y), z, ((-6.0 * x) * z));
}
function code(x, y, z) return Float64(x + fma(Float64(6.0 * y), z, Float64(Float64(-6.0 * x) * z))) end
code[x_, y_, z_] := N[(x + N[(N[(6.0 * y), $MachinePrecision] * z + N[(N[(-6.0 * x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \mathsf{fma}\left(6 \cdot y, z, \left(-6 \cdot x\right) \cdot z\right)
\end{array}
Initial program 99.8%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negN/A
distribute-rgt-inN/A
distribute-rgt-inN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
neg-mul-1N/A
associate-*r*N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
metadata-eval99.8
Applied rewrites99.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.7e-11) (not (<= z 0.165))) (* (* (- y x) z) 6.0) (+ x (* (* 6.0 y) z))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.7e-11) || !(z <= 0.165)) {
tmp = ((y - x) * z) * 6.0;
} else {
tmp = x + ((6.0 * y) * 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 <= (-1.7d-11)) .or. (.not. (z <= 0.165d0))) then
tmp = ((y - x) * z) * 6.0d0
else
tmp = x + ((6.0d0 * y) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.7e-11) || !(z <= 0.165)) {
tmp = ((y - x) * z) * 6.0;
} else {
tmp = x + ((6.0 * y) * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.7e-11) or not (z <= 0.165): tmp = ((y - x) * z) * 6.0 else: tmp = x + ((6.0 * y) * z) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.7e-11) || !(z <= 0.165)) tmp = Float64(Float64(Float64(y - x) * z) * 6.0); else tmp = Float64(x + Float64(Float64(6.0 * y) * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.7e-11) || ~((z <= 0.165))) tmp = ((y - x) * z) * 6.0; else tmp = x + ((6.0 * y) * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.7e-11], N[Not[LessEqual[z, 0.165]], $MachinePrecision]], N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] * 6.0), $MachinePrecision], N[(x + N[(N[(6.0 * y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{-11} \lor \neg \left(z \leq 0.165\right):\\
\;\;\;\;\left(\left(y - x\right) \cdot z\right) \cdot 6\\
\mathbf{else}:\\
\;\;\;\;x + \left(6 \cdot y\right) \cdot z\\
\end{array}
\end{array}
if z < -1.6999999999999999e-11 or 0.165000000000000008 < z Initial program 99.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6498.2
Applied rewrites98.2%
if -1.6999999999999999e-11 < z < 0.165000000000000008Initial program 99.9%
Taylor expanded in x around 0
lower-*.f6499.3
Applied rewrites99.3%
Final simplification98.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.17) (not (<= z 0.165))) (* (* (- y x) z) 6.0) (fma (* z y) 6.0 x)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.17) || !(z <= 0.165)) {
tmp = ((y - x) * z) * 6.0;
} else {
tmp = fma((z * y), 6.0, x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((z <= -0.17) || !(z <= 0.165)) tmp = Float64(Float64(Float64(y - x) * z) * 6.0); else tmp = fma(Float64(z * y), 6.0, x); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.17], N[Not[LessEqual[z, 0.165]], $MachinePrecision]], N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] * 6.0), $MachinePrecision], N[(N[(z * y), $MachinePrecision] * 6.0 + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.17 \lor \neg \left(z \leq 0.165\right):\\
\;\;\;\;\left(\left(y - x\right) \cdot z\right) \cdot 6\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot y, 6, x\right)\\
\end{array}
\end{array}
if z < -0.170000000000000012 or 0.165000000000000008 < z Initial program 99.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6498.2
Applied rewrites98.2%
if -0.170000000000000012 < z < 0.165000000000000008Initial program 99.9%
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 x around 0
*-commutativeN/A
lower-*.f6499.2
Applied rewrites99.2%
Final simplification98.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.3e-25) (not (<= y 3.1e-118))) (fma (* z y) 6.0 x) (fma (* z -6.0) x x)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.3e-25) || !(y <= 3.1e-118)) {
tmp = fma((z * y), 6.0, x);
} else {
tmp = fma((z * -6.0), x, x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -3.3e-25) || !(y <= 3.1e-118)) tmp = fma(Float64(z * y), 6.0, x); else tmp = fma(Float64(z * -6.0), x, x); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.3e-25], N[Not[LessEqual[y, 3.1e-118]], $MachinePrecision]], N[(N[(z * y), $MachinePrecision] * 6.0 + x), $MachinePrecision], N[(N[(z * -6.0), $MachinePrecision] * x + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.3 \cdot 10^{-25} \lor \neg \left(y \leq 3.1 \cdot 10^{-118}\right):\\
\;\;\;\;\mathsf{fma}\left(z \cdot y, 6, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot -6, x, x\right)\\
\end{array}
\end{array}
if y < -3.2999999999999998e-25 or 3.1000000000000001e-118 < y 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 x around 0
*-commutativeN/A
lower-*.f6491.0
Applied rewrites91.0%
if -3.2999999999999998e-25 < y < 3.1000000000000001e-118Initial program 99.7%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negN/A
distribute-rgt-inN/A
distribute-rgt-inN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
neg-mul-1N/A
associate-*r*N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
metadata-eval99.7
Applied rewrites99.7%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lft-identityN/A
lower-fma.f64N/A
lower-*.f6489.8
Applied rewrites89.8%
Applied rewrites89.9%
Final simplification90.7%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.3e-10) (not (<= x 3.2e-208))) (fma (* -6.0 x) z x) (* (* z 6.0) y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.3e-10) || !(x <= 3.2e-208)) {
tmp = fma((-6.0 * x), z, x);
} else {
tmp = (z * 6.0) * y;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((x <= -1.3e-10) || !(x <= 3.2e-208)) tmp = fma(Float64(-6.0 * x), z, x); else tmp = Float64(Float64(z * 6.0) * y); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.3e-10], N[Not[LessEqual[x, 3.2e-208]], $MachinePrecision]], N[(N[(-6.0 * x), $MachinePrecision] * z + x), $MachinePrecision], N[(N[(z * 6.0), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{-10} \lor \neg \left(x \leq 3.2 \cdot 10^{-208}\right):\\
\;\;\;\;\mathsf{fma}\left(-6 \cdot x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot 6\right) \cdot y\\
\end{array}
\end{array}
if x < -1.29999999999999991e-10 or 3.2000000000000001e-208 < x Initial program 99.9%
Taylor expanded in x around inf
distribute-rgt-inN/A
*-lft-identityN/A
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6479.0
Applied rewrites79.0%
if -1.29999999999999991e-10 < x < 3.2000000000000001e-208Initial program 99.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6483.5
Applied rewrites83.5%
Applied rewrites83.6%
Final simplification80.7%
(FPCore (x y z) :precision binary64 (if (<= x -1.3e-10) (fma (* z -6.0) x x) (if (<= x 3.2e-208) (* (* z 6.0) y) (fma (* -6.0 x) z x))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.3e-10) {
tmp = fma((z * -6.0), x, x);
} else if (x <= 3.2e-208) {
tmp = (z * 6.0) * y;
} else {
tmp = fma((-6.0 * x), z, x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= -1.3e-10) tmp = fma(Float64(z * -6.0), x, x); elseif (x <= 3.2e-208) tmp = Float64(Float64(z * 6.0) * y); else tmp = fma(Float64(-6.0 * x), z, x); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, -1.3e-10], N[(N[(z * -6.0), $MachinePrecision] * x + x), $MachinePrecision], If[LessEqual[x, 3.2e-208], N[(N[(z * 6.0), $MachinePrecision] * y), $MachinePrecision], N[(N[(-6.0 * x), $MachinePrecision] * z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{-10}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot -6, x, x\right)\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{-208}:\\
\;\;\;\;\left(z \cdot 6\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-6 \cdot x, z, x\right)\\
\end{array}
\end{array}
if x < -1.29999999999999991e-10Initial program 99.9%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negN/A
distribute-rgt-inN/A
distribute-rgt-inN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
neg-mul-1N/A
associate-*r*N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
metadata-eval99.9
Applied rewrites99.9%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lft-identityN/A
lower-fma.f64N/A
lower-*.f6486.7
Applied rewrites86.7%
Applied rewrites86.7%
if -1.29999999999999991e-10 < x < 3.2000000000000001e-208Initial program 99.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6483.5
Applied rewrites83.5%
Applied rewrites83.6%
if 3.2000000000000001e-208 < x Initial program 99.9%
Taylor expanded in x around inf
distribute-rgt-inN/A
*-lft-identityN/A
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6474.9
Applied rewrites74.9%
Final simplification80.7%
(FPCore (x y z) :precision binary64 (if (<= y -3.3e-25) (* (* y 6.0) z) (if (<= y 8.2e-115) (* (* z -6.0) x) (* (* z 6.0) y))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.3e-25) {
tmp = (y * 6.0) * z;
} else if (y <= 8.2e-115) {
tmp = (z * -6.0) * x;
} else {
tmp = (z * 6.0) * y;
}
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 (y <= (-3.3d-25)) then
tmp = (y * 6.0d0) * z
else if (y <= 8.2d-115) then
tmp = (z * (-6.0d0)) * x
else
tmp = (z * 6.0d0) * y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -3.3e-25) {
tmp = (y * 6.0) * z;
} else if (y <= 8.2e-115) {
tmp = (z * -6.0) * x;
} else {
tmp = (z * 6.0) * y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.3e-25: tmp = (y * 6.0) * z elif y <= 8.2e-115: tmp = (z * -6.0) * x else: tmp = (z * 6.0) * y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.3e-25) tmp = Float64(Float64(y * 6.0) * z); elseif (y <= 8.2e-115) tmp = Float64(Float64(z * -6.0) * x); else tmp = Float64(Float64(z * 6.0) * y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.3e-25) tmp = (y * 6.0) * z; elseif (y <= 8.2e-115) tmp = (z * -6.0) * x; else tmp = (z * 6.0) * y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.3e-25], N[(N[(y * 6.0), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[y, 8.2e-115], N[(N[(z * -6.0), $MachinePrecision] * x), $MachinePrecision], N[(N[(z * 6.0), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.3 \cdot 10^{-25}:\\
\;\;\;\;\left(y \cdot 6\right) \cdot z\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{-115}:\\
\;\;\;\;\left(z \cdot -6\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot 6\right) \cdot y\\
\end{array}
\end{array}
if y < -3.2999999999999998e-25Initial program 99.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6466.7
Applied rewrites66.7%
Applied rewrites66.8%
if -3.2999999999999998e-25 < y < 8.1999999999999993e-115Initial program 99.7%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negN/A
distribute-rgt-inN/A
distribute-rgt-inN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
neg-mul-1N/A
associate-*r*N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
metadata-eval99.8
Applied rewrites99.8%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lft-identityN/A
lower-fma.f64N/A
lower-*.f6489.0
Applied rewrites89.0%
Taylor expanded in z around inf
Applied rewrites44.9%
Applied rewrites45.0%
if 8.1999999999999993e-115 < y Initial program 99.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6460.1
Applied rewrites60.1%
Applied rewrites60.2%
Final simplification56.8%
(FPCore (x y z) :precision binary64 (if (<= y -3.3e-25) (* (* y 6.0) z) (if (<= y 8.2e-115) (* (* -6.0 x) z) (* (* z 6.0) y))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.3e-25) {
tmp = (y * 6.0) * z;
} else if (y <= 8.2e-115) {
tmp = (-6.0 * x) * z;
} else {
tmp = (z * 6.0) * y;
}
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 (y <= (-3.3d-25)) then
tmp = (y * 6.0d0) * z
else if (y <= 8.2d-115) then
tmp = ((-6.0d0) * x) * z
else
tmp = (z * 6.0d0) * y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -3.3e-25) {
tmp = (y * 6.0) * z;
} else if (y <= 8.2e-115) {
tmp = (-6.0 * x) * z;
} else {
tmp = (z * 6.0) * y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.3e-25: tmp = (y * 6.0) * z elif y <= 8.2e-115: tmp = (-6.0 * x) * z else: tmp = (z * 6.0) * y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.3e-25) tmp = Float64(Float64(y * 6.0) * z); elseif (y <= 8.2e-115) tmp = Float64(Float64(-6.0 * x) * z); else tmp = Float64(Float64(z * 6.0) * y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.3e-25) tmp = (y * 6.0) * z; elseif (y <= 8.2e-115) tmp = (-6.0 * x) * z; else tmp = (z * 6.0) * y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.3e-25], N[(N[(y * 6.0), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[y, 8.2e-115], N[(N[(-6.0 * x), $MachinePrecision] * z), $MachinePrecision], N[(N[(z * 6.0), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.3 \cdot 10^{-25}:\\
\;\;\;\;\left(y \cdot 6\right) \cdot z\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{-115}:\\
\;\;\;\;\left(-6 \cdot x\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot 6\right) \cdot y\\
\end{array}
\end{array}
if y < -3.2999999999999998e-25Initial program 99.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6466.7
Applied rewrites66.7%
Applied rewrites66.8%
if -3.2999999999999998e-25 < y < 8.1999999999999993e-115Initial program 99.7%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negN/A
distribute-rgt-inN/A
distribute-rgt-inN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
neg-mul-1N/A
associate-*r*N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
metadata-eval99.8
Applied rewrites99.8%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lft-identityN/A
lower-fma.f64N/A
lower-*.f6489.0
Applied rewrites89.0%
Taylor expanded in z around inf
Applied rewrites44.9%
Applied rewrites44.9%
if 8.1999999999999993e-115 < y Initial program 99.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6460.1
Applied rewrites60.1%
Applied rewrites60.2%
Final simplification56.8%
(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(y - x), Float64(z * 6.0), x) end
code[x_, y_, z_] := N[(N[(y - x), $MachinePrecision] * N[(z * 6.0), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - x, z \cdot 6, x\right)
\end{array}
Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
(FPCore (x y z) :precision binary64 (fma (* z (- y x)) 6.0 x))
double code(double x, double y, double z) {
return fma((z * (y - x)), 6.0, x);
}
function code(x, y, z) return fma(Float64(z * Float64(y - x)), 6.0, x) end
code[x_, y_, z_] := N[(N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision] * 6.0 + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z \cdot \left(y - x\right), 6, x\right)
\end{array}
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%
(FPCore (x y z) :precision binary64 (* (* z 6.0) y))
double code(double x, double y, double z) {
return (z * 6.0) * y;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (z * 6.0d0) * y
end function
public static double code(double x, double y, double z) {
return (z * 6.0) * y;
}
def code(x, y, z): return (z * 6.0) * y
function code(x, y, z) return Float64(Float64(z * 6.0) * y) end
function tmp = code(x, y, z) tmp = (z * 6.0) * y; end
code[x_, y_, z_] := N[(N[(z * 6.0), $MachinePrecision] * y), $MachinePrecision]
\begin{array}{l}
\\
\left(z \cdot 6\right) \cdot y
\end{array}
Initial program 99.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6445.6
Applied rewrites45.6%
Applied rewrites45.6%
Final simplification45.6%
(FPCore (x y z) :precision binary64 (* (* y 6.0) z))
double code(double x, double y, double z) {
return (y * 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 = (y * 6.0d0) * z
end function
public static double code(double x, double y, double z) {
return (y * 6.0) * z;
}
def code(x, y, z): return (y * 6.0) * z
function code(x, y, z) return Float64(Float64(y * 6.0) * z) end
function tmp = code(x, y, z) tmp = (y * 6.0) * z; end
code[x_, y_, z_] := N[(N[(y * 6.0), $MachinePrecision] * z), $MachinePrecision]
\begin{array}{l}
\\
\left(y \cdot 6\right) \cdot z
\end{array}
Initial program 99.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6445.6
Applied rewrites45.6%
Applied rewrites45.6%
Final simplification45.6%
(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 2024318
(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)))