
(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(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 (if (or (<= x -9e-115) (not (<= x 3.3e-99))) (+ x (* -6.0 (* x z))) (* z (* y 6.0))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -9e-115) || !(x <= 3.3e-99)) {
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 <= (-9d-115)) .or. (.not. (x <= 3.3d-99))) 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 <= -9e-115) || !(x <= 3.3e-99)) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = z * (y * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -9e-115) or not (x <= 3.3e-99): tmp = x + (-6.0 * (x * z)) else: tmp = z * (y * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -9e-115) || !(x <= 3.3e-99)) 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 <= -9e-115) || ~((x <= 3.3e-99))) 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, -9e-115], N[Not[LessEqual[x, 3.3e-99]], $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 -9 \cdot 10^{-115} \lor \neg \left(x \leq 3.3 \cdot 10^{-99}\right):\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\end{array}
\end{array}
if x < -9.00000000000000046e-115 or 3.29999999999999986e-99 < x Initial program 99.9%
Taylor expanded in y around 0 80.9%
if -9.00000000000000046e-115 < x < 3.29999999999999986e-99Initial program 99.7%
Taylor expanded in y around inf 94.3%
*-commutative94.3%
associate-*r*94.3%
Simplified94.3%
Taylor expanded in x around inf 68.1%
Taylor expanded in x around 0 76.8%
associate-*r*76.9%
*-commutative76.9%
Simplified76.9%
Final simplification79.5%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.18e-113) (not (<= x 2.3e-99))) (* x (+ (* z -6.0) 1.0)) (* z (* y 6.0))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.18e-113) || !(x <= 2.3e-99)) {
tmp = x * ((z * -6.0) + 1.0);
} 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.18d-113)) .or. (.not. (x <= 2.3d-99))) then
tmp = x * ((z * (-6.0d0)) + 1.0d0)
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.18e-113) || !(x <= 2.3e-99)) {
tmp = x * ((z * -6.0) + 1.0);
} else {
tmp = z * (y * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.18e-113) or not (x <= 2.3e-99): tmp = x * ((z * -6.0) + 1.0) else: tmp = z * (y * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.18e-113) || !(x <= 2.3e-99)) tmp = Float64(x * Float64(Float64(z * -6.0) + 1.0)); 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.18e-113) || ~((x <= 2.3e-99))) tmp = x * ((z * -6.0) + 1.0); else tmp = z * (y * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.18e-113], N[Not[LessEqual[x, 2.3e-99]], $MachinePrecision]], N[(x * N[(N[(z * -6.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.18 \cdot 10^{-113} \lor \neg \left(x \leq 2.3 \cdot 10^{-99}\right):\\
\;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\end{array}
\end{array}
if x < -1.18e-113 or 2.2999999999999998e-99 < x Initial program 99.9%
Taylor expanded in x around inf 80.8%
+-commutative80.8%
Simplified80.8%
if -1.18e-113 < x < 2.2999999999999998e-99Initial program 99.7%
Taylor expanded in y around inf 94.3%
*-commutative94.3%
associate-*r*94.3%
Simplified94.3%
Taylor expanded in x around inf 68.1%
Taylor expanded in x around 0 76.8%
associate-*r*76.9%
*-commutative76.9%
Simplified76.9%
Final simplification79.4%
(FPCore (x y z) :precision binary64 (if (<= x -6.5e+128) (+ x (* -6.0 (* x z))) (if (<= x 5.3e+17) (+ x (* z (* y 6.0))) (+ x (* z (* x -6.0))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -6.5e+128) {
tmp = x + (-6.0 * (x * z));
} else if (x <= 5.3e+17) {
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 <= (-6.5d+128)) then
tmp = x + ((-6.0d0) * (x * z))
else if (x <= 5.3d+17) 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 <= -6.5e+128) {
tmp = x + (-6.0 * (x * z));
} else if (x <= 5.3e+17) {
tmp = x + (z * (y * 6.0));
} else {
tmp = x + (z * (x * -6.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -6.5e+128: tmp = x + (-6.0 * (x * z)) elif x <= 5.3e+17: 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 <= -6.5e+128) tmp = Float64(x + Float64(-6.0 * Float64(x * z))); elseif (x <= 5.3e+17) 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 <= -6.5e+128) tmp = x + (-6.0 * (x * z)); elseif (x <= 5.3e+17) 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, -6.5e+128], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.3e+17], 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 -6.5 \cdot 10^{+128}:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;x \leq 5.3 \cdot 10^{+17}:\\
\;\;\;\;x + z \cdot \left(y \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(x \cdot -6\right)\\
\end{array}
\end{array}
if x < -6.5000000000000003e128Initial program 99.9%
Taylor expanded in y around 0 100.0%
if -6.5000000000000003e128 < x < 5.3e17Initial program 99.8%
Taylor expanded in y around inf 90.1%
if 5.3e17 < x Initial program 100.0%
Taylor expanded in y around 0 90.5%
associate-*r*90.6%
Simplified90.6%
Final simplification91.6%
(FPCore (x y z) :precision binary64 (if (<= x -5.8e+128) (+ x (* -6.0 (* x z))) (if (<= x 2.55e+17) (+ x (* 6.0 (* y z))) (+ x (* z (* x -6.0))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -5.8e+128) {
tmp = x + (-6.0 * (x * z));
} else if (x <= 2.55e+17) {
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 <= (-5.8d+128)) then
tmp = x + ((-6.0d0) * (x * z))
else if (x <= 2.55d+17) 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 <= -5.8e+128) {
tmp = x + (-6.0 * (x * z));
} else if (x <= 2.55e+17) {
tmp = x + (6.0 * (y * z));
} else {
tmp = x + (z * (x * -6.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -5.8e+128: tmp = x + (-6.0 * (x * z)) elif x <= 2.55e+17: 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 <= -5.8e+128) tmp = Float64(x + Float64(-6.0 * Float64(x * z))); elseif (x <= 2.55e+17) 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 <= -5.8e+128) tmp = x + (-6.0 * (x * z)); elseif (x <= 2.55e+17) 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, -5.8e+128], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.55e+17], 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 -5.8 \cdot 10^{+128}:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;x \leq 2.55 \cdot 10^{+17}:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(x \cdot -6\right)\\
\end{array}
\end{array}
if x < -5.8000000000000001e128Initial program 99.9%
Taylor expanded in y around 0 100.0%
if -5.8000000000000001e128 < x < 2.55e17Initial program 99.8%
Taylor expanded in y around inf 90.1%
*-commutative90.1%
Simplified90.1%
if 2.55e17 < x Initial program 100.0%
Taylor expanded in y around 0 90.5%
associate-*r*90.6%
Simplified90.6%
Final simplification91.6%
(FPCore (x y z) :precision binary64 (if (<= x -7.5e+128) (+ x (* -6.0 (* x z))) (if (<= x 2.2e+17) (+ x (* 6.0 (* y z))) (* x (+ (* z -6.0) 1.0)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -7.5e+128) {
tmp = x + (-6.0 * (x * z));
} else if (x <= 2.2e+17) {
tmp = x + (6.0 * (y * 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 (x <= (-7.5d+128)) then
tmp = x + ((-6.0d0) * (x * z))
else if (x <= 2.2d+17) then
tmp = x + (6.0d0 * (y * 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 (x <= -7.5e+128) {
tmp = x + (-6.0 * (x * z));
} else if (x <= 2.2e+17) {
tmp = x + (6.0 * (y * z));
} else {
tmp = x * ((z * -6.0) + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -7.5e+128: tmp = x + (-6.0 * (x * z)) elif x <= 2.2e+17: tmp = x + (6.0 * (y * z)) else: tmp = x * ((z * -6.0) + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -7.5e+128) tmp = Float64(x + Float64(-6.0 * Float64(x * z))); elseif (x <= 2.2e+17) tmp = Float64(x + Float64(6.0 * Float64(y * 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 (x <= -7.5e+128) tmp = x + (-6.0 * (x * z)); elseif (x <= 2.2e+17) tmp = x + (6.0 * (y * z)); else tmp = x * ((z * -6.0) + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -7.5e+128], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.2e+17], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(z * -6.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{+128}:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{+17}:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\
\end{array}
\end{array}
if x < -7.50000000000000076e128Initial program 99.9%
Taylor expanded in y around 0 100.0%
if -7.50000000000000076e128 < x < 2.2e17Initial program 99.8%
Taylor expanded in y around inf 90.1%
*-commutative90.1%
Simplified90.1%
if 2.2e17 < x Initial program 100.0%
Taylor expanded in x around inf 90.6%
+-commutative90.6%
Simplified90.6%
Final simplification91.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -6.8e-74) (not (<= z 3.15e-26))) (* 6.0 (* y z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6.8e-74) || !(z <= 3.15e-26)) {
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 <= (-6.8d-74)) .or. (.not. (z <= 3.15d-26))) 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 <= -6.8e-74) || !(z <= 3.15e-26)) {
tmp = 6.0 * (y * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6.8e-74) or not (z <= 3.15e-26): tmp = 6.0 * (y * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6.8e-74) || !(z <= 3.15e-26)) 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 <= -6.8e-74) || ~((z <= 3.15e-26))) tmp = 6.0 * (y * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6.8e-74], N[Not[LessEqual[z, 3.15e-26]], $MachinePrecision]], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.8 \cdot 10^{-74} \lor \neg \left(z \leq 3.15 \cdot 10^{-26}\right):\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -6.8000000000000001e-74 or 3.15e-26 < z Initial program 99.8%
Taylor expanded in y around inf 65.2%
*-commutative65.2%
associate-*r*65.2%
Simplified65.2%
Taylor expanded in x around inf 48.4%
Taylor expanded in x around 0 60.6%
if -6.8000000000000001e-74 < z < 3.15e-26Initial program 99.9%
Taylor expanded in z around 0 76.5%
Final simplification68.2%
(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 99.8%
Taylor expanded in x around inf 47.2%
+-commutative47.2%
*-commutative47.2%
Simplified47.2%
Taylor expanded in z around inf 46.3%
if -0.165000000000000008 < z < 0.170000000000000012Initial program 99.9%
Taylor expanded in z around 0 72.3%
Final simplification60.2%
(FPCore (x y z) :precision binary64 (if (<= z -5.8e-75) (* z (* y 6.0)) (if (<= z 1e-24) x (* 6.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.8e-75) {
tmp = z * (y * 6.0);
} else if (z <= 1e-24) {
tmp = x;
} else {
tmp = 6.0 * (y * z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-5.8d-75)) then
tmp = z * (y * 6.0d0)
else if (z <= 1d-24) then
tmp = x
else
tmp = 6.0d0 * (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -5.8e-75) {
tmp = z * (y * 6.0);
} else if (z <= 1e-24) {
tmp = x;
} else {
tmp = 6.0 * (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.8e-75: tmp = z * (y * 6.0) elif z <= 1e-24: tmp = x else: tmp = 6.0 * (y * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.8e-75) tmp = Float64(z * Float64(y * 6.0)); elseif (z <= 1e-24) tmp = x; else tmp = Float64(6.0 * Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5.8e-75) tmp = z * (y * 6.0); elseif (z <= 1e-24) tmp = x; else tmp = 6.0 * (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.8e-75], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1e-24], x, N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{-75}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{elif}\;z \leq 10^{-24}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if z < -5.8000000000000003e-75Initial program 99.8%
Taylor expanded in y around inf 67.3%
*-commutative67.3%
associate-*r*67.4%
Simplified67.4%
Taylor expanded in x around inf 49.4%
Taylor expanded in x around 0 60.4%
associate-*r*60.4%
*-commutative60.4%
Simplified60.4%
if -5.8000000000000003e-75 < z < 9.99999999999999924e-25Initial program 99.9%
Taylor expanded in z around 0 76.5%
if 9.99999999999999924e-25 < z Initial program 99.8%
Taylor expanded in y around inf 62.3%
*-commutative62.3%
associate-*r*62.3%
Simplified62.3%
Taylor expanded in x around inf 47.1%
Taylor expanded in x around 0 61.0%
Final simplification68.2%
(FPCore (x y z) :precision binary64 (if (<= z -1.6e-75) (* y (* 6.0 z)) (if (<= z 6.5e-26) x (* 6.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.6e-75) {
tmp = y * (6.0 * z);
} else if (z <= 6.5e-26) {
tmp = x;
} else {
tmp = 6.0 * (y * z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1.6d-75)) then
tmp = y * (6.0d0 * z)
else if (z <= 6.5d-26) then
tmp = x
else
tmp = 6.0d0 * (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.6e-75) {
tmp = y * (6.0 * z);
} else if (z <= 6.5e-26) {
tmp = x;
} else {
tmp = 6.0 * (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.6e-75: tmp = y * (6.0 * z) elif z <= 6.5e-26: tmp = x else: tmp = 6.0 * (y * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.6e-75) tmp = Float64(y * Float64(6.0 * z)); elseif (z <= 6.5e-26) tmp = x; else tmp = Float64(6.0 * Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.6e-75) tmp = y * (6.0 * z); elseif (z <= 6.5e-26) tmp = x; else tmp = 6.0 * (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.6e-75], N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.5e-26], x, N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{-75}:\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{-26}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if z < -1.59999999999999988e-75Initial program 99.8%
Taylor expanded in y around inf 67.3%
*-commutative67.3%
associate-*r*67.4%
Simplified67.4%
Taylor expanded in x around inf 49.4%
Taylor expanded in x around 0 60.4%
associate-*r*60.4%
*-commutative60.4%
associate-*r*60.4%
Simplified60.4%
if -1.59999999999999988e-75 < z < 6.5e-26Initial program 99.9%
Taylor expanded in z around 0 76.5%
if 6.5e-26 < z Initial program 99.8%
Taylor expanded in y around inf 62.3%
*-commutative62.3%
associate-*r*62.3%
Simplified62.3%
Taylor expanded in x around inf 47.1%
Taylor expanded in x around 0 61.0%
(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 40.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 2024118
(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)))