
(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.5%
+-commutative99.5%
associate-*l*99.8%
fma-define99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))) (t_1 (* -6.0 (* x z))))
(if (<= z -3.3e+248)
t_0
(if (<= z -1.7e+171)
t_1
(if (<= z -2.5e-52) t_0 (if (<= z 0.17) x t_1))))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double t_1 = -6.0 * (x * z);
double tmp;
if (z <= -3.3e+248) {
tmp = t_0;
} else if (z <= -1.7e+171) {
tmp = t_1;
} else if (z <= -2.5e-52) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else {
tmp = t_1;
}
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 * (y * z)
t_1 = (-6.0d0) * (x * z)
if (z <= (-3.3d+248)) then
tmp = t_0
else if (z <= (-1.7d+171)) then
tmp = t_1
else if (z <= (-2.5d-52)) then
tmp = t_0
else if (z <= 0.17d0) then
tmp = x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double t_1 = -6.0 * (x * z);
double tmp;
if (z <= -3.3e+248) {
tmp = t_0;
} else if (z <= -1.7e+171) {
tmp = t_1;
} else if (z <= -2.5e-52) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) t_1 = -6.0 * (x * z) tmp = 0 if z <= -3.3e+248: tmp = t_0 elif z <= -1.7e+171: tmp = t_1 elif z <= -2.5e-52: tmp = t_0 elif z <= 0.17: tmp = x else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(y * z)) t_1 = Float64(-6.0 * Float64(x * z)) tmp = 0.0 if (z <= -3.3e+248) tmp = t_0; elseif (z <= -1.7e+171) tmp = t_1; elseif (z <= -2.5e-52) tmp = t_0; elseif (z <= 0.17) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * (y * z); t_1 = -6.0 * (x * z); tmp = 0.0; if (z <= -3.3e+248) tmp = t_0; elseif (z <= -1.7e+171) tmp = t_1; elseif (z <= -2.5e-52) tmp = t_0; elseif (z <= 0.17) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.3e+248], t$95$0, If[LessEqual[z, -1.7e+171], t$95$1, If[LessEqual[z, -2.5e-52], t$95$0, If[LessEqual[z, 0.17], x, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot z\right)\\
t_1 := -6 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;z \leq -3.3 \cdot 10^{+248}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.7 \cdot 10^{+171}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.5 \cdot 10^{-52}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.3000000000000001e248 or -1.7000000000000001e171 < z < -2.5e-52Initial program 99.8%
Taylor expanded in z around inf 98.2%
Taylor expanded in y around inf 68.2%
*-commutative68.2%
Simplified68.2%
if -3.3000000000000001e248 < z < -1.7000000000000001e171 or 0.170000000000000012 < z Initial program 99.8%
Taylor expanded in x around inf 57.5%
+-commutative57.5%
Simplified57.5%
Taylor expanded in z around inf 56.2%
Taylor expanded in x around 0 56.3%
if -2.5e-52 < z < 0.170000000000000012Initial program 99.1%
Taylor expanded in z around 0 74.3%
Final simplification67.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))))
(if (<= z -2.9e+248)
t_0
(if (<= z -6.8e+170)
(* -6.0 (* x z))
(if (<= z -2.15e-54) t_0 (if (<= z 0.17) x (* x (* z -6.0))))))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double tmp;
if (z <= -2.9e+248) {
tmp = t_0;
} else if (z <= -6.8e+170) {
tmp = -6.0 * (x * z);
} else if (z <= -2.15e-54) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else {
tmp = x * (z * -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) :: t_0
real(8) :: tmp
t_0 = 6.0d0 * (y * z)
if (z <= (-2.9d+248)) then
tmp = t_0
else if (z <= (-6.8d+170)) then
tmp = (-6.0d0) * (x * z)
else if (z <= (-2.15d-54)) then
tmp = t_0
else if (z <= 0.17d0) then
tmp = x
else
tmp = x * (z * (-6.0d0))
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 <= -2.9e+248) {
tmp = t_0;
} else if (z <= -6.8e+170) {
tmp = -6.0 * (x * z);
} else if (z <= -2.15e-54) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else {
tmp = x * (z * -6.0);
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) tmp = 0 if z <= -2.9e+248: tmp = t_0 elif z <= -6.8e+170: tmp = -6.0 * (x * z) elif z <= -2.15e-54: tmp = t_0 elif z <= 0.17: tmp = x else: tmp = x * (z * -6.0) return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -2.9e+248) tmp = t_0; elseif (z <= -6.8e+170) tmp = Float64(-6.0 * Float64(x * z)); elseif (z <= -2.15e-54) tmp = t_0; elseif (z <= 0.17) tmp = x; else tmp = Float64(x * Float64(z * -6.0)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * (y * z); tmp = 0.0; if (z <= -2.9e+248) tmp = t_0; elseif (z <= -6.8e+170) tmp = -6.0 * (x * z); elseif (z <= -2.15e-54) tmp = t_0; elseif (z <= 0.17) tmp = x; else tmp = x * (z * -6.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, -2.9e+248], t$95$0, If[LessEqual[z, -6.8e+170], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -2.15e-54], t$95$0, If[LessEqual[z, 0.17], x, N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -2.9 \cdot 10^{+248}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -6.8 \cdot 10^{+170}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -2.15 \cdot 10^{-54}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot -6\right)\\
\end{array}
\end{array}
if z < -2.9e248 or -6.8000000000000003e170 < z < -2.15e-54Initial program 99.8%
Taylor expanded in z around inf 98.2%
Taylor expanded in y around inf 68.2%
*-commutative68.2%
Simplified68.2%
if -2.9e248 < z < -6.8000000000000003e170Initial program 100.0%
Taylor expanded in x around inf 68.2%
+-commutative68.2%
Simplified68.2%
Taylor expanded in z around inf 68.2%
Taylor expanded in x around 0 68.3%
if -2.15e-54 < z < 0.170000000000000012Initial program 99.1%
Taylor expanded in z around 0 74.3%
if 0.170000000000000012 < z Initial program 99.7%
Taylor expanded in x around inf 54.1%
+-commutative54.1%
Simplified54.1%
Taylor expanded in z around inf 52.5%
Final simplification67.7%
(FPCore (x y z)
:precision binary64
(if (<= z -8.4e+253)
(* 6.0 (* y z))
(if (<= z -1.15e+169)
(* -6.0 (* x z))
(if (<= z -2.7e-54)
(* y (* 6.0 z))
(if (<= z 0.17) x (* x (* z -6.0)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -8.4e+253) {
tmp = 6.0 * (y * z);
} else if (z <= -1.15e+169) {
tmp = -6.0 * (x * z);
} else if (z <= -2.7e-54) {
tmp = y * (6.0 * z);
} else if (z <= 0.17) {
tmp = x;
} else {
tmp = x * (z * -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 <= (-8.4d+253)) then
tmp = 6.0d0 * (y * z)
else if (z <= (-1.15d+169)) then
tmp = (-6.0d0) * (x * z)
else if (z <= (-2.7d-54)) then
tmp = y * (6.0d0 * z)
else if (z <= 0.17d0) then
tmp = x
else
tmp = x * (z * (-6.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -8.4e+253) {
tmp = 6.0 * (y * z);
} else if (z <= -1.15e+169) {
tmp = -6.0 * (x * z);
} else if (z <= -2.7e-54) {
tmp = y * (6.0 * z);
} else if (z <= 0.17) {
tmp = x;
} else {
tmp = x * (z * -6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -8.4e+253: tmp = 6.0 * (y * z) elif z <= -1.15e+169: tmp = -6.0 * (x * z) elif z <= -2.7e-54: tmp = y * (6.0 * z) elif z <= 0.17: tmp = x else: tmp = x * (z * -6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -8.4e+253) tmp = Float64(6.0 * Float64(y * z)); elseif (z <= -1.15e+169) tmp = Float64(-6.0 * Float64(x * z)); elseif (z <= -2.7e-54) tmp = Float64(y * Float64(6.0 * z)); elseif (z <= 0.17) tmp = x; else tmp = Float64(x * Float64(z * -6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -8.4e+253) tmp = 6.0 * (y * z); elseif (z <= -1.15e+169) tmp = -6.0 * (x * z); elseif (z <= -2.7e-54) tmp = y * (6.0 * z); elseif (z <= 0.17) tmp = x; else tmp = x * (z * -6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -8.4e+253], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.15e+169], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -2.7e-54], N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.17], x, N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.4 \cdot 10^{+253}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq -1.15 \cdot 10^{+169}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -2.7 \cdot 10^{-54}:\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot -6\right)\\
\end{array}
\end{array}
if z < -8.4000000000000005e253Initial program 100.0%
Taylor expanded in z around inf 100.0%
Taylor expanded in y around inf 86.6%
*-commutative86.6%
Simplified86.6%
if -8.4000000000000005e253 < z < -1.15e169Initial program 100.0%
Taylor expanded in x around inf 68.2%
+-commutative68.2%
Simplified68.2%
Taylor expanded in z around inf 68.2%
Taylor expanded in x around 0 68.3%
if -1.15e169 < z < -2.70000000000000026e-54Initial program 99.7%
Taylor expanded in y around inf 69.4%
*-commutative69.4%
Simplified69.4%
Taylor expanded in y around inf 72.1%
Taylor expanded in z around inf 61.4%
if -2.70000000000000026e-54 < z < 0.170000000000000012Initial program 99.1%
Taylor expanded in z around 0 74.3%
if 0.170000000000000012 < z Initial program 99.7%
Taylor expanded in x around inf 54.1%
+-commutative54.1%
Simplified54.1%
Taylor expanded in z around inf 52.5%
Final simplification67.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (* y 6.0))))
(if (<= z -1.12e+255)
t_0
(if (<= z -1.24e+172)
(* -6.0 (* x z))
(if (<= z -2.85e-52) t_0 (if (<= z 0.17) x (* x (* z -6.0))))))))
double code(double x, double y, double z) {
double t_0 = z * (y * 6.0);
double tmp;
if (z <= -1.12e+255) {
tmp = t_0;
} else if (z <= -1.24e+172) {
tmp = -6.0 * (x * z);
} else if (z <= -2.85e-52) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else {
tmp = x * (z * -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) :: t_0
real(8) :: tmp
t_0 = z * (y * 6.0d0)
if (z <= (-1.12d+255)) then
tmp = t_0
else if (z <= (-1.24d+172)) then
tmp = (-6.0d0) * (x * z)
else if (z <= (-2.85d-52)) then
tmp = t_0
else if (z <= 0.17d0) then
tmp = x
else
tmp = x * (z * (-6.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * (y * 6.0);
double tmp;
if (z <= -1.12e+255) {
tmp = t_0;
} else if (z <= -1.24e+172) {
tmp = -6.0 * (x * z);
} else if (z <= -2.85e-52) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else {
tmp = x * (z * -6.0);
}
return tmp;
}
def code(x, y, z): t_0 = z * (y * 6.0) tmp = 0 if z <= -1.12e+255: tmp = t_0 elif z <= -1.24e+172: tmp = -6.0 * (x * z) elif z <= -2.85e-52: tmp = t_0 elif z <= 0.17: tmp = x else: tmp = x * (z * -6.0) return tmp
function code(x, y, z) t_0 = Float64(z * Float64(y * 6.0)) tmp = 0.0 if (z <= -1.12e+255) tmp = t_0; elseif (z <= -1.24e+172) tmp = Float64(-6.0 * Float64(x * z)); elseif (z <= -2.85e-52) tmp = t_0; elseif (z <= 0.17) tmp = x; else tmp = Float64(x * Float64(z * -6.0)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (y * 6.0); tmp = 0.0; if (z <= -1.12e+255) tmp = t_0; elseif (z <= -1.24e+172) tmp = -6.0 * (x * z); elseif (z <= -2.85e-52) tmp = t_0; elseif (z <= 0.17) tmp = x; else tmp = x * (z * -6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.12e+255], t$95$0, If[LessEqual[z, -1.24e+172], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -2.85e-52], t$95$0, If[LessEqual[z, 0.17], x, N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(y \cdot 6\right)\\
\mathbf{if}\;z \leq -1.12 \cdot 10^{+255}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.24 \cdot 10^{+172}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -2.85 \cdot 10^{-52}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot -6\right)\\
\end{array}
\end{array}
if z < -1.11999999999999993e255 or -1.24e172 < z < -2.8499999999999999e-52Initial program 99.8%
Taylor expanded in z around inf 98.2%
Taylor expanded in y around inf 68.2%
associate-*r*68.3%
*-commutative68.3%
Simplified68.3%
if -1.11999999999999993e255 < z < -1.24e172Initial program 100.0%
Taylor expanded in x around inf 68.2%
+-commutative68.2%
Simplified68.2%
Taylor expanded in z around inf 68.2%
Taylor expanded in x around 0 68.3%
if -2.8499999999999999e-52 < z < 0.170000000000000012Initial program 99.1%
Taylor expanded in z around 0 74.3%
if 0.170000000000000012 < z Initial program 99.7%
Taylor expanded in x around inf 54.1%
+-commutative54.1%
Simplified54.1%
Taylor expanded in z around inf 52.5%
Final simplification67.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.9e-53) (not (<= z 2.3e-23))) (* -6.0 (* z (- x y))) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.9e-53) || !(z <= 2.3e-23)) {
tmp = -6.0 * (z * (x - y));
} 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 <= (-3.9d-53)) .or. (.not. (z <= 2.3d-23))) then
tmp = (-6.0d0) * (z * (x - y))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -3.9e-53) || !(z <= 2.3e-23)) {
tmp = -6.0 * (z * (x - y));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.9e-53) or not (z <= 2.3e-23): tmp = -6.0 * (z * (x - y)) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.9e-53) || !(z <= 2.3e-23)) tmp = Float64(-6.0 * Float64(z * Float64(x - y))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -3.9e-53) || ~((z <= 2.3e-23))) tmp = -6.0 * (z * (x - y)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.9e-53], N[Not[LessEqual[z, 2.3e-23]], $MachinePrecision]], N[(-6.0 * N[(z * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.9 \cdot 10^{-53} \lor \neg \left(z \leq 2.3 \cdot 10^{-23}\right):\\
\;\;\;\;-6 \cdot \left(z \cdot \left(x - y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.9000000000000002e-53 or 2.3000000000000001e-23 < z Initial program 99.8%
+-commutative99.8%
*-commutative99.8%
fma-define99.8%
remove-double-neg99.8%
distribute-lft-neg-in99.8%
distribute-rgt-neg-in99.8%
sub-neg99.8%
distribute-neg-in99.8%
remove-double-neg99.8%
+-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around inf 93.7%
if -3.9000000000000002e-53 < z < 2.3000000000000001e-23Initial program 99.1%
Taylor expanded in z around 0 75.6%
Final simplification85.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.7e-52) (not (<= z 3.55))) (* -6.0 (* z (- x y))) (* x (+ (* z -6.0) 1.0))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.7e-52) || !(z <= 3.55)) {
tmp = -6.0 * (z * (x - y));
} 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.7d-52)) .or. (.not. (z <= 3.55d0))) then
tmp = (-6.0d0) * (z * (x - y))
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.7e-52) || !(z <= 3.55)) {
tmp = -6.0 * (z * (x - y));
} else {
tmp = x * ((z * -6.0) + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.7e-52) or not (z <= 3.55): tmp = -6.0 * (z * (x - y)) else: tmp = x * ((z * -6.0) + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.7e-52) || !(z <= 3.55)) tmp = Float64(-6.0 * Float64(z * Float64(x - y))); 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.7e-52) || ~((z <= 3.55))) tmp = -6.0 * (z * (x - y)); else tmp = x * ((z * -6.0) + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.7e-52], N[Not[LessEqual[z, 3.55]], $MachinePrecision]], N[(-6.0 * N[(z * N[(x - y), $MachinePrecision]), $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.7 \cdot 10^{-52} \lor \neg \left(z \leq 3.55\right):\\
\;\;\;\;-6 \cdot \left(z \cdot \left(x - y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\
\end{array}
\end{array}
if z < -2.70000000000000009e-52 or 3.5499999999999998 < z Initial program 99.8%
+-commutative99.8%
*-commutative99.8%
fma-define99.8%
remove-double-neg99.8%
distribute-lft-neg-in99.8%
distribute-rgt-neg-in99.8%
sub-neg99.8%
distribute-neg-in99.8%
remove-double-neg99.8%
+-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around inf 96.2%
if -2.70000000000000009e-52 < z < 3.5499999999999998Initial program 99.1%
Taylor expanded in x around inf 74.8%
+-commutative74.8%
Simplified74.8%
Final simplification85.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -7.2e-55) (not (<= z 4200.0))) (* z (* (- y x) 6.0)) (* x (+ (* z -6.0) 1.0))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -7.2e-55) || !(z <= 4200.0)) {
tmp = z * ((y - x) * 6.0);
} 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 <= (-7.2d-55)) .or. (.not. (z <= 4200.0d0))) then
tmp = z * ((y - x) * 6.0d0)
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 <= -7.2e-55) || !(z <= 4200.0)) {
tmp = z * ((y - x) * 6.0);
} else {
tmp = x * ((z * -6.0) + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -7.2e-55) or not (z <= 4200.0): tmp = z * ((y - x) * 6.0) else: tmp = x * ((z * -6.0) + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -7.2e-55) || !(z <= 4200.0)) tmp = Float64(z * Float64(Float64(y - x) * 6.0)); 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 <= -7.2e-55) || ~((z <= 4200.0))) tmp = z * ((y - x) * 6.0); else tmp = x * ((z * -6.0) + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -7.2e-55], N[Not[LessEqual[z, 4200.0]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(z * -6.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{-55} \lor \neg \left(z \leq 4200\right):\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\
\end{array}
\end{array}
if z < -7.2000000000000001e-55 or 4200 < z Initial program 99.8%
Taylor expanded in z around inf 99.1%
Taylor expanded in z around inf 96.2%
associate-*r*96.3%
*-commutative96.3%
associate-*r*96.3%
Simplified96.3%
if -7.2000000000000001e-55 < z < 4200Initial program 99.1%
Taylor expanded in x around inf 74.8%
+-commutative74.8%
Simplified74.8%
Final simplification85.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -14000000000.0) (not (<= z 0.17))) (* z (* (- y x) 6.0)) (+ x (* 6.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -14000000000.0) || !(z <= 0.17)) {
tmp = z * ((y - x) * 6.0);
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-14000000000.0d0)) .or. (.not. (z <= 0.17d0))) then
tmp = z * ((y - x) * 6.0d0)
else
tmp = x + (6.0d0 * (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -14000000000.0) || !(z <= 0.17)) {
tmp = z * ((y - x) * 6.0);
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -14000000000.0) or not (z <= 0.17): tmp = z * ((y - x) * 6.0) else: tmp = x + (6.0 * (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -14000000000.0) || !(z <= 0.17)) tmp = Float64(z * Float64(Float64(y - x) * 6.0)); 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 <= -14000000000.0) || ~((z <= 0.17))) tmp = z * ((y - x) * 6.0); else tmp = x + (6.0 * (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -14000000000.0], N[Not[LessEqual[z, 0.17]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -14000000000 \lor \neg \left(z \leq 0.17\right):\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if z < -1.4e10 or 0.170000000000000012 < z Initial program 99.8%
Taylor expanded in z around inf 99.8%
Taylor expanded in z around inf 98.2%
associate-*r*98.3%
*-commutative98.3%
associate-*r*98.3%
Simplified98.3%
if -1.4e10 < z < 0.170000000000000012Initial program 99.2%
Taylor expanded in y around inf 97.8%
*-commutative97.8%
Simplified97.8%
Final simplification98.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.17) (not (<= z 0.17))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.17) || !(z <= 0.17)) {
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.17d0)) .or. (.not. (z <= 0.17d0))) 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.17) || !(z <= 0.17)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.17) or not (z <= 0.17): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.17) || !(z <= 0.17)) 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.17) || ~((z <= 0.17))) tmp = -6.0 * (x * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.17], N[Not[LessEqual[z, 0.17]], $MachinePrecision]], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.17 \lor \neg \left(z \leq 0.17\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.170000000000000012 or 0.170000000000000012 < z Initial program 99.8%
Taylor expanded in x around inf 50.6%
+-commutative50.6%
Simplified50.6%
Taylor expanded in z around inf 49.6%
Taylor expanded in x around 0 49.6%
if -0.170000000000000012 < z < 0.170000000000000012Initial program 99.2%
Taylor expanded in z around 0 70.6%
Final simplification60.9%
(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.5%
Final simplification99.5%
(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.5%
associate-*l*99.8%
Simplified99.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.5%
Taylor expanded in z around 0 39.2%
Final simplification39.2%
(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 2024081
(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)))