
(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 (+ 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.4%
associate-*l*99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* x z))) (t_1 (* 6.0 (* y z))))
(if (<= z -1.35e+256)
t_0
(if (<= z -3.1e-22)
t_1
(if (<= z 1.15e-5) x (if (<= z 6.4e+146) t_1 t_0))))))
double code(double x, double y, double z) {
double t_0 = -6.0 * (x * z);
double t_1 = 6.0 * (y * z);
double tmp;
if (z <= -1.35e+256) {
tmp = t_0;
} else if (z <= -3.1e-22) {
tmp = t_1;
} else if (z <= 1.15e-5) {
tmp = x;
} else if (z <= 6.4e+146) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_0 = (-6.0d0) * (x * z)
t_1 = 6.0d0 * (y * z)
if (z <= (-1.35d+256)) then
tmp = t_0
else if (z <= (-3.1d-22)) then
tmp = t_1
else if (z <= 1.15d-5) then
tmp = x
else if (z <= 6.4d+146) then
tmp = t_1
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 * (x * z);
double t_1 = 6.0 * (y * z);
double tmp;
if (z <= -1.35e+256) {
tmp = t_0;
} else if (z <= -3.1e-22) {
tmp = t_1;
} else if (z <= 1.15e-5) {
tmp = x;
} else if (z <= 6.4e+146) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * (x * z) t_1 = 6.0 * (y * z) tmp = 0 if z <= -1.35e+256: tmp = t_0 elif z <= -3.1e-22: tmp = t_1 elif z <= 1.15e-5: tmp = x elif z <= 6.4e+146: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-6.0 * Float64(x * z)) t_1 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -1.35e+256) tmp = t_0; elseif (z <= -3.1e-22) tmp = t_1; elseif (z <= 1.15e-5) tmp = x; elseif (z <= 6.4e+146) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -6.0 * (x * z); t_1 = 6.0 * (y * z); tmp = 0.0; if (z <= -1.35e+256) tmp = t_0; elseif (z <= -3.1e-22) tmp = t_1; elseif (z <= 1.15e-5) tmp = x; elseif (z <= 6.4e+146) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.35e+256], t$95$0, If[LessEqual[z, -3.1e-22], t$95$1, If[LessEqual[z, 1.15e-5], x, If[LessEqual[z, 6.4e+146], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -6 \cdot \left(x \cdot z\right)\\
t_1 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -1.35 \cdot 10^{+256}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -3.1 \cdot 10^{-22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{-5}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 6.4 \cdot 10^{+146}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.34999999999999997e256 or 6.3999999999999999e146 < z Initial program 99.8%
Taylor expanded in x around inf 72.7%
+-commutative72.7%
Simplified72.7%
Taylor expanded in z around inf 72.6%
if -1.34999999999999997e256 < z < -3.10000000000000013e-22 or 1.15e-5 < z < 6.3999999999999999e146Initial program 99.7%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
add-sqr-sqrt57.1%
associate-*r*57.1%
fma-define57.1%
Applied egg-rr57.1%
Taylor expanded in z around inf 96.9%
Taylor expanded in y around inf 58.7%
*-commutative58.7%
Simplified58.7%
if -3.10000000000000013e-22 < z < 1.15e-5Initial program 99.1%
Taylor expanded in z around 0 80.4%
Final simplification71.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (* z -6.0))) (t_1 (* 6.0 (* y z))))
(if (<= z -4.3e+246)
t_0
(if (<= z -2.8e-21)
t_1
(if (<= z 5.6e-6) x (if (<= z 1e+146) t_1 t_0))))))
double code(double x, double y, double z) {
double t_0 = x * (z * -6.0);
double t_1 = 6.0 * (y * z);
double tmp;
if (z <= -4.3e+246) {
tmp = t_0;
} else if (z <= -2.8e-21) {
tmp = t_1;
} else if (z <= 5.6e-6) {
tmp = x;
} else if (z <= 1e+146) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_0 = x * (z * (-6.0d0))
t_1 = 6.0d0 * (y * z)
if (z <= (-4.3d+246)) then
tmp = t_0
else if (z <= (-2.8d-21)) then
tmp = t_1
else if (z <= 5.6d-6) then
tmp = x
else if (z <= 1d+146) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (z * -6.0);
double t_1 = 6.0 * (y * z);
double tmp;
if (z <= -4.3e+246) {
tmp = t_0;
} else if (z <= -2.8e-21) {
tmp = t_1;
} else if (z <= 5.6e-6) {
tmp = x;
} else if (z <= 1e+146) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * (z * -6.0) t_1 = 6.0 * (y * z) tmp = 0 if z <= -4.3e+246: tmp = t_0 elif z <= -2.8e-21: tmp = t_1 elif z <= 5.6e-6: tmp = x elif z <= 1e+146: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(z * -6.0)) t_1 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -4.3e+246) tmp = t_0; elseif (z <= -2.8e-21) tmp = t_1; elseif (z <= 5.6e-6) tmp = x; elseif (z <= 1e+146) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (z * -6.0); t_1 = 6.0 * (y * z); tmp = 0.0; if (z <= -4.3e+246) tmp = t_0; elseif (z <= -2.8e-21) tmp = t_1; elseif (z <= 5.6e-6) tmp = x; elseif (z <= 1e+146) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.3e+246], t$95$0, If[LessEqual[z, -2.8e-21], t$95$1, If[LessEqual[z, 5.6e-6], x, If[LessEqual[z, 1e+146], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(z \cdot -6\right)\\
t_1 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -4.3 \cdot 10^{+246}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -2.8 \cdot 10^{-21}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{-6}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 10^{+146}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -4.30000000000000028e246 or 9.99999999999999934e145 < z Initial program 99.8%
Taylor expanded in x around inf 71.8%
+-commutative71.8%
Simplified71.8%
Taylor expanded in z around inf 71.7%
associate-*r*71.7%
*-commutative71.7%
associate-*r*71.8%
Simplified71.8%
if -4.30000000000000028e246 < z < -2.80000000000000004e-21 or 5.59999999999999975e-6 < z < 9.99999999999999934e145Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
add-sqr-sqrt58.3%
associate-*r*58.3%
fma-define58.3%
Applied egg-rr58.3%
Taylor expanded in z around inf 96.8%
Taylor expanded in y around inf 58.9%
*-commutative58.9%
Simplified58.9%
if -2.80000000000000004e-21 < z < 5.59999999999999975e-6Initial program 99.1%
Taylor expanded in z around 0 80.4%
Final simplification71.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.9e-36) (not (<= z 5.5e-6))) (* 6.0 (* (- y x) z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4.9e-36) || !(z <= 5.5e-6)) {
tmp = 6.0 * ((y - 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 <= (-4.9d-36)) .or. (.not. (z <= 5.5d-6))) then
tmp = 6.0d0 * ((y - 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 <= -4.9e-36) || !(z <= 5.5e-6)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4.9e-36) or not (z <= 5.5e-6): tmp = 6.0 * ((y - x) * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4.9e-36) || !(z <= 5.5e-6)) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -4.9e-36) || ~((z <= 5.5e-6))) tmp = 6.0 * ((y - x) * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4.9e-36], N[Not[LessEqual[z, 5.5e-6]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.9 \cdot 10^{-36} \lor \neg \left(z \leq 5.5 \cdot 10^{-6}\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.8999999999999997e-36 or 5.4999999999999999e-6 < z Initial program 99.7%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
add-sqr-sqrt52.5%
associate-*r*52.5%
fma-define52.5%
Applied egg-rr52.5%
Taylor expanded in z around inf 97.2%
if -4.8999999999999997e-36 < z < 5.4999999999999999e-6Initial program 99.1%
Taylor expanded in z around 0 80.9%
Final simplification89.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.04e-35) (not (<= z 0.00075))) (* 6.0 (* (- y x) z)) (* x (+ (* z -6.0) 1.0))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.04e-35) || !(z <= 0.00075)) {
tmp = 6.0 * ((y - x) * 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 <= (-1.04d-35)) .or. (.not. (z <= 0.00075d0))) then
tmp = 6.0d0 * ((y - x) * 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 <= -1.04e-35) || !(z <= 0.00075)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x * ((z * -6.0) + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.04e-35) or not (z <= 0.00075): tmp = 6.0 * ((y - x) * z) else: tmp = x * ((z * -6.0) + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.04e-35) || !(z <= 0.00075)) tmp = Float64(6.0 * Float64(Float64(y - x) * 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 <= -1.04e-35) || ~((z <= 0.00075))) tmp = 6.0 * ((y - x) * z); else tmp = x * ((z * -6.0) + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.04e-35], N[Not[LessEqual[z, 0.00075]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * 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 -1.04 \cdot 10^{-35} \lor \neg \left(z \leq 0.00075\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\
\end{array}
\end{array}
if z < -1.04e-35 or 7.5000000000000002e-4 < z Initial program 99.7%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
add-sqr-sqrt53.3%
associate-*r*53.3%
fma-define53.3%
Applied egg-rr53.3%
Taylor expanded in z around inf 97.8%
if -1.04e-35 < z < 7.5000000000000002e-4Initial program 99.1%
Taylor expanded in x around inf 81.2%
+-commutative81.2%
Simplified81.2%
Final simplification90.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.05e-36) (not (<= z 0.001))) (* 6.0 (* (- y x) z)) (+ x (* -6.0 (* x z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.05e-36) || !(z <= 0.001)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x + (-6.0 * (x * z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-1.05d-36)) .or. (.not. (z <= 0.001d0))) then
tmp = 6.0d0 * ((y - x) * z)
else
tmp = x + ((-6.0d0) * (x * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.05e-36) || !(z <= 0.001)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x + (-6.0 * (x * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.05e-36) or not (z <= 0.001): tmp = 6.0 * ((y - x) * z) else: tmp = x + (-6.0 * (x * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.05e-36) || !(z <= 0.001)) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); else tmp = Float64(x + Float64(-6.0 * Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.05e-36) || ~((z <= 0.001))) tmp = 6.0 * ((y - x) * z); else tmp = x + (-6.0 * (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.05e-36], N[Not[LessEqual[z, 0.001]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{-36} \lor \neg \left(z \leq 0.001\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if z < -1.04999999999999995e-36 or 1e-3 < z Initial program 99.7%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
add-sqr-sqrt53.3%
associate-*r*53.3%
fma-define53.3%
Applied egg-rr53.3%
Taylor expanded in z around inf 97.8%
if -1.04999999999999995e-36 < z < 1e-3Initial program 99.1%
Taylor expanded in y around 0 81.3%
Final simplification90.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -5.5) (not (<= z 0.00115))) (* 6.0 (* (- y x) z)) (+ x (* 6.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.5) || !(z <= 0.00115)) {
tmp = 6.0 * ((y - x) * 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 <= (-5.5d0)) .or. (.not. (z <= 0.00115d0))) then
tmp = 6.0d0 * ((y - x) * 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 <= -5.5) || !(z <= 0.00115)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5.5) or not (z <= 0.00115): tmp = 6.0 * ((y - x) * z) else: tmp = x + (6.0 * (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5.5) || !(z <= 0.00115)) tmp = Float64(6.0 * Float64(Float64(y - x) * 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 <= -5.5) || ~((z <= 0.00115))) tmp = 6.0 * ((y - x) * z); else tmp = x + (6.0 * (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.5], N[Not[LessEqual[z, 0.00115]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \lor \neg \left(z \leq 0.00115\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if z < -5.5 or 0.00115 < z Initial program 99.7%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
add-sqr-sqrt53.1%
associate-*r*53.1%
fma-define53.1%
Applied egg-rr53.1%
Taylor expanded in z around inf 98.4%
if -5.5 < z < 0.00115Initial program 99.1%
Taylor expanded in y around inf 98.6%
*-commutative98.6%
Simplified98.6%
Final simplification98.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -5.5) (not (<= z 0.00115))) (* 6.0 (* (- y x) z)) (+ x (* y (* 6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.5) || !(z <= 0.00115)) {
tmp = 6.0 * ((y - x) * 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 <= (-5.5d0)) .or. (.not. (z <= 0.00115d0))) then
tmp = 6.0d0 * ((y - x) * 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 <= -5.5) || !(z <= 0.00115)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x + (y * (6.0 * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5.5) or not (z <= 0.00115): tmp = 6.0 * ((y - x) * z) else: tmp = x + (y * (6.0 * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5.5) || !(z <= 0.00115)) tmp = Float64(6.0 * Float64(Float64(y - x) * 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 <= -5.5) || ~((z <= 0.00115))) tmp = 6.0 * ((y - x) * z); else tmp = x + (y * (6.0 * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.5], N[Not[LessEqual[z, 0.00115]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \lor \neg \left(z \leq 0.00115\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if z < -5.5 or 0.00115 < z Initial program 99.7%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
add-sqr-sqrt53.1%
associate-*r*53.1%
fma-define53.1%
Applied egg-rr53.1%
Taylor expanded in z around inf 98.4%
if -5.5 < z < 0.00115Initial program 99.1%
Taylor expanded in y around inf 98.6%
*-commutative98.6%
associate-*r*98.6%
Simplified98.6%
Final simplification98.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.165) (not (<= z 0.00115))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.165) || !(z <= 0.00115)) {
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 <= 0.00115d0))) 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 <= 0.00115)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.165) or not (z <= 0.00115): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.165) || !(z <= 0.00115)) 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 <= 0.00115))) 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, 0.00115]], $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 0.00115\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.165000000000000008 or 0.00115 < z Initial program 99.7%
Taylor expanded in x around inf 53.9%
+-commutative53.9%
Simplified53.9%
Taylor expanded in z around inf 52.6%
if -0.165000000000000008 < z < 0.00115Initial program 99.1%
Taylor expanded in z around 0 78.8%
Final simplification65.0%
(FPCore (x y z) :precision binary64 (+ x (* 6.0 (* (- y x) z))))
double code(double x, double y, double z) {
return x + (6.0 * ((y - x) * z));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (6.0d0 * ((y - x) * z))
end function
public static double code(double x, double y, double z) {
return x + (6.0 * ((y - x) * z));
}
def code(x, y, z): return x + (6.0 * ((y - x) * z))
function code(x, y, z) return Float64(x + Float64(6.0 * Float64(Float64(y - x) * z))) end
function tmp = code(x, y, z) tmp = x + (6.0 * ((y - x) * z)); end
code[x_, y_, z_] := N[(x + N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + 6 \cdot \left(\left(y - x\right) \cdot z\right)
\end{array}
Initial program 99.4%
Taylor expanded in z around 0 99.8%
Final simplification99.8%
(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.4%
Taylor expanded in z around 0 38.8%
Final simplification38.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 2024076
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
:precision binary64
:alt
(- x (* (* 6.0 z) (- x y)))
(+ x (* (* (- y x) 6.0) z)))