
(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 12 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(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}
Initial program 99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))))
(if (<= z -3.9e+200)
t_0
(if (<= z -23.5)
(* -6.0 (* x z))
(if (<= z -1.1e-88) t_0 (if (<= z 0.17) x (* z (* x -6.0))))))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double tmp;
if (z <= -3.9e+200) {
tmp = t_0;
} else if (z <= -23.5) {
tmp = -6.0 * (x * z);
} else if (z <= -1.1e-88) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else {
tmp = z * (x * -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 <= (-3.9d+200)) then
tmp = t_0
else if (z <= (-23.5d0)) then
tmp = (-6.0d0) * (x * z)
else if (z <= (-1.1d-88)) then
tmp = t_0
else if (z <= 0.17d0) then
tmp = x
else
tmp = z * (x * (-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 <= -3.9e+200) {
tmp = t_0;
} else if (z <= -23.5) {
tmp = -6.0 * (x * z);
} else if (z <= -1.1e-88) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else {
tmp = z * (x * -6.0);
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) tmp = 0 if z <= -3.9e+200: tmp = t_0 elif z <= -23.5: tmp = -6.0 * (x * z) elif z <= -1.1e-88: tmp = t_0 elif z <= 0.17: tmp = x else: tmp = z * (x * -6.0) return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -3.9e+200) tmp = t_0; elseif (z <= -23.5) tmp = Float64(-6.0 * Float64(x * z)); elseif (z <= -1.1e-88) tmp = t_0; elseif (z <= 0.17) tmp = x; else tmp = Float64(z * Float64(x * -6.0)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * (y * z); tmp = 0.0; if (z <= -3.9e+200) tmp = t_0; elseif (z <= -23.5) tmp = -6.0 * (x * z); elseif (z <= -1.1e-88) tmp = t_0; elseif (z <= 0.17) tmp = x; else tmp = z * (x * -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, -3.9e+200], t$95$0, If[LessEqual[z, -23.5], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.1e-88], t$95$0, If[LessEqual[z, 0.17], x, N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -3.9 \cdot 10^{+200}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -23.5:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -1.1 \cdot 10^{-88}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(x \cdot -6\right)\\
\end{array}
\end{array}
if z < -3.90000000000000019e200 or -23.5 < z < -1.10000000000000002e-88Initial program 99.8%
Taylor expanded in y around inf 82.7%
*-commutative82.7%
Simplified82.7%
+-commutative82.7%
*-commutative82.7%
fma-define82.8%
Applied egg-rr82.8%
Taylor expanded in z around inf 66.2%
if -3.90000000000000019e200 < z < -23.5Initial program 99.8%
Taylor expanded in y around 0 67.1%
Taylor expanded in z around inf 65.0%
if -1.10000000000000002e-88 < z < 0.170000000000000012Initial program 99.9%
Taylor expanded in z around 0 76.0%
if 0.170000000000000012 < z Initial program 99.7%
Taylor expanded in y around 0 59.9%
Taylor expanded in z around inf 59.3%
*-commutative59.3%
*-commutative59.3%
associate-*r*59.4%
Simplified59.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))))
(if (<= z -5.2e+199)
t_0
(if (<= z -23.5)
(* -6.0 (* x z))
(if (<= z -9e-89) 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 <= -5.2e+199) {
tmp = t_0;
} else if (z <= -23.5) {
tmp = -6.0 * (x * z);
} else if (z <= -9e-89) {
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 <= (-5.2d+199)) then
tmp = t_0
else if (z <= (-23.5d0)) then
tmp = (-6.0d0) * (x * z)
else if (z <= (-9d-89)) 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 <= -5.2e+199) {
tmp = t_0;
} else if (z <= -23.5) {
tmp = -6.0 * (x * z);
} else if (z <= -9e-89) {
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 <= -5.2e+199: tmp = t_0 elif z <= -23.5: tmp = -6.0 * (x * z) elif z <= -9e-89: 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 <= -5.2e+199) tmp = t_0; elseif (z <= -23.5) tmp = Float64(-6.0 * Float64(x * z)); elseif (z <= -9e-89) 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 <= -5.2e+199) tmp = t_0; elseif (z <= -23.5) tmp = -6.0 * (x * z); elseif (z <= -9e-89) 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, -5.2e+199], t$95$0, If[LessEqual[z, -23.5], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -9e-89], 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 -5.2 \cdot 10^{+199}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -23.5:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -9 \cdot 10^{-89}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot -6\right)\\
\end{array}
\end{array}
if z < -5.2000000000000003e199 or -23.5 < z < -8.9999999999999998e-89Initial program 99.8%
Taylor expanded in y around inf 82.7%
*-commutative82.7%
Simplified82.7%
+-commutative82.7%
*-commutative82.7%
fma-define82.8%
Applied egg-rr82.8%
Taylor expanded in z around inf 66.2%
if -5.2000000000000003e199 < z < -23.5Initial program 99.8%
Taylor expanded in y around 0 67.1%
Taylor expanded in z around inf 65.0%
if -8.9999999999999998e-89 < z < 0.170000000000000012Initial program 99.9%
Taylor expanded in z around 0 76.0%
if 0.170000000000000012 < z Initial program 99.7%
Taylor expanded in y around 0 59.9%
Taylor expanded in z around inf 59.3%
*-commutative59.3%
*-commutative59.3%
*-commutative59.3%
associate-*r*59.4%
Simplified59.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))) (t_1 (* -6.0 (* x z))))
(if (<= z -1.5e+202)
t_0
(if (<= z -23.5) t_1 (if (<= z -1.1e-88) 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 <= -1.5e+202) {
tmp = t_0;
} else if (z <= -23.5) {
tmp = t_1;
} else if (z <= -1.1e-88) {
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 <= (-1.5d+202)) then
tmp = t_0
else if (z <= (-23.5d0)) then
tmp = t_1
else if (z <= (-1.1d-88)) 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 <= -1.5e+202) {
tmp = t_0;
} else if (z <= -23.5) {
tmp = t_1;
} else if (z <= -1.1e-88) {
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 <= -1.5e+202: tmp = t_0 elif z <= -23.5: tmp = t_1 elif z <= -1.1e-88: 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 <= -1.5e+202) tmp = t_0; elseif (z <= -23.5) tmp = t_1; elseif (z <= -1.1e-88) 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 <= -1.5e+202) tmp = t_0; elseif (z <= -23.5) tmp = t_1; elseif (z <= -1.1e-88) 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, -1.5e+202], t$95$0, If[LessEqual[z, -23.5], t$95$1, If[LessEqual[z, -1.1e-88], 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 -1.5 \cdot 10^{+202}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -23.5:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.1 \cdot 10^{-88}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.5000000000000001e202 or -23.5 < z < -1.10000000000000002e-88Initial program 99.8%
Taylor expanded in y around inf 82.7%
*-commutative82.7%
Simplified82.7%
+-commutative82.7%
*-commutative82.7%
fma-define82.8%
Applied egg-rr82.8%
Taylor expanded in z around inf 66.2%
if -1.5000000000000001e202 < z < -23.5 or 0.170000000000000012 < z Initial program 99.8%
Taylor expanded in y around 0 63.2%
Taylor expanded in z around inf 61.9%
if -1.10000000000000002e-88 < z < 0.170000000000000012Initial program 99.9%
Taylor expanded in z around 0 76.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -4.2e-68) (not (<= x 0.00017))) (+ x (* x (* z -6.0))) (+ x (* 6.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -4.2e-68) || !(x <= 0.00017)) {
tmp = x + (x * (z * -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 ((x <= (-4.2d-68)) .or. (.not. (x <= 0.00017d0))) then
tmp = x + (x * (z * (-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 ((x <= -4.2e-68) || !(x <= 0.00017)) {
tmp = x + (x * (z * -6.0));
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -4.2e-68) or not (x <= 0.00017): tmp = x + (x * (z * -6.0)) else: tmp = x + (6.0 * (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -4.2e-68) || !(x <= 0.00017)) tmp = Float64(x + Float64(x * Float64(z * -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 ((x <= -4.2e-68) || ~((x <= 0.00017))) tmp = x + (x * (z * -6.0)); else tmp = x + (6.0 * (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -4.2e-68], N[Not[LessEqual[x, 0.00017]], $MachinePrecision]], N[(x + N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{-68} \lor \neg \left(x \leq 0.00017\right):\\
\;\;\;\;x + x \cdot \left(z \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if x < -4.20000000000000016e-68 or 1.7e-4 < x Initial program 99.8%
Taylor expanded in y around 0 89.0%
*-commutative89.0%
associate-*r*89.1%
*-commutative89.1%
Simplified89.1%
if -4.20000000000000016e-68 < x < 1.7e-4Initial program 99.8%
Taylor expanded in y around inf 90.8%
*-commutative90.8%
Simplified90.8%
Final simplification89.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -4.8e-68) (not (<= x 1.2e-5))) (+ x (* -6.0 (* x z))) (+ x (* 6.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -4.8e-68) || !(x <= 1.2e-5)) {
tmp = x + (-6.0 * (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 ((x <= (-4.8d-68)) .or. (.not. (x <= 1.2d-5))) then
tmp = x + ((-6.0d0) * (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 ((x <= -4.8e-68) || !(x <= 1.2e-5)) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -4.8e-68) or not (x <= 1.2e-5): tmp = x + (-6.0 * (x * z)) else: tmp = x + (6.0 * (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -4.8e-68) || !(x <= 1.2e-5)) tmp = Float64(x + Float64(-6.0 * Float64(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 ((x <= -4.8e-68) || ~((x <= 1.2e-5))) tmp = x + (-6.0 * (x * z)); else tmp = x + (6.0 * (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -4.8e-68], N[Not[LessEqual[x, 1.2e-5]], $MachinePrecision]], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{-68} \lor \neg \left(x \leq 1.2 \cdot 10^{-5}\right):\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if x < -4.79999999999999982e-68 or 1.2e-5 < x Initial program 99.8%
Taylor expanded in y around 0 89.0%
if -4.79999999999999982e-68 < x < 1.2e-5Initial program 99.8%
Taylor expanded in y around inf 90.8%
*-commutative90.8%
Simplified90.8%
Final simplification89.7%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.76e-68) (not (<= x 1.8e-32))) (+ x (* -6.0 (* x z))) (* z (* y 6.0))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.76e-68) || !(x <= 1.8e-32)) {
tmp = x + (-6.0 * (x * z));
} 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 ((x <= (-1.76d-68)) .or. (.not. (x <= 1.8d-32))) then
tmp = x + ((-6.0d0) * (x * z))
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 ((x <= -1.76e-68) || !(x <= 1.8e-32)) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = z * (y * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.76e-68) or not (x <= 1.8e-32): tmp = x + (-6.0 * (x * z)) else: tmp = z * (y * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.76e-68) || !(x <= 1.8e-32)) tmp = Float64(x + Float64(-6.0 * Float64(x * z))); else tmp = Float64(z * Float64(y * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.76e-68) || ~((x <= 1.8e-32))) tmp = x + (-6.0 * (x * z)); else tmp = z * (y * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.76e-68], N[Not[LessEqual[x, 1.8e-32]], $MachinePrecision]], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.76 \cdot 10^{-68} \lor \neg \left(x \leq 1.8 \cdot 10^{-32}\right):\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\end{array}
\end{array}
if x < -1.76e-68 or 1.79999999999999996e-32 < x Initial program 99.8%
Taylor expanded in y around 0 88.7%
if -1.76e-68 < x < 1.79999999999999996e-32Initial program 99.8%
Taylor expanded in y around inf 91.4%
*-commutative91.4%
Simplified91.4%
+-commutative91.4%
*-commutative91.4%
fma-define91.4%
Applied egg-rr91.4%
Taylor expanded in z around inf 72.7%
*-commutative72.7%
*-commutative72.7%
associate-*r*72.7%
*-commutative72.7%
Simplified72.7%
Final simplification82.7%
(FPCore (x y z) :precision binary64 (if (<= x -4.5e-68) (+ x (* x (* z -6.0))) (if (<= x 0.0023) (+ x (* z (* y 6.0))) (+ x (* z (* x -6.0))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -4.5e-68) {
tmp = x + (x * (z * -6.0));
} else if (x <= 0.0023) {
tmp = x + (z * (y * 6.0));
} else {
tmp = x + (z * (x * -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 (x <= (-4.5d-68)) then
tmp = x + (x * (z * (-6.0d0)))
else if (x <= 0.0023d0) then
tmp = x + (z * (y * 6.0d0))
else
tmp = x + (z * (x * (-6.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -4.5e-68) {
tmp = x + (x * (z * -6.0));
} else if (x <= 0.0023) {
tmp = x + (z * (y * 6.0));
} else {
tmp = x + (z * (x * -6.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -4.5e-68: tmp = x + (x * (z * -6.0)) elif x <= 0.0023: tmp = x + (z * (y * 6.0)) else: tmp = x + (z * (x * -6.0)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -4.5e-68) tmp = Float64(x + Float64(x * Float64(z * -6.0))); elseif (x <= 0.0023) tmp = Float64(x + Float64(z * Float64(y * 6.0))); else tmp = Float64(x + Float64(z * Float64(x * -6.0))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -4.5e-68) tmp = x + (x * (z * -6.0)); elseif (x <= 0.0023) tmp = x + (z * (y * 6.0)); else tmp = x + (z * (x * -6.0)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -4.5e-68], N[(x + N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.0023], N[(x + N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.5 \cdot 10^{-68}:\\
\;\;\;\;x + x \cdot \left(z \cdot -6\right)\\
\mathbf{elif}\;x \leq 0.0023:\\
\;\;\;\;x + z \cdot \left(y \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(x \cdot -6\right)\\
\end{array}
\end{array}
if x < -4.49999999999999999e-68Initial program 99.9%
Taylor expanded in y around 0 88.6%
*-commutative88.6%
associate-*r*88.6%
*-commutative88.6%
Simplified88.6%
if -4.49999999999999999e-68 < x < 0.0023Initial program 99.8%
Taylor expanded in y around inf 90.9%
if 0.0023 < x Initial program 99.8%
Taylor expanded in y around 0 89.6%
associate-*r*89.7%
Simplified89.7%
Final simplification89.8%
(FPCore (x y z) :precision binary64 (if (<= x -4.8e-68) (+ x (* x (* z -6.0))) (if (<= x 0.000125) (+ x (* 6.0 (* y z))) (+ x (* z (* x -6.0))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -4.8e-68) {
tmp = x + (x * (z * -6.0));
} else if (x <= 0.000125) {
tmp = x + (6.0 * (y * z));
} else {
tmp = x + (z * (x * -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 (x <= (-4.8d-68)) then
tmp = x + (x * (z * (-6.0d0)))
else if (x <= 0.000125d0) then
tmp = x + (6.0d0 * (y * z))
else
tmp = x + (z * (x * (-6.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -4.8e-68) {
tmp = x + (x * (z * -6.0));
} else if (x <= 0.000125) {
tmp = x + (6.0 * (y * z));
} else {
tmp = x + (z * (x * -6.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -4.8e-68: tmp = x + (x * (z * -6.0)) elif x <= 0.000125: tmp = x + (6.0 * (y * z)) else: tmp = x + (z * (x * -6.0)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -4.8e-68) tmp = Float64(x + Float64(x * Float64(z * -6.0))); elseif (x <= 0.000125) tmp = Float64(x + Float64(6.0 * Float64(y * z))); else tmp = Float64(x + Float64(z * Float64(x * -6.0))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -4.8e-68) tmp = x + (x * (z * -6.0)); elseif (x <= 0.000125) tmp = x + (6.0 * (y * z)); else tmp = x + (z * (x * -6.0)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -4.8e-68], N[(x + N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.000125], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{-68}:\\
\;\;\;\;x + x \cdot \left(z \cdot -6\right)\\
\mathbf{elif}\;x \leq 0.000125:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(x \cdot -6\right)\\
\end{array}
\end{array}
if x < -4.79999999999999982e-68Initial program 99.9%
Taylor expanded in y around 0 88.6%
*-commutative88.6%
associate-*r*88.6%
*-commutative88.6%
Simplified88.6%
if -4.79999999999999982e-68 < x < 1.25e-4Initial program 99.8%
Taylor expanded in y around inf 90.8%
*-commutative90.8%
Simplified90.8%
if 1.25e-4 < x Initial program 99.8%
Taylor expanded in y around 0 89.6%
associate-*r*89.7%
Simplified89.7%
Final simplification89.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.165) (not (<= z 0.17))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.165) || !(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.165d0)) .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.165) || !(z <= 0.17)) {
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.17): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.165) || !(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.165) || ~((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.165], 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.165 \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.165000000000000008 or 0.170000000000000012 < z Initial program 99.8%
Taylor expanded in y around 0 58.7%
Taylor expanded in z around inf 57.7%
if -0.165000000000000008 < z < 0.170000000000000012Initial program 99.8%
Taylor expanded in z around 0 72.0%
Final simplification65.1%
(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.8%
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.8%
Taylor expanded in z around 0 39.3%
(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 2024144
(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)))