
(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.8%
+-commutative99.8%
associate-*l*99.8%
fma-def99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))) (t_1 (* -6.0 (* x z))))
(if (<= z -1.32e+243)
t_0
(if (<= z -0.165)
t_1
(if (<= z 8.5e-13)
x
(if (or (<= z 1.25e+147) (not (<= z 5.6e+175))) t_0 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.32e+243) {
tmp = t_0;
} else if (z <= -0.165) {
tmp = t_1;
} else if (z <= 8.5e-13) {
tmp = x;
} else if ((z <= 1.25e+147) || !(z <= 5.6e+175)) {
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 = 6.0d0 * (y * z)
t_1 = (-6.0d0) * (x * z)
if (z <= (-1.32d+243)) then
tmp = t_0
else if (z <= (-0.165d0)) then
tmp = t_1
else if (z <= 8.5d-13) then
tmp = x
else if ((z <= 1.25d+147) .or. (.not. (z <= 5.6d+175))) 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 = 6.0 * (y * z);
double t_1 = -6.0 * (x * z);
double tmp;
if (z <= -1.32e+243) {
tmp = t_0;
} else if (z <= -0.165) {
tmp = t_1;
} else if (z <= 8.5e-13) {
tmp = x;
} else if ((z <= 1.25e+147) || !(z <= 5.6e+175)) {
tmp = t_0;
} 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.32e+243: tmp = t_0 elif z <= -0.165: tmp = t_1 elif z <= 8.5e-13: tmp = x elif (z <= 1.25e+147) or not (z <= 5.6e+175): tmp = t_0 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.32e+243) tmp = t_0; elseif (z <= -0.165) tmp = t_1; elseif (z <= 8.5e-13) tmp = x; elseif ((z <= 1.25e+147) || !(z <= 5.6e+175)) tmp = t_0; 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.32e+243) tmp = t_0; elseif (z <= -0.165) tmp = t_1; elseif (z <= 8.5e-13) tmp = x; elseif ((z <= 1.25e+147) || ~((z <= 5.6e+175))) tmp = t_0; 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.32e+243], t$95$0, If[LessEqual[z, -0.165], t$95$1, If[LessEqual[z, 8.5e-13], x, If[Or[LessEqual[z, 1.25e+147], N[Not[LessEqual[z, 5.6e+175]], $MachinePrecision]], t$95$0, 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.32 \cdot 10^{+243}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -0.165:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-13}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{+147} \lor \neg \left(z \leq 5.6 \cdot 10^{+175}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -1.32000000000000009e243 or 8.5000000000000001e-13 < z < 1.2500000000000001e147 or 5.6000000000000002e175 < z Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 98.5%
Taylor expanded in y around inf 64.9%
*-commutative64.9%
Simplified64.9%
if -1.32000000000000009e243 < z < -0.165000000000000008 or 1.2500000000000001e147 < z < 5.6000000000000002e175Initial program 99.6%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 98.4%
Taylor expanded in y around 0 68.5%
if -0.165000000000000008 < z < 8.5000000000000001e-13Initial program 99.9%
Taylor expanded in z around 0 75.2%
Final simplification70.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))))
(if (<= z -5.1e+243)
t_0
(if (<= z -0.165)
(* x (* z -6.0))
(if (<= z 4.1e-14)
x
(if (or (<= z 9.5e+146) (not (<= z 2.8e+177)))
t_0
(* -6.0 (* x z))))))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double tmp;
if (z <= -5.1e+243) {
tmp = t_0;
} else if (z <= -0.165) {
tmp = x * (z * -6.0);
} else if (z <= 4.1e-14) {
tmp = x;
} else if ((z <= 9.5e+146) || !(z <= 2.8e+177)) {
tmp = t_0;
} else {
tmp = -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) :: t_0
real(8) :: tmp
t_0 = 6.0d0 * (y * z)
if (z <= (-5.1d+243)) then
tmp = t_0
else if (z <= (-0.165d0)) then
tmp = x * (z * (-6.0d0))
else if (z <= 4.1d-14) then
tmp = x
else if ((z <= 9.5d+146) .or. (.not. (z <= 2.8d+177))) then
tmp = t_0
else
tmp = (-6.0d0) * (x * z)
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.1e+243) {
tmp = t_0;
} else if (z <= -0.165) {
tmp = x * (z * -6.0);
} else if (z <= 4.1e-14) {
tmp = x;
} else if ((z <= 9.5e+146) || !(z <= 2.8e+177)) {
tmp = t_0;
} else {
tmp = -6.0 * (x * z);
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) tmp = 0 if z <= -5.1e+243: tmp = t_0 elif z <= -0.165: tmp = x * (z * -6.0) elif z <= 4.1e-14: tmp = x elif (z <= 9.5e+146) or not (z <= 2.8e+177): tmp = t_0 else: tmp = -6.0 * (x * z) return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -5.1e+243) tmp = t_0; elseif (z <= -0.165) tmp = Float64(x * Float64(z * -6.0)); elseif (z <= 4.1e-14) tmp = x; elseif ((z <= 9.5e+146) || !(z <= 2.8e+177)) tmp = t_0; else tmp = Float64(-6.0 * Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * (y * z); tmp = 0.0; if (z <= -5.1e+243) tmp = t_0; elseif (z <= -0.165) tmp = x * (z * -6.0); elseif (z <= 4.1e-14) tmp = x; elseif ((z <= 9.5e+146) || ~((z <= 2.8e+177))) tmp = t_0; else tmp = -6.0 * (x * z); 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.1e+243], t$95$0, If[LessEqual[z, -0.165], N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.1e-14], x, If[Or[LessEqual[z, 9.5e+146], N[Not[LessEqual[z, 2.8e+177]], $MachinePrecision]], t$95$0, N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -5.1 \cdot 10^{+243}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -0.165:\\
\;\;\;\;x \cdot \left(z \cdot -6\right)\\
\mathbf{elif}\;z \leq 4.1 \cdot 10^{-14}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{+146} \lor \neg \left(z \leq 2.8 \cdot 10^{+177}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if z < -5.1000000000000002e243 or 4.1000000000000002e-14 < z < 9.49999999999999926e146 or 2.80000000000000002e177 < z Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 98.5%
Taylor expanded in y around inf 64.9%
*-commutative64.9%
Simplified64.9%
if -5.1000000000000002e243 < z < -0.165000000000000008Initial program 99.6%
Taylor expanded in x around inf 68.3%
Taylor expanded in z around inf 66.6%
if -0.165000000000000008 < z < 4.1000000000000002e-14Initial program 99.9%
Taylor expanded in z around 0 75.2%
if 9.49999999999999926e146 < z < 2.80000000000000002e177Initial program 99.8%
Taylor expanded in z around 0 100.0%
Taylor expanded in z around inf 100.0%
Taylor expanded in y around 0 78.7%
Final simplification70.1%
(FPCore (x y z)
:precision binary64
(if (<= z -5.8e+237)
(* 6.0 (* y z))
(if (<= z -0.165)
(* x (* z -6.0))
(if (<= z 6.6e-11)
x
(if (or (<= z 5e+146) (not (<= z 5.8e+175)))
(* z (* y 6.0))
(* -6.0 (* x z)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.8e+237) {
tmp = 6.0 * (y * z);
} else if (z <= -0.165) {
tmp = x * (z * -6.0);
} else if (z <= 6.6e-11) {
tmp = x;
} else if ((z <= 5e+146) || !(z <= 5.8e+175)) {
tmp = z * (y * 6.0);
} else {
tmp = -6.0 * (x * z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-5.8d+237)) then
tmp = 6.0d0 * (y * z)
else if (z <= (-0.165d0)) then
tmp = x * (z * (-6.0d0))
else if (z <= 6.6d-11) then
tmp = x
else if ((z <= 5d+146) .or. (.not. (z <= 5.8d+175))) then
tmp = z * (y * 6.0d0)
else
tmp = (-6.0d0) * (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -5.8e+237) {
tmp = 6.0 * (y * z);
} else if (z <= -0.165) {
tmp = x * (z * -6.0);
} else if (z <= 6.6e-11) {
tmp = x;
} else if ((z <= 5e+146) || !(z <= 5.8e+175)) {
tmp = z * (y * 6.0);
} else {
tmp = -6.0 * (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.8e+237: tmp = 6.0 * (y * z) elif z <= -0.165: tmp = x * (z * -6.0) elif z <= 6.6e-11: tmp = x elif (z <= 5e+146) or not (z <= 5.8e+175): tmp = z * (y * 6.0) else: tmp = -6.0 * (x * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.8e+237) tmp = Float64(6.0 * Float64(y * z)); elseif (z <= -0.165) tmp = Float64(x * Float64(z * -6.0)); elseif (z <= 6.6e-11) tmp = x; elseif ((z <= 5e+146) || !(z <= 5.8e+175)) tmp = Float64(z * Float64(y * 6.0)); else tmp = Float64(-6.0 * Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5.8e+237) tmp = 6.0 * (y * z); elseif (z <= -0.165) tmp = x * (z * -6.0); elseif (z <= 6.6e-11) tmp = x; elseif ((z <= 5e+146) || ~((z <= 5.8e+175))) tmp = z * (y * 6.0); else tmp = -6.0 * (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.8e+237], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -0.165], N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.6e-11], x, If[Or[LessEqual[z, 5e+146], N[Not[LessEqual[z, 5.8e+175]], $MachinePrecision]], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+237}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq -0.165:\\
\;\;\;\;x \cdot \left(z \cdot -6\right)\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{-11}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+146} \lor \neg \left(z \leq 5.8 \cdot 10^{+175}\right):\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if z < -5.8000000000000002e237Initial program 99.8%
Taylor expanded in z around 0 99.9%
Taylor expanded in z around inf 99.9%
Taylor expanded in y around inf 70.0%
*-commutative70.0%
Simplified70.0%
if -5.8000000000000002e237 < z < -0.165000000000000008Initial program 99.6%
Taylor expanded in x around inf 68.3%
Taylor expanded in z around inf 66.6%
if -0.165000000000000008 < z < 6.6000000000000005e-11Initial program 99.9%
Taylor expanded in z around 0 75.2%
if 6.6000000000000005e-11 < z < 4.9999999999999999e146 or 5.8e175 < z Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 98.2%
Taylor expanded in y around inf 63.8%
associate-*r*63.9%
Simplified63.9%
if 4.9999999999999999e146 < z < 5.8e175Initial program 99.8%
Taylor expanded in z around 0 100.0%
Taylor expanded in z around inf 100.0%
Taylor expanded in y around 0 78.7%
Final simplification70.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.45e-81) (not (<= z 6.5e-13))) (* 6.0 (* (- y x) z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.45e-81) || !(z <= 6.5e-13)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-3.45d-81)) .or. (.not. (z <= 6.5d-13))) then
tmp = 6.0d0 * ((y - x) * z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -3.45e-81) || !(z <= 6.5e-13)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.45e-81) or not (z <= 6.5e-13): tmp = 6.0 * ((y - x) * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.45e-81) || !(z <= 6.5e-13)) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -3.45e-81) || ~((z <= 6.5e-13))) tmp = 6.0 * ((y - x) * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.45e-81], N[Not[LessEqual[z, 6.5e-13]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.45 \cdot 10^{-81} \lor \neg \left(z \leq 6.5 \cdot 10^{-13}\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.4500000000000001e-81 or 6.49999999999999957e-13 < z Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 93.4%
if -3.4500000000000001e-81 < z < 6.49999999999999957e-13Initial program 99.9%
Taylor expanded in z around 0 81.8%
Final simplification89.3%
(FPCore (x y z) :precision binary64 (if (<= z -2.1e-81) (* 6.0 (* (- y x) z)) (if (<= z 1.55e-12) x (* z (* (- y x) 6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.1e-81) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 1.55e-12) {
tmp = x;
} else {
tmp = z * ((y - 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 <= (-2.1d-81)) then
tmp = 6.0d0 * ((y - x) * z)
else if (z <= 1.55d-12) then
tmp = x
else
tmp = z * ((y - x) * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -2.1e-81) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 1.55e-12) {
tmp = x;
} else {
tmp = z * ((y - x) * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.1e-81: tmp = 6.0 * ((y - x) * z) elif z <= 1.55e-12: tmp = x else: tmp = z * ((y - x) * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.1e-81) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); elseif (z <= 1.55e-12) tmp = x; else tmp = Float64(z * Float64(Float64(y - x) * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2.1e-81) tmp = 6.0 * ((y - x) * z); elseif (z <= 1.55e-12) tmp = x; else tmp = z * ((y - x) * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.1e-81], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.55e-12], x, N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{-81}:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{-12}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\end{array}
\end{array}
if z < -2.0999999999999999e-81Initial program 99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 88.0%
if -2.0999999999999999e-81 < z < 1.5500000000000001e-12Initial program 99.9%
Taylor expanded in z around 0 81.8%
if 1.5500000000000001e-12 < z Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 98.3%
associate-*r*98.4%
*-commutative98.4%
associate-*l*98.3%
Simplified98.3%
Final simplification89.3%
(FPCore (x y z) :precision binary64 (if (<= z -4.6e-81) (* 6.0 (* (- y x) z)) (if (<= z 4e-8) (* x (+ 1.0 (* z -6.0))) (* z (* (- y x) 6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -4.6e-81) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 4e-8) {
tmp = x * (1.0 + (z * -6.0));
} else {
tmp = z * ((y - 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 <= (-4.6d-81)) then
tmp = 6.0d0 * ((y - x) * z)
else if (z <= 4d-8) then
tmp = x * (1.0d0 + (z * (-6.0d0)))
else
tmp = z * ((y - x) * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -4.6e-81) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 4e-8) {
tmp = x * (1.0 + (z * -6.0));
} else {
tmp = z * ((y - x) * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4.6e-81: tmp = 6.0 * ((y - x) * z) elif z <= 4e-8: tmp = x * (1.0 + (z * -6.0)) else: tmp = z * ((y - x) * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4.6e-81) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); elseif (z <= 4e-8) tmp = Float64(x * Float64(1.0 + Float64(z * -6.0))); else tmp = Float64(z * Float64(Float64(y - x) * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -4.6e-81) tmp = 6.0 * ((y - x) * z); elseif (z <= 4e-8) tmp = x * (1.0 + (z * -6.0)); else tmp = z * ((y - x) * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4.6e-81], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4e-8], N[(x * N[(1.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.6 \cdot 10^{-81}:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{elif}\;z \leq 4 \cdot 10^{-8}:\\
\;\;\;\;x \cdot \left(1 + z \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\end{array}
\end{array}
if z < -4.59999999999999982e-81Initial program 99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 88.0%
if -4.59999999999999982e-81 < z < 4.0000000000000001e-8Initial program 99.9%
Taylor expanded in x around inf 81.3%
if 4.0000000000000001e-8 < z Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 99.5%
associate-*r*99.5%
*-commutative99.5%
associate-*l*99.5%
Simplified99.5%
Final simplification89.3%
(FPCore (x y z) :precision binary64 (if (<= z -0.165) (* 6.0 (* (- y x) z)) (if (<= z 4.8e-5) (+ x (* 6.0 (* y z))) (* z (* (- y x) 6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.165) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 4.8e-5) {
tmp = x + (6.0 * (y * z));
} else {
tmp = z * ((y - 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.165d0)) then
tmp = 6.0d0 * ((y - x) * z)
else if (z <= 4.8d-5) then
tmp = x + (6.0d0 * (y * z))
else
tmp = z * ((y - x) * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.165) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 4.8e-5) {
tmp = x + (6.0 * (y * z));
} else {
tmp = z * ((y - x) * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.165: tmp = 6.0 * ((y - x) * z) elif z <= 4.8e-5: tmp = x + (6.0 * (y * z)) else: tmp = z * ((y - x) * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.165) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); elseif (z <= 4.8e-5) tmp = Float64(x + Float64(6.0 * Float64(y * z))); else tmp = Float64(z * Float64(Float64(y - x) * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.165) tmp = 6.0 * ((y - x) * z); elseif (z <= 4.8e-5) tmp = x + (6.0 * (y * z)); else tmp = z * ((y - x) * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.165], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.8e-5], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.165:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-5}:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\end{array}
\end{array}
if z < -0.165000000000000008Initial program 99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 98.6%
if -0.165000000000000008 < z < 4.8000000000000001e-5Initial program 99.9%
Taylor expanded in y around inf 99.2%
if 4.8000000000000001e-5 < z Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 99.5%
associate-*r*99.5%
*-commutative99.5%
associate-*l*99.5%
Simplified99.5%
Final simplification99.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.165) (not (<= z 1200000000.0))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.165) || !(z <= 1200000000.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.165d0)) .or. (.not. (z <= 1200000000.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.165) || !(z <= 1200000000.0)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.165) or not (z <= 1200000000.0): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.165) || !(z <= 1200000000.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.165) || ~((z <= 1200000000.0))) 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, 1200000000.0]], $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 1200000000\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.165000000000000008 or 1.2e9 < z Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 99.1%
Taylor expanded in y around 0 52.5%
if -0.165000000000000008 < z < 1.2e9Initial program 99.9%
Taylor expanded in z around 0 72.7%
Final simplification61.7%
(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.8%
Final simplification99.8%
(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.8%
associate-*l*99.8%
Simplified99.8%
Final simplification99.8%
(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 34.7%
Final simplification34.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 2023221
(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)))