
(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 (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.1%
+-commutative99.1%
associate-*l*99.8%
fma-define99.8%
Simplified99.8%
(FPCore (x y z) :precision binary64 (if (<= z -5.6e+17) (* -6.0 (* x z)) (if (or (<= z -3.2e-54) (not (<= z 2.4e-28))) (* y (* 6.0 z)) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.6e+17) {
tmp = -6.0 * (x * z);
} else if ((z <= -3.2e-54) || !(z <= 2.4e-28)) {
tmp = y * (6.0 * z);
} else {
tmp = x;
}
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.6d+17)) then
tmp = (-6.0d0) * (x * z)
else if ((z <= (-3.2d-54)) .or. (.not. (z <= 2.4d-28))) then
tmp = y * (6.0d0 * z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -5.6e+17) {
tmp = -6.0 * (x * z);
} else if ((z <= -3.2e-54) || !(z <= 2.4e-28)) {
tmp = y * (6.0 * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.6e+17: tmp = -6.0 * (x * z) elif (z <= -3.2e-54) or not (z <= 2.4e-28): tmp = y * (6.0 * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.6e+17) tmp = Float64(-6.0 * Float64(x * z)); elseif ((z <= -3.2e-54) || !(z <= 2.4e-28)) tmp = Float64(y * Float64(6.0 * z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5.6e+17) tmp = -6.0 * (x * z); elseif ((z <= -3.2e-54) || ~((z <= 2.4e-28))) tmp = y * (6.0 * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.6e+17], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -3.2e-54], N[Not[LessEqual[z, 2.4e-28]], $MachinePrecision]], N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.6 \cdot 10^{+17}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -3.2 \cdot 10^{-54} \lor \neg \left(z \leq 2.4 \cdot 10^{-28}\right):\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -5.6e17Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 99.7%
associate-*r*99.7%
*-commutative99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in y around 0 56.1%
*-commutative56.1%
Simplified56.1%
if -5.6e17 < z < -3.19999999999999998e-54 or 2.4000000000000002e-28 < z Initial program 99.7%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.6%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 88.8%
associate-*r*89.0%
*-commutative89.0%
*-commutative89.0%
Simplified89.0%
Taylor expanded in y around inf 57.9%
if -3.19999999999999998e-54 < z < 2.4000000000000002e-28Initial program 98.4%
Taylor expanded in z around 0 71.4%
Final simplification64.1%
(FPCore (x y z) :precision binary64 (if (<= z -2e+16) (* -6.0 (* x z)) (if (or (<= z -2.6e-54) (not (<= z 4.5e-28))) (* 6.0 (* y z)) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -2e+16) {
tmp = -6.0 * (x * z);
} else if ((z <= -2.6e-54) || !(z <= 4.5e-28)) {
tmp = 6.0 * (y * z);
} else {
tmp = x;
}
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 <= (-2d+16)) then
tmp = (-6.0d0) * (x * z)
else if ((z <= (-2.6d-54)) .or. (.not. (z <= 4.5d-28))) then
tmp = 6.0d0 * (y * z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -2e+16) {
tmp = -6.0 * (x * z);
} else if ((z <= -2.6e-54) || !(z <= 4.5e-28)) {
tmp = 6.0 * (y * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2e+16: tmp = -6.0 * (x * z) elif (z <= -2.6e-54) or not (z <= 4.5e-28): tmp = 6.0 * (y * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2e+16) tmp = Float64(-6.0 * Float64(x * z)); elseif ((z <= -2.6e-54) || !(z <= 4.5e-28)) tmp = Float64(6.0 * Float64(y * z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2e+16) tmp = -6.0 * (x * z); elseif ((z <= -2.6e-54) || ~((z <= 4.5e-28))) tmp = 6.0 * (y * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2e+16], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -2.6e-54], N[Not[LessEqual[z, 4.5e-28]], $MachinePrecision]], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{+16}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -2.6 \cdot 10^{-54} \lor \neg \left(z \leq 4.5 \cdot 10^{-28}\right):\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2e16Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 99.7%
associate-*r*99.7%
*-commutative99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in y around 0 56.1%
*-commutative56.1%
Simplified56.1%
if -2e16 < z < -2.60000000000000002e-54 or 4.4999999999999998e-28 < z Initial program 99.7%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.6%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 57.7%
if -2.60000000000000002e-54 < z < 4.4999999999999998e-28Initial program 98.4%
Taylor expanded in z around 0 71.4%
Final simplification64.1%
(FPCore (x y z) :precision binary64 (if (<= z -1.6e+16) (* z (* x -6.0)) (if (<= z -2.5e-54) (* y (* 6.0 z)) (if (<= z 7.4e-28) x (* z (* y 6.0))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.6e+16) {
tmp = z * (x * -6.0);
} else if (z <= -2.5e-54) {
tmp = y * (6.0 * z);
} else if (z <= 7.4e-28) {
tmp = x;
} else {
tmp = z * (y * 6.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) :: tmp
if (z <= (-1.6d+16)) then
tmp = z * (x * (-6.0d0))
else if (z <= (-2.5d-54)) then
tmp = y * (6.0d0 * z)
else if (z <= 7.4d-28) then
tmp = x
else
tmp = z * (y * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.6e+16) {
tmp = z * (x * -6.0);
} else if (z <= -2.5e-54) {
tmp = y * (6.0 * z);
} else if (z <= 7.4e-28) {
tmp = x;
} else {
tmp = z * (y * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.6e+16: tmp = z * (x * -6.0) elif z <= -2.5e-54: tmp = y * (6.0 * z) elif z <= 7.4e-28: tmp = x else: tmp = z * (y * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.6e+16) tmp = Float64(z * Float64(x * -6.0)); elseif (z <= -2.5e-54) tmp = Float64(y * Float64(6.0 * z)); elseif (z <= 7.4e-28) tmp = x; else tmp = Float64(z * Float64(y * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.6e+16) tmp = z * (x * -6.0); elseif (z <= -2.5e-54) tmp = y * (6.0 * z); elseif (z <= 7.4e-28) tmp = x; else tmp = z * (y * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.6e+16], N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -2.5e-54], N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.4e-28], x, N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{+16}:\\
\;\;\;\;z \cdot \left(x \cdot -6\right)\\
\mathbf{elif}\;z \leq -2.5 \cdot 10^{-54}:\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq 7.4 \cdot 10^{-28}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\end{array}
\end{array}
if z < -1.6e16Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 99.7%
associate-*r*99.7%
*-commutative99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in y around 0 56.1%
*-commutative56.1%
*-commutative56.1%
associate-*l*56.2%
Simplified56.2%
if -1.6e16 < z < -2.50000000000000008e-54Initial program 99.5%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.5%
fma-define99.6%
Applied egg-rr99.6%
Taylor expanded in z around inf 68.8%
associate-*r*69.0%
*-commutative69.0%
*-commutative69.0%
Simplified69.0%
Taylor expanded in y around inf 60.1%
if -2.50000000000000008e-54 < z < 7.40000000000000039e-28Initial program 98.4%
Taylor expanded in z around 0 71.4%
if 7.40000000000000039e-28 < z Initial program 99.8%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 57.0%
associate-*r*57.2%
*-commutative57.2%
*-commutative57.2%
*-commutative57.2%
Simplified57.2%
Final simplification64.2%
(FPCore (x y z) :precision binary64 (if (<= z -2e+15) (* -6.0 (* x z)) (if (<= z -3e-54) (* y (* 6.0 z)) (if (<= z 7.2e-28) x (* z (* y 6.0))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -2e+15) {
tmp = -6.0 * (x * z);
} else if (z <= -3e-54) {
tmp = y * (6.0 * z);
} else if (z <= 7.2e-28) {
tmp = x;
} else {
tmp = z * (y * 6.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) :: tmp
if (z <= (-2d+15)) then
tmp = (-6.0d0) * (x * z)
else if (z <= (-3d-54)) then
tmp = y * (6.0d0 * z)
else if (z <= 7.2d-28) then
tmp = x
else
tmp = z * (y * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -2e+15) {
tmp = -6.0 * (x * z);
} else if (z <= -3e-54) {
tmp = y * (6.0 * z);
} else if (z <= 7.2e-28) {
tmp = x;
} else {
tmp = z * (y * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2e+15: tmp = -6.0 * (x * z) elif z <= -3e-54: tmp = y * (6.0 * z) elif z <= 7.2e-28: tmp = x else: tmp = z * (y * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2e+15) tmp = Float64(-6.0 * Float64(x * z)); elseif (z <= -3e-54) tmp = Float64(y * Float64(6.0 * z)); elseif (z <= 7.2e-28) tmp = x; else tmp = Float64(z * Float64(y * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2e+15) tmp = -6.0 * (x * z); elseif (z <= -3e-54) tmp = y * (6.0 * z); elseif (z <= 7.2e-28) tmp = x; else tmp = z * (y * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2e+15], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -3e-54], N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.2e-28], x, N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{+15}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -3 \cdot 10^{-54}:\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-28}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\end{array}
\end{array}
if z < -2e15Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 99.7%
associate-*r*99.7%
*-commutative99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in y around 0 56.1%
*-commutative56.1%
Simplified56.1%
if -2e15 < z < -3.00000000000000009e-54Initial program 99.5%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.5%
fma-define99.6%
Applied egg-rr99.6%
Taylor expanded in z around inf 68.8%
associate-*r*69.0%
*-commutative69.0%
*-commutative69.0%
Simplified69.0%
Taylor expanded in y around inf 60.1%
if -3.00000000000000009e-54 < z < 7.1999999999999997e-28Initial program 98.4%
Taylor expanded in z around 0 71.4%
if 7.1999999999999997e-28 < z Initial program 99.8%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 57.0%
associate-*r*57.2%
*-commutative57.2%
*-commutative57.2%
*-commutative57.2%
Simplified57.2%
Final simplification64.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.165) (not (<= z 0.00086))) (* (- y x) (* 6.0 z)) (+ x (* y (* 6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.165) || !(z <= 0.00086)) {
tmp = (y - x) * (6.0 * z);
} else {
tmp = x + (y * (6.0 * 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.165d0)) .or. (.not. (z <= 0.00086d0))) then
tmp = (y - x) * (6.0d0 * z)
else
tmp = x + (y * (6.0d0 * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.165) || !(z <= 0.00086)) {
tmp = (y - x) * (6.0 * z);
} else {
tmp = x + (y * (6.0 * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.165) or not (z <= 0.00086): tmp = (y - x) * (6.0 * z) else: tmp = x + (y * (6.0 * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.165) || !(z <= 0.00086)) tmp = Float64(Float64(y - x) * Float64(6.0 * z)); else tmp = Float64(x + Float64(y * Float64(6.0 * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.165) || ~((z <= 0.00086))) tmp = (y - x) * (6.0 * z); else tmp = x + (y * (6.0 * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.165], N[Not[LessEqual[z, 0.00086]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.165 \lor \neg \left(z \leq 0.00086\right):\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if z < -0.165000000000000008 or 8.59999999999999979e-4 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.6%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 98.1%
associate-*r*98.2%
*-commutative98.2%
*-commutative98.2%
Simplified98.2%
if -0.165000000000000008 < z < 8.59999999999999979e-4Initial program 98.5%
Taylor expanded in y around inf 99.2%
*-commutative99.2%
associate-*r*99.2%
Simplified99.2%
Final simplification98.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.145) (not (<= z 0.00086))) (* (- y x) (* 6.0 z)) (+ x (* 6.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.145) || !(z <= 0.00086)) {
tmp = (y - x) * (6.0 * z);
} 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 <= (-0.145d0)) .or. (.not. (z <= 0.00086d0))) then
tmp = (y - x) * (6.0d0 * z)
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 <= -0.145) || !(z <= 0.00086)) {
tmp = (y - x) * (6.0 * z);
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.145) or not (z <= 0.00086): tmp = (y - x) * (6.0 * z) else: tmp = x + (6.0 * (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.145) || !(z <= 0.00086)) tmp = Float64(Float64(y - x) * Float64(6.0 * z)); else tmp = Float64(x + Float64(6.0 * Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.145) || ~((z <= 0.00086))) tmp = (y - x) * (6.0 * z); else tmp = x + (6.0 * (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.145], N[Not[LessEqual[z, 0.00086]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.145 \lor \neg \left(z \leq 0.00086\right):\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if z < -0.14499999999999999 or 8.59999999999999979e-4 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.6%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 98.1%
associate-*r*98.2%
*-commutative98.2%
*-commutative98.2%
Simplified98.2%
if -0.14499999999999999 < z < 8.59999999999999979e-4Initial program 98.5%
Taylor expanded in y around inf 99.2%
*-commutative99.2%
Simplified99.2%
Final simplification98.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.45e-54) (not (<= z 0.00044))) (* (- y x) (* 6.0 z)) (* x (+ (* z -6.0) 1.0))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.45e-54) || !(z <= 0.00044)) {
tmp = (y - x) * (6.0 * z);
} else {
tmp = x * ((z * -6.0) + 1.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) :: tmp
if ((z <= (-2.45d-54)) .or. (.not. (z <= 0.00044d0))) then
tmp = (y - x) * (6.0d0 * z)
else
tmp = x * ((z * (-6.0d0)) + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -2.45e-54) || !(z <= 0.00044)) {
tmp = (y - x) * (6.0 * z);
} else {
tmp = x * ((z * -6.0) + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.45e-54) or not (z <= 0.00044): tmp = (y - x) * (6.0 * z) else: tmp = x * ((z * -6.0) + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.45e-54) || !(z <= 0.00044)) tmp = Float64(Float64(y - x) * Float64(6.0 * z)); else tmp = Float64(x * Float64(Float64(z * -6.0) + 1.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.45e-54) || ~((z <= 0.00044))) tmp = (y - x) * (6.0 * z); else tmp = x * ((z * -6.0) + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.45e-54], N[Not[LessEqual[z, 0.00044]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(z * -6.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.45 \cdot 10^{-54} \lor \neg \left(z \leq 0.00044\right):\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\
\end{array}
\end{array}
if z < -2.4500000000000001e-54 or 4.40000000000000016e-4 < z Initial program 99.7%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.6%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 94.9%
associate-*r*95.1%
*-commutative95.1%
*-commutative95.1%
Simplified95.1%
if -2.4500000000000001e-54 < z < 4.40000000000000016e-4Initial program 98.5%
Taylor expanded in x around inf 70.8%
+-commutative70.8%
Simplified70.8%
Final simplification82.7%
(FPCore (x y z) :precision binary64 (if (<= y -5.8e+167) (* 6.0 (* y z)) (if (<= y 2.3e+41) (* x (+ (* z -6.0) 1.0)) (* y (* 6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -5.8e+167) {
tmp = 6.0 * (y * z);
} else if (y <= 2.3e+41) {
tmp = x * ((z * -6.0) + 1.0);
} else {
tmp = y * (6.0 * 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 (y <= (-5.8d+167)) then
tmp = 6.0d0 * (y * z)
else if (y <= 2.3d+41) then
tmp = x * ((z * (-6.0d0)) + 1.0d0)
else
tmp = y * (6.0d0 * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -5.8e+167) {
tmp = 6.0 * (y * z);
} else if (y <= 2.3e+41) {
tmp = x * ((z * -6.0) + 1.0);
} else {
tmp = y * (6.0 * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5.8e+167: tmp = 6.0 * (y * z) elif y <= 2.3e+41: tmp = x * ((z * -6.0) + 1.0) else: tmp = y * (6.0 * z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5.8e+167) tmp = Float64(6.0 * Float64(y * z)); elseif (y <= 2.3e+41) tmp = Float64(x * Float64(Float64(z * -6.0) + 1.0)); else tmp = Float64(y * Float64(6.0 * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5.8e+167) tmp = 6.0 * (y * z); elseif (y <= 2.3e+41) tmp = x * ((z * -6.0) + 1.0); else tmp = y * (6.0 * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5.8e+167], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.3e+41], N[(x * N[(N[(z * -6.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.8 \cdot 10^{+167}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{+41}:\\
\;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if y < -5.79999999999999949e167Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.8%
fma-define99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 82.6%
if -5.79999999999999949e167 < y < 2.2999999999999998e41Initial program 99.4%
Taylor expanded in x around inf 77.8%
+-commutative77.8%
Simplified77.8%
if 2.2999999999999998e41 < y Initial program 97.8%
associate-*r*99.9%
+-commutative99.9%
*-commutative99.9%
associate-*r*99.7%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 81.6%
associate-*r*81.7%
*-commutative81.7%
*-commutative81.7%
Simplified81.7%
Taylor expanded in y around inf 76.2%
Final simplification78.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.165) (not (<= z 3350.0))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.165) || !(z <= 3350.0)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
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.165d0)) .or. (.not. (z <= 3350.0d0))) then
tmp = (-6.0d0) * (x * z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.165) || !(z <= 3350.0)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.165) or not (z <= 3350.0): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.165) || !(z <= 3350.0)) tmp = Float64(-6.0 * Float64(x * z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.165) || ~((z <= 3350.0))) tmp = -6.0 * (x * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.165], N[Not[LessEqual[z, 3350.0]], $MachinePrecision]], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.165 \lor \neg \left(z \leq 3350\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.165000000000000008 or 3350 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.6%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 98.1%
associate-*r*98.2%
*-commutative98.2%
*-commutative98.2%
Simplified98.2%
Taylor expanded in y around 0 49.1%
*-commutative49.1%
Simplified49.1%
if -0.165000000000000008 < z < 3350Initial program 98.6%
Taylor expanded in z around 0 67.0%
Final simplification59.1%
(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(y - x) * Float64(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[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \left(6 \cdot z\right)
\end{array}
Initial program 99.1%
associate-*l*99.8%
Simplified99.8%
(FPCore (x y z) :precision binary64 (+ x (* z (* (- y x) 6.0))))
double code(double x, double y, double z) {
return x + (z * ((y - x) * 6.0));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (z * ((y - x) * 6.0d0))
end function
public static double code(double x, double y, double z) {
return x + (z * ((y - x) * 6.0));
}
def code(x, y, z): return x + (z * ((y - x) * 6.0))
function code(x, y, z) return Float64(x + Float64(z * Float64(Float64(y - x) * 6.0))) end
function tmp = code(x, y, z) tmp = x + (z * ((y - x) * 6.0)); end
code[x_, y_, z_] := N[(x + N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + z \cdot \left(\left(y - x\right) \cdot 6\right)
\end{array}
Initial program 99.1%
Final simplification99.1%
(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.1%
Taylor expanded in z around 0 38.7%
(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 2024152
(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)))