
(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 9 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%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(if (<= x -3.2e+64)
(* x (+ 1.0 (* z -6.0)))
(if (or (<= x -28.5) (and (not (<= x -6e-53)) (<= x 1860000000000.0)))
(+ x (* 6.0 (* y z)))
(+ x (* z (* x -6.0))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.2e+64) {
tmp = x * (1.0 + (z * -6.0));
} else if ((x <= -28.5) || (!(x <= -6e-53) && (x <= 1860000000000.0))) {
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 <= (-3.2d+64)) then
tmp = x * (1.0d0 + (z * (-6.0d0)))
else if ((x <= (-28.5d0)) .or. (.not. (x <= (-6d-53))) .and. (x <= 1860000000000.0d0)) 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 <= -3.2e+64) {
tmp = x * (1.0 + (z * -6.0));
} else if ((x <= -28.5) || (!(x <= -6e-53) && (x <= 1860000000000.0))) {
tmp = x + (6.0 * (y * z));
} else {
tmp = x + (z * (x * -6.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.2e+64: tmp = x * (1.0 + (z * -6.0)) elif (x <= -28.5) or (not (x <= -6e-53) and (x <= 1860000000000.0)): 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 <= -3.2e+64) tmp = Float64(x * Float64(1.0 + Float64(z * -6.0))); elseif ((x <= -28.5) || (!(x <= -6e-53) && (x <= 1860000000000.0))) 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 <= -3.2e+64) tmp = x * (1.0 + (z * -6.0)); elseif ((x <= -28.5) || (~((x <= -6e-53)) && (x <= 1860000000000.0))) 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, -3.2e+64], N[(x * N[(1.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -28.5], And[N[Not[LessEqual[x, -6e-53]], $MachinePrecision], LessEqual[x, 1860000000000.0]]], 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 -3.2 \cdot 10^{+64}:\\
\;\;\;\;x \cdot \left(1 + z \cdot -6\right)\\
\mathbf{elif}\;x \leq -28.5 \lor \neg \left(x \leq -6 \cdot 10^{-53}\right) \land x \leq 1860000000000:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(x \cdot -6\right)\\
\end{array}
\end{array}
if x < -3.20000000000000019e64Initial program 100.0%
Taylor expanded in x around inf 90.7%
if -3.20000000000000019e64 < x < -28.5 or -6.0000000000000004e-53 < x < 1.86e12Initial program 99.8%
Taylor expanded in y around inf 94.5%
if -28.5 < x < -6.0000000000000004e-53 or 1.86e12 < x Initial program 99.8%
Taylor expanded in y around 0 83.1%
Final simplification91.1%
(FPCore (x y z)
:precision binary64
(if (<= x -1.3e+79)
(* x (+ 1.0 (* z -6.0)))
(if (<= x -30.0)
(+ x (* 6.0 (* y z)))
(if (or (<= x -6e-53) (not (<= x 1220000000000.0)))
(+ x (* z (* x -6.0)))
(+ x (* z (* y 6.0)))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.3e+79) {
tmp = x * (1.0 + (z * -6.0));
} else if (x <= -30.0) {
tmp = x + (6.0 * (y * z));
} else if ((x <= -6e-53) || !(x <= 1220000000000.0)) {
tmp = x + (z * (x * -6.0));
} else {
tmp = x + (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.3d+79)) then
tmp = x * (1.0d0 + (z * (-6.0d0)))
else if (x <= (-30.0d0)) then
tmp = x + (6.0d0 * (y * z))
else if ((x <= (-6d-53)) .or. (.not. (x <= 1220000000000.0d0))) then
tmp = x + (z * (x * (-6.0d0)))
else
tmp = x + (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.3e+79) {
tmp = x * (1.0 + (z * -6.0));
} else if (x <= -30.0) {
tmp = x + (6.0 * (y * z));
} else if ((x <= -6e-53) || !(x <= 1220000000000.0)) {
tmp = x + (z * (x * -6.0));
} else {
tmp = x + (z * (y * 6.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.3e+79: tmp = x * (1.0 + (z * -6.0)) elif x <= -30.0: tmp = x + (6.0 * (y * z)) elif (x <= -6e-53) or not (x <= 1220000000000.0): tmp = x + (z * (x * -6.0)) else: tmp = x + (z * (y * 6.0)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.3e+79) tmp = Float64(x * Float64(1.0 + Float64(z * -6.0))); elseif (x <= -30.0) tmp = Float64(x + Float64(6.0 * Float64(y * z))); elseif ((x <= -6e-53) || !(x <= 1220000000000.0)) tmp = Float64(x + Float64(z * Float64(x * -6.0))); else tmp = Float64(x + Float64(z * Float64(y * 6.0))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.3e+79) tmp = x * (1.0 + (z * -6.0)); elseif (x <= -30.0) tmp = x + (6.0 * (y * z)); elseif ((x <= -6e-53) || ~((x <= 1220000000000.0))) tmp = x + (z * (x * -6.0)); else tmp = x + (z * (y * 6.0)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.3e+79], N[(x * N[(1.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -30.0], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -6e-53], N[Not[LessEqual[x, 1220000000000.0]], $MachinePrecision]], N[(x + N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{+79}:\\
\;\;\;\;x \cdot \left(1 + z \cdot -6\right)\\
\mathbf{elif}\;x \leq -30:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;x \leq -6 \cdot 10^{-53} \lor \neg \left(x \leq 1220000000000\right):\\
\;\;\;\;x + z \cdot \left(x \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y \cdot 6\right)\\
\end{array}
\end{array}
if x < -1.30000000000000007e79Initial program 100.0%
Taylor expanded in x around inf 90.7%
if -1.30000000000000007e79 < x < -30Initial program 99.9%
Taylor expanded in y around inf 93.9%
if -30 < x < -6.0000000000000004e-53 or 1.22e12 < x Initial program 99.8%
Taylor expanded in y around 0 83.1%
if -6.0000000000000004e-53 < x < 1.22e12Initial program 99.8%
Taylor expanded in y around inf 94.6%
associate-*r*94.6%
Simplified94.6%
Final simplification91.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (* 6.0 (* y z)))) (t_1 (* x (+ 1.0 (* z -6.0)))))
(if (<= x -6.5e+77)
t_1
(if (<= x -27.0)
t_0
(if (<= x -6e-53)
(* z (* x -6.0))
(if (<= x 245000000000.0) t_0 t_1))))))
double code(double x, double y, double z) {
double t_0 = x + (6.0 * (y * z));
double t_1 = x * (1.0 + (z * -6.0));
double tmp;
if (x <= -6.5e+77) {
tmp = t_1;
} else if (x <= -27.0) {
tmp = t_0;
} else if (x <= -6e-53) {
tmp = z * (x * -6.0);
} else if (x <= 245000000000.0) {
tmp = t_0;
} 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 = x + (6.0d0 * (y * z))
t_1 = x * (1.0d0 + (z * (-6.0d0)))
if (x <= (-6.5d+77)) then
tmp = t_1
else if (x <= (-27.0d0)) then
tmp = t_0
else if (x <= (-6d-53)) then
tmp = z * (x * (-6.0d0))
else if (x <= 245000000000.0d0) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + (6.0 * (y * z));
double t_1 = x * (1.0 + (z * -6.0));
double tmp;
if (x <= -6.5e+77) {
tmp = t_1;
} else if (x <= -27.0) {
tmp = t_0;
} else if (x <= -6e-53) {
tmp = z * (x * -6.0);
} else if (x <= 245000000000.0) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = x + (6.0 * (y * z)) t_1 = x * (1.0 + (z * -6.0)) tmp = 0 if x <= -6.5e+77: tmp = t_1 elif x <= -27.0: tmp = t_0 elif x <= -6e-53: tmp = z * (x * -6.0) elif x <= 245000000000.0: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(x + Float64(6.0 * Float64(y * z))) t_1 = Float64(x * Float64(1.0 + Float64(z * -6.0))) tmp = 0.0 if (x <= -6.5e+77) tmp = t_1; elseif (x <= -27.0) tmp = t_0; elseif (x <= -6e-53) tmp = Float64(z * Float64(x * -6.0)); elseif (x <= 245000000000.0) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + (6.0 * (y * z)); t_1 = x * (1.0 + (z * -6.0)); tmp = 0.0; if (x <= -6.5e+77) tmp = t_1; elseif (x <= -27.0) tmp = t_0; elseif (x <= -6e-53) tmp = z * (x * -6.0); elseif (x <= 245000000000.0) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(1.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.5e+77], t$95$1, If[LessEqual[x, -27.0], t$95$0, If[LessEqual[x, -6e-53], N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 245000000000.0], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + 6 \cdot \left(y \cdot z\right)\\
t_1 := x \cdot \left(1 + z \cdot -6\right)\\
\mathbf{if}\;x \leq -6.5 \cdot 10^{+77}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -27:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -6 \cdot 10^{-53}:\\
\;\;\;\;z \cdot \left(x \cdot -6\right)\\
\mathbf{elif}\;x \leq 245000000000:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -6.5e77 or 2.45e11 < x Initial program 99.9%
Taylor expanded in x around inf 87.3%
if -6.5e77 < x < -27 or -6.0000000000000004e-53 < x < 2.45e11Initial program 99.8%
Taylor expanded in y around inf 94.5%
if -27 < x < -6.0000000000000004e-53Initial program 99.7%
Taylor expanded in x around inf 79.9%
Taylor expanded in z around inf 79.9%
*-commutative79.9%
associate-*r*80.1%
Simplified80.1%
Final simplification91.1%
(FPCore (x y z)
:precision binary64
(if (<= x -7.1e+81)
(* x (+ 1.0 (* z -6.0)))
(if (<= x -27.0)
(+ x (* 6.0 (* y z)))
(if (<= x -6e-53)
(+ x (* z (* x -6.0)))
(if (<= x 900000000000.0)
(+ x (* z (* y 6.0)))
(+ x (* -6.0 (* x z))))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -7.1e+81) {
tmp = x * (1.0 + (z * -6.0));
} else if (x <= -27.0) {
tmp = x + (6.0 * (y * z));
} else if (x <= -6e-53) {
tmp = x + (z * (x * -6.0));
} else if (x <= 900000000000.0) {
tmp = x + (z * (y * 6.0));
} 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 (x <= (-7.1d+81)) then
tmp = x * (1.0d0 + (z * (-6.0d0)))
else if (x <= (-27.0d0)) then
tmp = x + (6.0d0 * (y * z))
else if (x <= (-6d-53)) then
tmp = x + (z * (x * (-6.0d0)))
else if (x <= 900000000000.0d0) then
tmp = x + (z * (y * 6.0d0))
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 (x <= -7.1e+81) {
tmp = x * (1.0 + (z * -6.0));
} else if (x <= -27.0) {
tmp = x + (6.0 * (y * z));
} else if (x <= -6e-53) {
tmp = x + (z * (x * -6.0));
} else if (x <= 900000000000.0) {
tmp = x + (z * (y * 6.0));
} else {
tmp = x + (-6.0 * (x * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -7.1e+81: tmp = x * (1.0 + (z * -6.0)) elif x <= -27.0: tmp = x + (6.0 * (y * z)) elif x <= -6e-53: tmp = x + (z * (x * -6.0)) elif x <= 900000000000.0: tmp = x + (z * (y * 6.0)) else: tmp = x + (-6.0 * (x * z)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -7.1e+81) tmp = Float64(x * Float64(1.0 + Float64(z * -6.0))); elseif (x <= -27.0) tmp = Float64(x + Float64(6.0 * Float64(y * z))); elseif (x <= -6e-53) tmp = Float64(x + Float64(z * Float64(x * -6.0))); elseif (x <= 900000000000.0) tmp = Float64(x + Float64(z * Float64(y * 6.0))); 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 (x <= -7.1e+81) tmp = x * (1.0 + (z * -6.0)); elseif (x <= -27.0) tmp = x + (6.0 * (y * z)); elseif (x <= -6e-53) tmp = x + (z * (x * -6.0)); elseif (x <= 900000000000.0) tmp = x + (z * (y * 6.0)); else tmp = x + (-6.0 * (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -7.1e+81], N[(x * N[(1.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -27.0], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -6e-53], N[(x + N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 900000000000.0], N[(x + N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.1 \cdot 10^{+81}:\\
\;\;\;\;x \cdot \left(1 + z \cdot -6\right)\\
\mathbf{elif}\;x \leq -27:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;x \leq -6 \cdot 10^{-53}:\\
\;\;\;\;x + z \cdot \left(x \cdot -6\right)\\
\mathbf{elif}\;x \leq 900000000000:\\
\;\;\;\;x + z \cdot \left(y \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if x < -7.09999999999999967e81Initial program 100.0%
Taylor expanded in x around inf 90.7%
if -7.09999999999999967e81 < x < -27Initial program 99.9%
Taylor expanded in y around inf 93.9%
if -27 < x < -6.0000000000000004e-53Initial program 99.7%
Taylor expanded in y around 0 80.1%
if -6.0000000000000004e-53 < x < 9e11Initial program 99.8%
Taylor expanded in y around inf 94.6%
associate-*r*94.6%
Simplified94.6%
if 9e11 < x Initial program 99.8%
Taylor expanded in y around 0 83.7%
Final simplification91.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.16) (not (<= z 51000.0))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.16) || !(z <= 51000.0)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-0.16d0)) .or. (.not. (z <= 51000.0d0))) then
tmp = (-6.0d0) * (x * z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.16) || !(z <= 51000.0)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.16) or not (z <= 51000.0): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.16) || !(z <= 51000.0)) tmp = Float64(-6.0 * Float64(x * z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.16) || ~((z <= 51000.0))) tmp = -6.0 * (x * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.16], N[Not[LessEqual[z, 51000.0]], $MachinePrecision]], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.16 \lor \neg \left(z \leq 51000\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.160000000000000003 or 51000 < z Initial program 99.8%
Taylor expanded in x around inf 48.0%
Taylor expanded in z around inf 47.3%
if -0.160000000000000003 < z < 51000Initial program 99.9%
Taylor expanded in z around 0 62.1%
Final simplification54.2%
(FPCore (x y z) :precision binary64 (if (<= z -0.16) (* -6.0 (* x z)) (if (<= z 51000.0) x (* z (* x -6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.16) {
tmp = -6.0 * (x * z);
} else if (z <= 51000.0) {
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) :: tmp
if (z <= (-0.16d0)) then
tmp = (-6.0d0) * (x * z)
else if (z <= 51000.0d0) 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 tmp;
if (z <= -0.16) {
tmp = -6.0 * (x * z);
} else if (z <= 51000.0) {
tmp = x;
} else {
tmp = z * (x * -6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.16: tmp = -6.0 * (x * z) elif z <= 51000.0: tmp = x else: tmp = z * (x * -6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.16) tmp = Float64(-6.0 * Float64(x * z)); elseif (z <= 51000.0) tmp = x; else tmp = Float64(z * Float64(x * -6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.16) tmp = -6.0 * (x * z); elseif (z <= 51000.0) tmp = x; else tmp = z * (x * -6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.16], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 51000.0], x, N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.16:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq 51000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(x \cdot -6\right)\\
\end{array}
\end{array}
if z < -0.160000000000000003Initial program 99.8%
Taylor expanded in x around inf 43.2%
Taylor expanded in z around inf 42.3%
if -0.160000000000000003 < z < 51000Initial program 99.9%
Taylor expanded in z around 0 62.1%
if 51000 < z Initial program 99.8%
Taylor expanded in x around inf 54.6%
Taylor expanded in z around inf 54.2%
*-commutative54.2%
associate-*r*54.3%
Simplified54.3%
Final simplification54.3%
(FPCore (x y z) :precision binary64 (* x (+ 1.0 (* z -6.0))))
double code(double x, double y, double z) {
return x * (1.0 + (z * -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 * (1.0d0 + (z * (-6.0d0)))
end function
public static double code(double x, double y, double z) {
return x * (1.0 + (z * -6.0));
}
def code(x, y, z): return x * (1.0 + (z * -6.0))
function code(x, y, z) return Float64(x * Float64(1.0 + Float64(z * -6.0))) end
function tmp = code(x, y, z) tmp = x * (1.0 + (z * -6.0)); end
code[x_, y_, z_] := N[(x * N[(1.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 + z \cdot -6\right)
\end{array}
Initial program 99.8%
Taylor expanded in x around inf 54.8%
Final simplification54.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 30.7%
Final simplification30.7%
(FPCore (x y z) :precision binary64 (- x (* (* 6.0 z) (- x y))))
double code(double x, double y, double z) {
return x - ((6.0 * z) * (x - y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x - ((6.0d0 * z) * (x - y))
end function
public static double code(double x, double y, double z) {
return x - ((6.0 * z) * (x - y));
}
def code(x, y, z): return x - ((6.0 * z) * (x - y))
function code(x, y, z) return Float64(x - Float64(Float64(6.0 * z) * Float64(x - y))) end
function tmp = code(x, y, z) tmp = x - ((6.0 * z) * (x - y)); end
code[x_, y_, z_] := N[(x - N[(N[(6.0 * z), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(6 \cdot z\right) \cdot \left(x - y\right)
\end{array}
herbie shell --seed 2023229
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
:precision binary64
:herbie-target
(- x (* (* 6.0 z) (- x y)))
(+ x (* (* (- y x) 6.0) z)))