
(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 11 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.8%
+-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%
(FPCore (x y z)
:precision binary64
(if (<= z -1.85e+33)
(* -6.0 (* x z))
(if (<= z -5.4e-75)
(* z (* y 6.0))
(if (<= z 1.45e-93) x (* 6.0 (* y z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.85e+33) {
tmp = -6.0 * (x * z);
} else if (z <= -5.4e-75) {
tmp = z * (y * 6.0);
} else if (z <= 1.45e-93) {
tmp = x;
} else {
tmp = 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.85d+33)) then
tmp = (-6.0d0) * (x * z)
else if (z <= (-5.4d-75)) then
tmp = z * (y * 6.0d0)
else if (z <= 1.45d-93) then
tmp = x
else
tmp = 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.85e+33) {
tmp = -6.0 * (x * z);
} else if (z <= -5.4e-75) {
tmp = z * (y * 6.0);
} else if (z <= 1.45e-93) {
tmp = x;
} else {
tmp = 6.0 * (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.85e+33: tmp = -6.0 * (x * z) elif z <= -5.4e-75: tmp = z * (y * 6.0) elif z <= 1.45e-93: tmp = x else: tmp = 6.0 * (y * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.85e+33) tmp = Float64(-6.0 * Float64(x * z)); elseif (z <= -5.4e-75) tmp = Float64(z * Float64(y * 6.0)); elseif (z <= 1.45e-93) tmp = x; else tmp = Float64(6.0 * Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.85e+33) tmp = -6.0 * (x * z); elseif (z <= -5.4e-75) tmp = z * (y * 6.0); elseif (z <= 1.45e-93) tmp = x; else tmp = 6.0 * (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.85e+33], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -5.4e-75], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.45e-93], x, N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.85 \cdot 10^{+33}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -5.4 \cdot 10^{-75}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{-93}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if z < -1.8499999999999999e33Initial program 99.7%
Taylor expanded in z around inf
associate-*r*N/A
distribute-lft-out--N/A
associate-*r*N/A
*-commutativeN/A
metadata-evalN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
mul-1-negN/A
distribute-rgt-out--N/A
distribute-lft-out--N/A
neg-mul-1N/A
neg-sub0N/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
*-lft-identityN/A
*-inversesN/A
associate-*l/N/A
associate-*r/N/A
associate-*r/N/A
*-rgt-identityN/A
Simplified98.4%
Taylor expanded in x around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6464.2
Simplified64.2%
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6464.3
Applied egg-rr64.3%
if -1.8499999999999999e33 < z < -5.3999999999999996e-75Initial 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.6
Applied egg-rr99.6%
Taylor expanded in y around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6471.7
Simplified71.7%
if -5.3999999999999996e-75 < z < 1.4499999999999999e-93Initial program 99.9%
Taylor expanded in z around 0
Simplified78.9%
if 1.4499999999999999e-93 < z Initial program 99.7%
Taylor expanded in x around 0
*-lowering-*.f64N/A
*-lowering-*.f6462.4
Simplified62.4%
Final simplification69.6%
(FPCore (x y z) :precision binary64 (if (<= z -1.15e+34) (* x (* z -6.0)) (if (<= z -2e-73) (* z (* y 6.0)) (if (<= z 1.3e-94) x (* 6.0 (* y z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.15e+34) {
tmp = x * (z * -6.0);
} else if (z <= -2e-73) {
tmp = z * (y * 6.0);
} else if (z <= 1.3e-94) {
tmp = x;
} else {
tmp = 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.15d+34)) then
tmp = x * (z * (-6.0d0))
else if (z <= (-2d-73)) then
tmp = z * (y * 6.0d0)
else if (z <= 1.3d-94) then
tmp = x
else
tmp = 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.15e+34) {
tmp = x * (z * -6.0);
} else if (z <= -2e-73) {
tmp = z * (y * 6.0);
} else if (z <= 1.3e-94) {
tmp = x;
} else {
tmp = 6.0 * (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.15e+34: tmp = x * (z * -6.0) elif z <= -2e-73: tmp = z * (y * 6.0) elif z <= 1.3e-94: tmp = x else: tmp = 6.0 * (y * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.15e+34) tmp = Float64(x * Float64(z * -6.0)); elseif (z <= -2e-73) tmp = Float64(z * Float64(y * 6.0)); elseif (z <= 1.3e-94) tmp = x; else tmp = Float64(6.0 * Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.15e+34) tmp = x * (z * -6.0); elseif (z <= -2e-73) tmp = z * (y * 6.0); elseif (z <= 1.3e-94) tmp = x; else tmp = 6.0 * (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.15e+34], N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -2e-73], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.3e-94], x, N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{+34}:\\
\;\;\;\;x \cdot \left(z \cdot -6\right)\\
\mathbf{elif}\;z \leq -2 \cdot 10^{-73}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{-94}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if z < -1.1499999999999999e34Initial program 99.7%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
*-lft-identityN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6464.2
Simplified64.2%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6464.3
Simplified64.3%
if -1.1499999999999999e34 < z < -1.99999999999999999e-73Initial 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.6
Applied egg-rr99.6%
Taylor expanded in y around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6471.7
Simplified71.7%
if -1.99999999999999999e-73 < z < 1.29999999999999997e-94Initial program 99.9%
Taylor expanded in z around 0
Simplified78.9%
if 1.29999999999999997e-94 < z Initial program 99.7%
Taylor expanded in x around 0
*-lowering-*.f64N/A
*-lowering-*.f6462.4
Simplified62.4%
Final simplification69.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))))
(if (<= z -4.2e+33)
(* x (* z -6.0))
(if (<= z -2.45e-73) t_0 (if (<= z 1.6e-93) x t_0)))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double tmp;
if (z <= -4.2e+33) {
tmp = x * (z * -6.0);
} else if (z <= -2.45e-73) {
tmp = t_0;
} else if (z <= 1.6e-93) {
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 * (y * z)
if (z <= (-4.2d+33)) then
tmp = x * (z * (-6.0d0))
else if (z <= (-2.45d-73)) then
tmp = t_0
else if (z <= 1.6d-93) 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 * (y * z);
double tmp;
if (z <= -4.2e+33) {
tmp = x * (z * -6.0);
} else if (z <= -2.45e-73) {
tmp = t_0;
} else if (z <= 1.6e-93) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) tmp = 0 if z <= -4.2e+33: tmp = x * (z * -6.0) elif z <= -2.45e-73: tmp = t_0 elif z <= 1.6e-93: tmp = x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -4.2e+33) tmp = Float64(x * Float64(z * -6.0)); elseif (z <= -2.45e-73) tmp = t_0; elseif (z <= 1.6e-93) tmp = x; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * (y * z); tmp = 0.0; if (z <= -4.2e+33) tmp = x * (z * -6.0); elseif (z <= -2.45e-73) tmp = t_0; elseif (z <= 1.6e-93) tmp = x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.2e+33], N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -2.45e-73], t$95$0, If[LessEqual[z, 1.6e-93], x, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -4.2 \cdot 10^{+33}:\\
\;\;\;\;x \cdot \left(z \cdot -6\right)\\
\mathbf{elif}\;z \leq -2.45 \cdot 10^{-73}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{-93}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -4.2000000000000001e33Initial program 99.7%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
*-lft-identityN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6464.2
Simplified64.2%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6464.3
Simplified64.3%
if -4.2000000000000001e33 < z < -2.45000000000000014e-73 or 1.5999999999999999e-93 < z Initial program 99.7%
Taylor expanded in x around 0
*-lowering-*.f64N/A
*-lowering-*.f6464.1
Simplified64.1%
if -2.45000000000000014e-73 < z < 1.5999999999999999e-93Initial program 99.9%
Taylor expanded in z around 0
Simplified78.9%
Final simplification69.6%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* -6.0 (* z (- x y))))) (if (<= z -0.18) t_0 (if (<= z 0.17) (fma (* y z) 6.0 x) t_0))))
double code(double x, double y, double z) {
double t_0 = -6.0 * (z * (x - y));
double tmp;
if (z <= -0.18) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = fma((y * z), 6.0, x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(-6.0 * Float64(z * Float64(x - y))) tmp = 0.0 if (z <= -0.18) tmp = t_0; elseif (z <= 0.17) 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[(-6.0 * N[(z * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.18], t$95$0, If[LessEqual[z, 0.17], N[(N[(y * z), $MachinePrecision] * 6.0 + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -6 \cdot \left(z \cdot \left(x - y\right)\right)\\
\mathbf{if}\;z \leq -0.18:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;\mathsf{fma}\left(y \cdot z, 6, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -0.17999999999999999 or 0.170000000000000012 < z 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%
Taylor expanded in z around inf
metadata-evalN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
neg-sub0N/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
--lowering--.f6498.4
Simplified98.4%
if -0.17999999999999999 < z < 0.170000000000000012Initial program 99.9%
+-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
--lowering--.f6499.9
Applied egg-rr99.9%
Taylor expanded in y around inf
*-commutativeN/A
*-lowering-*.f6499.8
Simplified99.8%
Final simplification99.1%
(FPCore (x y z) :precision binary64 (if (<= x -4.4e+76) (fma z (* x -6.0) x) (if (<= x 3.8e+182) (fma (* y z) 6.0 x) (fma (* x z) -6.0 x))))
double code(double x, double y, double z) {
double tmp;
if (x <= -4.4e+76) {
tmp = fma(z, (x * -6.0), x);
} else if (x <= 3.8e+182) {
tmp = fma((y * z), 6.0, x);
} else {
tmp = fma((x * z), -6.0, x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= -4.4e+76) tmp = fma(z, Float64(x * -6.0), x); elseif (x <= 3.8e+182) tmp = fma(Float64(y * z), 6.0, x); else tmp = fma(Float64(x * z), -6.0, x); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, -4.4e+76], N[(z * N[(x * -6.0), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[x, 3.8e+182], N[(N[(y * z), $MachinePrecision] * 6.0 + x), $MachinePrecision], N[(N[(x * z), $MachinePrecision] * -6.0 + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.4 \cdot 10^{+76}:\\
\;\;\;\;\mathsf{fma}\left(z, x \cdot -6, x\right)\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{+182}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot z, 6, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x \cdot z, -6, x\right)\\
\end{array}
\end{array}
if x < -4.4000000000000001e76Initial program 99.9%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
*-lft-identityN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6490.0
Simplified90.0%
if -4.4000000000000001e76 < x < 3.80000000000000013e182Initial 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%
Taylor expanded in y around inf
*-commutativeN/A
*-lowering-*.f6486.3
Simplified86.3%
if 3.80000000000000013e182 < x Initial program 99.8%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
*-lft-identityN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6499.8
Simplified99.8%
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64100.0
Applied egg-rr100.0%
Final simplification88.6%
(FPCore (x y z) :precision binary64 (let* ((t_0 (fma (* z 6.0) y x))) (if (<= y -2.8e-69) t_0 (if (<= y 1.65e-43) (fma (* x z) -6.0 x) t_0))))
double code(double x, double y, double z) {
double t_0 = fma((z * 6.0), y, x);
double tmp;
if (y <= -2.8e-69) {
tmp = t_0;
} else if (y <= 1.65e-43) {
tmp = fma((x * z), -6.0, x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fma(Float64(z * 6.0), y, x) tmp = 0.0 if (y <= -2.8e-69) tmp = t_0; elseif (y <= 1.65e-43) 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[(N[(z * 6.0), $MachinePrecision] * y + x), $MachinePrecision]}, If[LessEqual[y, -2.8e-69], t$95$0, If[LessEqual[y, 1.65e-43], N[(N[(x * z), $MachinePrecision] * -6.0 + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(z \cdot 6, y, x\right)\\
\mathbf{if}\;y \leq -2.8 \cdot 10^{-69}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.65 \cdot 10^{-43}:\\
\;\;\;\;\mathsf{fma}\left(x \cdot z, -6, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -2.79999999999999979e-69 or 1.65000000000000008e-43 < y 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%
Taylor expanded in y around inf
*-commutativeN/A
*-lowering-*.f6487.7
Simplified87.7%
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6487.7
Applied egg-rr87.7%
if -2.79999999999999979e-69 < y < 1.65000000000000008e-43Initial program 99.8%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
*-lft-identityN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6489.7
Simplified89.7%
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6489.7
Applied egg-rr89.7%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* z (* y 6.0)))) (if (<= y -9.6e+94) t_0 (if (<= y 2.6e+63) (fma (* x z) -6.0 x) t_0))))
double code(double x, double y, double z) {
double t_0 = z * (y * 6.0);
double tmp;
if (y <= -9.6e+94) {
tmp = t_0;
} else if (y <= 2.6e+63) {
tmp = fma((x * z), -6.0, x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(z * Float64(y * 6.0)) tmp = 0.0 if (y <= -9.6e+94) tmp = t_0; elseif (y <= 2.6e+63) 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[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9.6e+94], t$95$0, If[LessEqual[y, 2.6e+63], N[(N[(x * z), $MachinePrecision] * -6.0 + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(y \cdot 6\right)\\
\mathbf{if}\;y \leq -9.6 \cdot 10^{+94}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{+63}:\\
\;\;\;\;\mathsf{fma}\left(x \cdot z, -6, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -9.5999999999999993e94 or 2.6000000000000001e63 < y Initial program 99.8%
+-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%
Taylor expanded in y around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6474.7
Simplified74.7%
if -9.5999999999999993e94 < y < 2.6000000000000001e63Initial program 99.7%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
*-lft-identityN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6479.7
Simplified79.7%
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6479.7
Applied egg-rr79.7%
Final simplification77.7%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* z (* y 6.0)))) (if (<= y -3.7e+93) t_0 (if (<= y 2.3e+63) (fma z (* x -6.0) x) t_0))))
double code(double x, double y, double z) {
double t_0 = z * (y * 6.0);
double tmp;
if (y <= -3.7e+93) {
tmp = t_0;
} else if (y <= 2.3e+63) {
tmp = fma(z, (x * -6.0), x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(z * Float64(y * 6.0)) tmp = 0.0 if (y <= -3.7e+93) tmp = t_0; elseif (y <= 2.3e+63) tmp = fma(z, Float64(x * -6.0), x); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.7e+93], t$95$0, If[LessEqual[y, 2.3e+63], N[(z * N[(x * -6.0), $MachinePrecision] + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(y \cdot 6\right)\\
\mathbf{if}\;y \leq -3.7 \cdot 10^{+93}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{+63}:\\
\;\;\;\;\mathsf{fma}\left(z, x \cdot -6, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -3.69999999999999987e93 or 2.29999999999999993e63 < y Initial program 99.8%
+-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%
Taylor expanded in y around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6474.7
Simplified74.7%
if -3.69999999999999987e93 < y < 2.29999999999999993e63Initial program 99.7%
Taylor expanded in x around inf
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
*-lft-identityN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6479.7
Simplified79.7%
Final simplification77.6%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* 6.0 (* y z)))) (if (<= z -6.9e-74) t_0 (if (<= z 9.4e-94) x t_0))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double tmp;
if (z <= -6.9e-74) {
tmp = t_0;
} else if (z <= 9.4e-94) {
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 * (y * z)
if (z <= (-6.9d-74)) then
tmp = t_0
else if (z <= 9.4d-94) 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 * (y * z);
double tmp;
if (z <= -6.9e-74) {
tmp = t_0;
} else if (z <= 9.4e-94) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) tmp = 0 if z <= -6.9e-74: tmp = t_0 elif z <= 9.4e-94: tmp = x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -6.9e-74) tmp = t_0; elseif (z <= 9.4e-94) tmp = x; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * (y * z); tmp = 0.0; if (z <= -6.9e-74) tmp = t_0; elseif (z <= 9.4e-94) tmp = x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.9e-74], t$95$0, If[LessEqual[z, 9.4e-94], x, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -6.9 \cdot 10^{-74}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 9.4 \cdot 10^{-94}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -6.89999999999999981e-74 or 9.40000000000000007e-94 < z Initial program 99.7%
Taylor expanded in x around 0
*-lowering-*.f64N/A
*-lowering-*.f6455.8
Simplified55.8%
if -6.89999999999999981e-74 < z < 9.40000000000000007e-94Initial program 99.9%
Taylor expanded in z around 0
Simplified78.9%
(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.8%
Taylor expanded in z around 0
Simplified33.8%
(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 2024198
(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)))