
(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 13 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 (/ (* 6.0 z) (/ 1.0 (- y x)))))
double code(double x, double y, double z) {
return x + ((6.0 * z) / (1.0 / (y - x)));
}
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) / (1.0d0 / (y - x)))
end function
public static double code(double x, double y, double z) {
return x + ((6.0 * z) / (1.0 / (y - x)));
}
def code(x, y, z): return x + ((6.0 * z) / (1.0 / (y - x)))
function code(x, y, z) return Float64(x + Float64(Float64(6.0 * z) / Float64(1.0 / Float64(y - x)))) end
function tmp = code(x, y, z) tmp = x + ((6.0 * z) / (1.0 / (y - x))); end
code[x_, y_, z_] := N[(x + N[(N[(6.0 * z), $MachinePrecision] / N[(1.0 / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{6 \cdot z}{\frac{1}{y - x}}
\end{array}
Initial program 99.7%
associate-*l*N/A
*-commutativeN/A
flip--N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
clear-numN/A
flip--N/A
/-lowering-/.f64N/A
--lowering--.f6499.8
Applied egg-rr99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* z y))) (t_1 (fma -6.0 (* x z) 0.0)))
(if (<= z -8e+71)
t_0
(if (<= z -3250000000000.0)
t_1
(if (<= z -4.7e-57) t_0 (if (<= z 27500000.0) x t_1))))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (z * y);
double t_1 = fma(-6.0, (x * z), 0.0);
double tmp;
if (z <= -8e+71) {
tmp = t_0;
} else if (z <= -3250000000000.0) {
tmp = t_1;
} else if (z <= -4.7e-57) {
tmp = t_0;
} else if (z <= 27500000.0) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(6.0 * Float64(z * y)) t_1 = fma(-6.0, Float64(x * z), 0.0) tmp = 0.0 if (z <= -8e+71) tmp = t_0; elseif (z <= -3250000000000.0) tmp = t_1; elseif (z <= -4.7e-57) tmp = t_0; elseif (z <= 27500000.0) tmp = x; else tmp = t_1; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(x * z), $MachinePrecision] + 0.0), $MachinePrecision]}, If[LessEqual[z, -8e+71], t$95$0, If[LessEqual[z, -3250000000000.0], t$95$1, If[LessEqual[z, -4.7e-57], t$95$0, If[LessEqual[z, 27500000.0], x, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(z \cdot y\right)\\
t_1 := \mathsf{fma}\left(-6, x \cdot z, 0\right)\\
\mathbf{if}\;z \leq -8 \cdot 10^{+71}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -3250000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -4.7 \cdot 10^{-57}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 27500000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.0000000000000003e71 or -3.25e12 < z < -4.6999999999999998e-57Initial program 99.6%
associate-*l*N/A
*-commutativeN/A
flip--N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
clear-numN/A
flip--N/A
/-lowering-/.f64N/A
--lowering--.f6499.8
Applied egg-rr99.8%
Taylor expanded in x around 0
+-rgt-identityN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6465.8
Simplified65.8%
+-rgt-identityN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6465.8
Applied egg-rr65.8%
if -8.0000000000000003e71 < z < -3.25e12 or 2.75e7 < z Initial program 99.6%
Taylor expanded in x around inf
distribute-rgt-inN/A
*-lft-identityN/A
associate-*r*N/A
*-commutativeN/A
+-rgt-identityN/A
*-lft-identityN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6466.8
Simplified66.8%
+-rgt-identityN/A
distribute-rgt-inN/A
*-lft-identityN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6466.8
Applied egg-rr66.8%
Taylor expanded in z around inf
associate-*r*N/A
+-rgt-identityN/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6466.3
Simplified66.3%
if -4.6999999999999998e-57 < z < 2.75e7Initial program 99.9%
Taylor expanded in z around 0
Simplified72.8%
Final simplification69.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fma y (* 6.0 z) x)) (t_1 (fma -6.0 (* x z) 0.0)))
(if (<= z -7.8e+71)
t_0
(if (<= z -2950000000000.0) t_1 (if (<= z 31500000000.0) t_0 t_1)))))
double code(double x, double y, double z) {
double t_0 = fma(y, (6.0 * z), x);
double t_1 = fma(-6.0, (x * z), 0.0);
double tmp;
if (z <= -7.8e+71) {
tmp = t_0;
} else if (z <= -2950000000000.0) {
tmp = t_1;
} else if (z <= 31500000000.0) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z) t_0 = fma(y, Float64(6.0 * z), x) t_1 = fma(-6.0, Float64(x * z), 0.0) tmp = 0.0 if (z <= -7.8e+71) tmp = t_0; elseif (z <= -2950000000000.0) tmp = t_1; elseif (z <= 31500000000.0) tmp = t_0; else tmp = t_1; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(6.0 * z), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(x * z), $MachinePrecision] + 0.0), $MachinePrecision]}, If[LessEqual[z, -7.8e+71], t$95$0, If[LessEqual[z, -2950000000000.0], t$95$1, If[LessEqual[z, 31500000000.0], t$95$0, t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(y, 6 \cdot z, x\right)\\
t_1 := \mathsf{fma}\left(-6, x \cdot z, 0\right)\\
\mathbf{if}\;z \leq -7.8 \cdot 10^{+71}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -2950000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 31500000000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.8000000000000002e71 or -2.95e12 < z < 3.15e10Initial program 99.8%
+-commutativeN/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-lowering-*.f6499.8
Applied egg-rr99.8%
Taylor expanded in y around inf
Simplified90.1%
if -7.8000000000000002e71 < z < -2.95e12 or 3.15e10 < z Initial program 99.6%
Taylor expanded in x around inf
distribute-rgt-inN/A
*-lft-identityN/A
associate-*r*N/A
*-commutativeN/A
+-rgt-identityN/A
*-lft-identityN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6466.8
Simplified66.8%
+-rgt-identityN/A
distribute-rgt-inN/A
*-lft-identityN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6466.8
Applied egg-rr66.8%
Taylor expanded in z around inf
associate-*r*N/A
+-rgt-identityN/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6466.3
Simplified66.3%
(FPCore (x y z) :precision binary64 (let* ((t_0 (fma y (* 6.0 z) x))) (if (<= y -1.2e-72) t_0 (if (<= y 1.16e-6) (+ x (* -6.0 (* x z))) t_0))))
double code(double x, double y, double z) {
double t_0 = fma(y, (6.0 * z), x);
double tmp;
if (y <= -1.2e-72) {
tmp = t_0;
} else if (y <= 1.16e-6) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fma(y, Float64(6.0 * z), x) tmp = 0.0 if (y <= -1.2e-72) tmp = t_0; elseif (y <= 1.16e-6) tmp = Float64(x + Float64(-6.0 * Float64(x * z))); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(6.0 * z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -1.2e-72], t$95$0, If[LessEqual[y, 1.16e-6], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(y, 6 \cdot z, x\right)\\
\mathbf{if}\;y \leq -1.2 \cdot 10^{-72}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.16 \cdot 10^{-6}:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.2e-72 or 1.1599999999999999e-6 < y Initial program 99.7%
+-commutativeN/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-lowering-*.f6499.8
Applied egg-rr99.8%
Taylor expanded in y around inf
Simplified87.6%
if -1.2e-72 < y < 1.1599999999999999e-6Initial program 99.8%
associate-*l*N/A
*-commutativeN/A
flip--N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
clear-numN/A
flip--N/A
/-lowering-/.f64N/A
--lowering--.f6499.8
Applied egg-rr99.8%
Taylor expanded in y around 0
+-rgt-identityN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
+-rgt-identityN/A
*-commutativeN/A
accelerator-lowering-fma.f6492.3
Simplified92.3%
+-rgt-identityN/A
+-rgt-identityN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6492.3
Applied egg-rr92.3%
Final simplification89.7%
(FPCore (x y z) :precision binary64 (let* ((t_0 (fma y (* 6.0 z) x))) (if (<= y -8.8e-73) t_0 (if (<= y 1.9e-6) (fma (* x z) -6.0 x) t_0))))
double code(double x, double y, double z) {
double t_0 = fma(y, (6.0 * z), x);
double tmp;
if (y <= -8.8e-73) {
tmp = t_0;
} else if (y <= 1.9e-6) {
tmp = fma((x * z), -6.0, x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fma(y, Float64(6.0 * z), x) tmp = 0.0 if (y <= -8.8e-73) tmp = t_0; elseif (y <= 1.9e-6) tmp = fma(Float64(x * z), -6.0, x); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(6.0 * z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -8.8e-73], t$95$0, If[LessEqual[y, 1.9e-6], N[(N[(x * z), $MachinePrecision] * -6.0 + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(y, 6 \cdot z, x\right)\\
\mathbf{if}\;y \leq -8.8 \cdot 10^{-73}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(x \cdot z, -6, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -8.8000000000000001e-73 or 1.9e-6 < y Initial program 99.7%
+-commutativeN/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-lowering-*.f6499.8
Applied egg-rr99.8%
Taylor expanded in y around inf
Simplified87.6%
if -8.8000000000000001e-73 < y < 1.9e-6Initial program 99.8%
Taylor expanded in x around inf
distribute-rgt-inN/A
*-lft-identityN/A
associate-*r*N/A
*-commutativeN/A
+-rgt-identityN/A
*-lft-identityN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6492.3
Simplified92.3%
+-rgt-identityN/A
distribute-lft-inN/A
associate-*r*N/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6492.3
Applied egg-rr92.3%
(FPCore (x y z) :precision binary64 (let* ((t_0 (fma y (* 6.0 z) x))) (if (<= y -1.4e-72) t_0 (if (<= y 1.95e-6) (fma (* x -6.0) z x) t_0))))
double code(double x, double y, double z) {
double t_0 = fma(y, (6.0 * z), x);
double tmp;
if (y <= -1.4e-72) {
tmp = t_0;
} else if (y <= 1.95e-6) {
tmp = fma((x * -6.0), z, x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fma(y, Float64(6.0 * z), x) tmp = 0.0 if (y <= -1.4e-72) tmp = t_0; elseif (y <= 1.95e-6) tmp = fma(Float64(x * -6.0), z, x); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(6.0 * z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -1.4e-72], t$95$0, If[LessEqual[y, 1.95e-6], N[(N[(x * -6.0), $MachinePrecision] * z + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(y, 6 \cdot z, x\right)\\
\mathbf{if}\;y \leq -1.4 \cdot 10^{-72}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.95 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(x \cdot -6, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.3999999999999999e-72 or 1.95e-6 < y Initial program 99.7%
+-commutativeN/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-lowering-*.f6499.8
Applied egg-rr99.8%
Taylor expanded in y around inf
Simplified87.6%
if -1.3999999999999999e-72 < y < 1.95e-6Initial program 99.8%
Taylor expanded in x around inf
distribute-rgt-inN/A
*-lft-identityN/A
associate-*r*N/A
*-commutativeN/A
+-rgt-identityN/A
*-lft-identityN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6492.3
Simplified92.3%
+-rgt-identityN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6492.3
Applied egg-rr92.3%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* 6.0 (* z y)))) (if (<= z -1.7e-57) t_0 (if (<= z 2.7e-53) x t_0))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (z * y);
double tmp;
if (z <= -1.7e-57) {
tmp = t_0;
} else if (z <= 2.7e-53) {
tmp = x;
} else {
tmp = t_0;
}
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) :: t_0
real(8) :: tmp
t_0 = 6.0d0 * (z * y)
if (z <= (-1.7d-57)) then
tmp = t_0
else if (z <= 2.7d-53) then
tmp = x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 6.0 * (z * y);
double tmp;
if (z <= -1.7e-57) {
tmp = t_0;
} else if (z <= 2.7e-53) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (z * y) tmp = 0 if z <= -1.7e-57: tmp = t_0 elif z <= 2.7e-53: tmp = x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(z * y)) tmp = 0.0 if (z <= -1.7e-57) tmp = t_0; elseif (z <= 2.7e-53) tmp = x; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * (z * y); tmp = 0.0; if (z <= -1.7e-57) tmp = t_0; elseif (z <= 2.7e-53) tmp = x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.7e-57], t$95$0, If[LessEqual[z, 2.7e-53], x, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(z \cdot y\right)\\
\mathbf{if}\;z \leq -1.7 \cdot 10^{-57}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-53}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.70000000000000008e-57 or 2.6999999999999999e-53 < z Initial program 99.6%
associate-*l*N/A
*-commutativeN/A
flip--N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
clear-numN/A
flip--N/A
/-lowering-/.f64N/A
--lowering--.f6499.7
Applied egg-rr99.7%
Taylor expanded in x around 0
+-rgt-identityN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6449.2
Simplified49.2%
+-rgt-identityN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6449.2
Applied egg-rr49.2%
if -1.70000000000000008e-57 < z < 2.6999999999999999e-53Initial program 99.9%
Taylor expanded in z around 0
Simplified76.5%
Final simplification60.9%
(FPCore (x y z) :precision binary64 (if (<= z -5.2e-63) (* (* 6.0 z) y) (if (<= z 1.3e-54) x (* z (* 6.0 y)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.2e-63) {
tmp = (6.0 * z) * y;
} else if (z <= 1.3e-54) {
tmp = 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 (z <= (-5.2d-63)) then
tmp = (6.0d0 * z) * y
else if (z <= 1.3d-54) then
tmp = 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 (z <= -5.2e-63) {
tmp = (6.0 * z) * y;
} else if (z <= 1.3e-54) {
tmp = x;
} else {
tmp = z * (6.0 * y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.2e-63: tmp = (6.0 * z) * y elif z <= 1.3e-54: tmp = x else: tmp = z * (6.0 * y) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.2e-63) tmp = Float64(Float64(6.0 * z) * y); elseif (z <= 1.3e-54) tmp = x; else tmp = Float64(z * Float64(6.0 * y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5.2e-63) tmp = (6.0 * z) * y; elseif (z <= 1.3e-54) tmp = x; else tmp = z * (6.0 * y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.2e-63], N[(N[(6.0 * z), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, 1.3e-54], x, N[(z * N[(6.0 * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{-63}:\\
\;\;\;\;\left(6 \cdot z\right) \cdot y\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{-54}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(6 \cdot y\right)\\
\end{array}
\end{array}
if z < -5.2000000000000003e-63Initial program 99.6%
associate-*l*N/A
*-commutativeN/A
flip--N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
clear-numN/A
flip--N/A
/-lowering-/.f64N/A
--lowering--.f6499.7
Applied egg-rr99.7%
Taylor expanded in x around 0
+-rgt-identityN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6455.9
Simplified55.9%
+-rgt-identityN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6455.8
Applied egg-rr55.8%
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6455.8
Applied egg-rr55.8%
if -5.2000000000000003e-63 < z < 1.30000000000000001e-54Initial program 99.9%
Taylor expanded in z around 0
Simplified76.5%
if 1.30000000000000001e-54 < z Initial program 99.7%
associate-*l*N/A
*-commutativeN/A
flip--N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
clear-numN/A
flip--N/A
/-lowering-/.f64N/A
--lowering--.f6499.7
Applied egg-rr99.7%
Taylor expanded in x around 0
+-rgt-identityN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6442.3
Simplified42.3%
+-rgt-identityN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6442.3
Applied egg-rr42.3%
Final simplification60.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (* 6.0 z) y))) (if (<= z -4e-57) t_0 (if (<= z 6.3e-54) x t_0))))
double code(double x, double y, double z) {
double t_0 = (6.0 * z) * y;
double tmp;
if (z <= -4e-57) {
tmp = t_0;
} else if (z <= 6.3e-54) {
tmp = x;
} else {
tmp = t_0;
}
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) :: t_0
real(8) :: tmp
t_0 = (6.0d0 * z) * y
if (z <= (-4d-57)) then
tmp = t_0
else if (z <= 6.3d-54) then
tmp = x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (6.0 * z) * y;
double tmp;
if (z <= -4e-57) {
tmp = t_0;
} else if (z <= 6.3e-54) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (6.0 * z) * y tmp = 0 if z <= -4e-57: tmp = t_0 elif z <= 6.3e-54: tmp = x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(6.0 * z) * y) tmp = 0.0 if (z <= -4e-57) tmp = t_0; elseif (z <= 6.3e-54) tmp = x; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (6.0 * z) * y; tmp = 0.0; if (z <= -4e-57) tmp = t_0; elseif (z <= 6.3e-54) tmp = x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(6.0 * z), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[z, -4e-57], t$95$0, If[LessEqual[z, 6.3e-54], x, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(6 \cdot z\right) \cdot y\\
\mathbf{if}\;z \leq -4 \cdot 10^{-57}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 6.3 \cdot 10^{-54}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -3.99999999999999982e-57 or 6.30000000000000002e-54 < z Initial program 99.6%
associate-*l*N/A
*-commutativeN/A
flip--N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
clear-numN/A
flip--N/A
/-lowering-/.f64N/A
--lowering--.f6499.7
Applied egg-rr99.7%
Taylor expanded in x around 0
+-rgt-identityN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6449.2
Simplified49.2%
+-rgt-identityN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6449.1
Applied egg-rr49.1%
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6449.2
Applied egg-rr49.2%
if -3.99999999999999982e-57 < z < 6.30000000000000002e-54Initial program 99.9%
Taylor expanded in z around 0
Simplified76.5%
(FPCore (x y z) :precision binary64 (fma (- y x) (* 6.0 z) x))
double code(double x, double y, double z) {
return fma((y - x), (6.0 * z), x);
}
function code(x, y, z) return fma(Float64(y - x), Float64(6.0 * z), x) end
code[x_, y_, z_] := N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - x, 6 \cdot z, x\right)
\end{array}
Initial program 99.7%
+-commutativeN/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-lowering-*.f6499.8
Applied egg-rr99.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.7%
+-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
--lowering--.f6499.8
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (fma (* 6.0 (- y x)) z x))
double code(double x, double y, double z) {
return fma((6.0 * (y - x)), z, x);
}
function code(x, y, z) return fma(Float64(6.0 * Float64(y - x)), z, x) end
code[x_, y_, z_] := N[(N[(6.0 * N[(y - x), $MachinePrecision]), $MachinePrecision] * z + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(6 \cdot \left(y - x\right), z, x\right)
\end{array}
Initial program 99.7%
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
--lowering--.f6499.7
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.7%
Taylor expanded in z around 0
Simplified37.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 2024195
(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)))