
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) z)))
double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (((y - x) * 6.0d0) * z)
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
def code(x, y, z): return x + (((y - x) * 6.0) * z)
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * z)) end
function tmp = code(x, y, z) tmp = x + (((y - x) * 6.0) * z); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) z)))
double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (((y - x) * 6.0d0) * z)
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
def code(x, y, z): return x + (((y - x) * 6.0) * z)
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * z)) end
function tmp = code(x, y, z) tmp = x + (((y - x) * 6.0) * z); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
\end{array}
(FPCore (x y z) :precision binary64 (fma (- y x) (* 6.0 z) x))
double code(double x, double y, double z) {
return fma((y - x), (6.0 * z), x);
}
function code(x, y, z) return fma(Float64(y - x), Float64(6.0 * z), x) end
code[x_, y_, z_] := N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - x, 6 \cdot z, x\right)
\end{array}
Initial program 99.5%
+-commutative99.5%
associate-*l*99.8%
fma-define99.8%
Simplified99.8%
(FPCore (x y z) :precision binary64 (if (<= z -2.5e-33) (* z (* y 6.0)) (if (<= z 0.17) x (if (<= z 2.3e+114) (* -6.0 (* x z)) (* 6.0 (* y z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.5e-33) {
tmp = z * (y * 6.0);
} else if (z <= 0.17) {
tmp = x;
} else if (z <= 2.3e+114) {
tmp = -6.0 * (x * z);
} 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 <= (-2.5d-33)) then
tmp = z * (y * 6.0d0)
else if (z <= 0.17d0) then
tmp = x
else if (z <= 2.3d+114) then
tmp = (-6.0d0) * (x * z)
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 <= -2.5e-33) {
tmp = z * (y * 6.0);
} else if (z <= 0.17) {
tmp = x;
} else if (z <= 2.3e+114) {
tmp = -6.0 * (x * z);
} else {
tmp = 6.0 * (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.5e-33: tmp = z * (y * 6.0) elif z <= 0.17: tmp = x elif z <= 2.3e+114: tmp = -6.0 * (x * z) else: tmp = 6.0 * (y * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.5e-33) tmp = Float64(z * Float64(y * 6.0)); elseif (z <= 0.17) tmp = x; elseif (z <= 2.3e+114) tmp = Float64(-6.0 * Float64(x * z)); else tmp = Float64(6.0 * Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2.5e-33) tmp = z * (y * 6.0); elseif (z <= 0.17) tmp = x; elseif (z <= 2.3e+114) tmp = -6.0 * (x * z); else tmp = 6.0 * (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.5e-33], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.17], x, If[LessEqual[z, 2.3e+114], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{-33}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{+114}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if z < -2.50000000000000014e-33Initial program 99.8%
Taylor expanded in y around inf 93.7%
Taylor expanded in z around 0 85.1%
Taylor expanded in z around inf 82.7%
Taylor expanded in y around inf 56.7%
associate-*r*56.8%
*-commutative56.8%
Simplified56.8%
if -2.50000000000000014e-33 < z < 0.170000000000000012Initial program 99.2%
Taylor expanded in z around 0 77.4%
if 0.170000000000000012 < z < 2.3e114Initial program 99.7%
Taylor expanded in x around inf 71.8%
+-commutative71.8%
Simplified71.8%
Taylor expanded in z around inf 64.8%
Taylor expanded in x around 0 64.8%
if 2.3e114 < z Initial program 99.7%
Taylor expanded in y around inf 95.0%
Taylor expanded in z around 0 90.2%
Taylor expanded in z around inf 90.2%
Taylor expanded in y around inf 75.8%
Final simplification70.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))))
(if (<= z -4.8e-35)
t_0
(if (<= z 0.17) x (if (<= z 1.8e+114) (* -6.0 (* x z)) t_0)))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double tmp;
if (z <= -4.8e-35) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else if (z <= 1.8e+114) {
tmp = -6.0 * (x * z);
} else {
tmp = t_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 <= (-4.8d-35)) then
tmp = t_0
else if (z <= 0.17d0) then
tmp = x
else if (z <= 1.8d+114) then
tmp = (-6.0d0) * (x * z)
else
tmp = t_0
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 <= -4.8e-35) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else if (z <= 1.8e+114) {
tmp = -6.0 * (x * z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) tmp = 0 if z <= -4.8e-35: tmp = t_0 elif z <= 0.17: tmp = x elif z <= 1.8e+114: tmp = -6.0 * (x * z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -4.8e-35) tmp = t_0; elseif (z <= 0.17) tmp = x; elseif (z <= 1.8e+114) tmp = Float64(-6.0 * Float64(x * z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * (y * z); tmp = 0.0; if (z <= -4.8e-35) tmp = t_0; elseif (z <= 0.17) tmp = x; elseif (z <= 1.8e+114) tmp = -6.0 * (x * z); else tmp = t_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, -4.8e-35], t$95$0, If[LessEqual[z, 0.17], x, If[LessEqual[z, 1.8e+114], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -4.8 \cdot 10^{-35}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+114}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -4.8000000000000003e-35 or 1.8e114 < z Initial program 99.8%
Taylor expanded in y around inf 94.1%
Taylor expanded in z around 0 86.9%
Taylor expanded in z around inf 85.2%
Taylor expanded in y around inf 63.2%
if -4.8000000000000003e-35 < z < 0.170000000000000012Initial program 99.2%
Taylor expanded in z around 0 77.4%
if 0.170000000000000012 < z < 1.8e114Initial program 99.7%
Taylor expanded in x around inf 71.8%
+-commutative71.8%
Simplified71.8%
Taylor expanded in z around inf 64.8%
Taylor expanded in x around 0 64.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.9e-77) (not (<= y 4.5e-66))) (+ x (* y (* 6.0 z))) (+ x (* z (* x -6.0)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.9e-77) || !(y <= 4.5e-66)) {
tmp = x + (y * (6.0 * 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 ((y <= (-3.9d-77)) .or. (.not. (y <= 4.5d-66))) then
tmp = x + (y * (6.0d0 * 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 ((y <= -3.9e-77) || !(y <= 4.5e-66)) {
tmp = x + (y * (6.0 * z));
} else {
tmp = x + (z * (x * -6.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3.9e-77) or not (y <= 4.5e-66): tmp = x + (y * (6.0 * z)) else: tmp = x + (z * (x * -6.0)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3.9e-77) || !(y <= 4.5e-66)) tmp = Float64(x + Float64(y * Float64(6.0 * 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 ((y <= -3.9e-77) || ~((y <= 4.5e-66))) tmp = x + (y * (6.0 * z)); else tmp = x + (z * (x * -6.0)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.9e-77], N[Not[LessEqual[y, 4.5e-66]], $MachinePrecision]], N[(x + N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.9 \cdot 10^{-77} \lor \neg \left(y \leq 4.5 \cdot 10^{-66}\right):\\
\;\;\;\;x + y \cdot \left(6 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(x \cdot -6\right)\\
\end{array}
\end{array}
if y < -3.89999999999999979e-77 or 4.4999999999999998e-66 < y Initial program 99.3%
Taylor expanded in y around inf 92.2%
*-commutative92.2%
associate-*r*92.2%
Simplified92.2%
if -3.89999999999999979e-77 < y < 4.4999999999999998e-66Initial program 99.8%
Taylor expanded in y around 0 87.0%
associate-*r*87.0%
Simplified87.0%
Final simplification90.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -7.4e-85) (not (<= y 5e-65))) (+ x (* y (* 6.0 z))) (+ x (* -6.0 (* x z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -7.4e-85) || !(y <= 5e-65)) {
tmp = x + (y * (6.0 * z));
} 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 ((y <= (-7.4d-85)) .or. (.not. (y <= 5d-65))) then
tmp = x + (y * (6.0d0 * z))
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 ((y <= -7.4e-85) || !(y <= 5e-65)) {
tmp = x + (y * (6.0 * z));
} else {
tmp = x + (-6.0 * (x * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -7.4e-85) or not (y <= 5e-65): tmp = x + (y * (6.0 * z)) else: tmp = x + (-6.0 * (x * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -7.4e-85) || !(y <= 5e-65)) tmp = Float64(x + Float64(y * Float64(6.0 * z))); 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 ((y <= -7.4e-85) || ~((y <= 5e-65))) tmp = x + (y * (6.0 * z)); else tmp = x + (-6.0 * (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -7.4e-85], N[Not[LessEqual[y, 5e-65]], $MachinePrecision]], N[(x + N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.4 \cdot 10^{-85} \lor \neg \left(y \leq 5 \cdot 10^{-65}\right):\\
\;\;\;\;x + y \cdot \left(6 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if y < -7.39999999999999966e-85 or 4.99999999999999983e-65 < y Initial program 99.3%
Taylor expanded in y around inf 92.2%
*-commutative92.2%
associate-*r*92.2%
Simplified92.2%
if -7.39999999999999966e-85 < y < 4.99999999999999983e-65Initial program 99.8%
Taylor expanded in y around 0 87.0%
Final simplification90.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.75e-81) (not (<= y 6.6e-66))) (+ x (* 6.0 (* y z))) (+ x (* -6.0 (* x z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.75e-81) || !(y <= 6.6e-66)) {
tmp = x + (6.0 * (y * z));
} 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 ((y <= (-2.75d-81)) .or. (.not. (y <= 6.6d-66))) then
tmp = x + (6.0d0 * (y * z))
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 ((y <= -2.75e-81) || !(y <= 6.6e-66)) {
tmp = x + (6.0 * (y * z));
} else {
tmp = x + (-6.0 * (x * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.75e-81) or not (y <= 6.6e-66): tmp = x + (6.0 * (y * z)) else: tmp = x + (-6.0 * (x * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.75e-81) || !(y <= 6.6e-66)) tmp = Float64(x + Float64(6.0 * Float64(y * z))); 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 ((y <= -2.75e-81) || ~((y <= 6.6e-66))) tmp = x + (6.0 * (y * z)); else tmp = x + (-6.0 * (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.75e-81], N[Not[LessEqual[y, 6.6e-66]], $MachinePrecision]], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.75 \cdot 10^{-81} \lor \neg \left(y \leq 6.6 \cdot 10^{-66}\right):\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if y < -2.75000000000000013e-81 or 6.5999999999999998e-66 < y Initial program 99.3%
Taylor expanded in y around inf 92.2%
*-commutative92.2%
Simplified92.2%
if -2.75000000000000013e-81 < y < 6.5999999999999998e-66Initial program 99.8%
Taylor expanded in y around 0 87.0%
Final simplification90.0%
(FPCore (x y z) :precision binary64 (if (<= y -6.5e-78) (+ x (* y (* 6.0 z))) (if (<= y 8.2e-66) (+ x (* z (* x -6.0))) (+ x (* z (* y 6.0))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -6.5e-78) {
tmp = x + (y * (6.0 * z));
} else if (y <= 8.2e-66) {
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 (y <= (-6.5d-78)) then
tmp = x + (y * (6.0d0 * z))
else if (y <= 8.2d-66) 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 (y <= -6.5e-78) {
tmp = x + (y * (6.0 * z));
} else if (y <= 8.2e-66) {
tmp = x + (z * (x * -6.0));
} else {
tmp = x + (z * (y * 6.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -6.5e-78: tmp = x + (y * (6.0 * z)) elif y <= 8.2e-66: tmp = x + (z * (x * -6.0)) else: tmp = x + (z * (y * 6.0)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -6.5e-78) tmp = Float64(x + Float64(y * Float64(6.0 * z))); elseif (y <= 8.2e-66) 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 (y <= -6.5e-78) tmp = x + (y * (6.0 * z)); elseif (y <= 8.2e-66) tmp = x + (z * (x * -6.0)); else tmp = x + (z * (y * 6.0)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -6.5e-78], N[(x + N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.2e-66], 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}\;y \leq -6.5 \cdot 10^{-78}:\\
\;\;\;\;x + y \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{-66}:\\
\;\;\;\;x + z \cdot \left(x \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y \cdot 6\right)\\
\end{array}
\end{array}
if y < -6.5000000000000003e-78Initial program 98.8%
Taylor expanded in y around inf 90.8%
*-commutative90.8%
associate-*r*90.9%
Simplified90.9%
if -6.5000000000000003e-78 < y < 8.19999999999999996e-66Initial program 99.8%
Taylor expanded in y around 0 87.0%
associate-*r*87.0%
Simplified87.0%
if 8.19999999999999996e-66 < y Initial program 99.8%
Taylor expanded in y around inf 93.9%
Final simplification90.0%
(FPCore (x y z) :precision binary64 (if (<= y -1.35e+161) (* y (* 6.0 z)) (if (<= y 3.05e-30) (+ x (* -6.0 (* x z))) (* z (* y 6.0)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.35e+161) {
tmp = y * (6.0 * z);
} else if (y <= 3.05e-30) {
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 (y <= (-1.35d+161)) then
tmp = y * (6.0d0 * z)
else if (y <= 3.05d-30) 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 (y <= -1.35e+161) {
tmp = y * (6.0 * z);
} else if (y <= 3.05e-30) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = z * (y * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.35e+161: tmp = y * (6.0 * z) elif y <= 3.05e-30: tmp = x + (-6.0 * (x * z)) else: tmp = z * (y * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.35e+161) tmp = Float64(y * Float64(6.0 * z)); elseif (y <= 3.05e-30) 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 (y <= -1.35e+161) tmp = y * (6.0 * z); elseif (y <= 3.05e-30) tmp = x + (-6.0 * (x * z)); else tmp = z * (y * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.35e+161], N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.05e-30], 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}\;y \leq -1.35 \cdot 10^{+161}:\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;y \leq 3.05 \cdot 10^{-30}:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\end{array}
\end{array}
if y < -1.3499999999999999e161Initial program 99.8%
Taylor expanded in y around inf 99.8%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 91.8%
Taylor expanded in y around inf 91.7%
*-commutative91.7%
associate-*r*91.8%
Simplified91.8%
if -1.3499999999999999e161 < y < 3.0499999999999999e-30Initial program 99.3%
Taylor expanded in y around 0 79.8%
if 3.0499999999999999e-30 < y Initial program 99.8%
Taylor expanded in y around inf 99.8%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 75.2%
Taylor expanded in y around inf 70.2%
associate-*r*70.4%
*-commutative70.4%
Simplified70.4%
Final simplification79.2%
(FPCore (x y z) :precision binary64 (if (<= y -8e+160) (* y (* 6.0 z)) (if (<= y 1.5e-46) (* x (+ (* z -6.0) 1.0)) (* z (* y 6.0)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -8e+160) {
tmp = y * (6.0 * z);
} else if (y <= 1.5e-46) {
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 (y <= (-8d+160)) then
tmp = y * (6.0d0 * z)
else if (y <= 1.5d-46) 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 (y <= -8e+160) {
tmp = y * (6.0 * z);
} else if (y <= 1.5e-46) {
tmp = x * ((z * -6.0) + 1.0);
} else {
tmp = z * (y * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -8e+160: tmp = y * (6.0 * z) elif y <= 1.5e-46: tmp = x * ((z * -6.0) + 1.0) else: tmp = z * (y * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -8e+160) tmp = Float64(y * Float64(6.0 * z)); elseif (y <= 1.5e-46) 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 (y <= -8e+160) tmp = y * (6.0 * z); elseif (y <= 1.5e-46) tmp = x * ((z * -6.0) + 1.0); else tmp = z * (y * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -8e+160], N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.5e-46], 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}\;y \leq -8 \cdot 10^{+160}:\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{-46}:\\
\;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\end{array}
\end{array}
if y < -8.00000000000000005e160Initial program 99.8%
Taylor expanded in y around inf 99.8%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 91.8%
Taylor expanded in y around inf 91.7%
*-commutative91.7%
associate-*r*91.8%
Simplified91.8%
if -8.00000000000000005e160 < y < 1.49999999999999994e-46Initial program 99.3%
Taylor expanded in x around inf 80.2%
+-commutative80.2%
Simplified80.2%
if 1.49999999999999994e-46 < y Initial program 99.8%
Taylor expanded in y around inf 99.8%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 76.0%
Taylor expanded in y around inf 69.6%
associate-*r*69.7%
*-commutative69.7%
Simplified69.7%
Final simplification79.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.17) (not (<= z 0.17))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.17) || !(z <= 0.17)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-0.17d0)) .or. (.not. (z <= 0.17d0))) then
tmp = (-6.0d0) * (x * z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.17) || !(z <= 0.17)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.17) or not (z <= 0.17): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.17) || !(z <= 0.17)) tmp = Float64(-6.0 * Float64(x * z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.17) || ~((z <= 0.17))) tmp = -6.0 * (x * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.17], N[Not[LessEqual[z, 0.17]], $MachinePrecision]], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.17 \lor \neg \left(z \leq 0.17\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.170000000000000012 or 0.170000000000000012 < z Initial program 99.8%
Taylor expanded in x around inf 50.9%
+-commutative50.9%
Simplified50.9%
Taylor expanded in z around inf 49.8%
Taylor expanded in x around 0 49.9%
if -0.170000000000000012 < z < 0.170000000000000012Initial program 99.3%
Taylor expanded in z around 0 74.6%
Final simplification62.0%
(FPCore (x y z) :precision binary64 (+ x (* (- y x) (* 6.0 z))))
double code(double x, double y, double z) {
return x + ((y - x) * (6.0 * z));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + ((y - x) * (6.0d0 * z))
end function
public static double code(double x, double y, double z) {
return x + ((y - x) * (6.0 * z));
}
def code(x, y, z): return x + ((y - x) * (6.0 * z))
function code(x, y, z) return Float64(x + Float64(Float64(y - x) * Float64(6.0 * z))) end
function tmp = code(x, y, z) tmp = x + ((y - x) * (6.0 * z)); end
code[x_, y_, z_] := N[(x + N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \left(6 \cdot z\right)
\end{array}
Initial program 99.5%
associate-*l*99.8%
Simplified99.8%
(FPCore (x y z) :precision binary64 (+ x (* z (* (- y x) 6.0))))
double code(double x, double y, double z) {
return x + (z * ((y - x) * 6.0));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (z * ((y - x) * 6.0d0))
end function
public static double code(double x, double y, double z) {
return x + (z * ((y - x) * 6.0));
}
def code(x, y, z): return x + (z * ((y - x) * 6.0))
function code(x, y, z) return Float64(x + Float64(z * Float64(Float64(y - x) * 6.0))) end
function tmp = code(x, y, z) tmp = x + (z * ((y - x) * 6.0)); end
code[x_, y_, z_] := N[(x + N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + z \cdot \left(\left(y - x\right) \cdot 6\right)
\end{array}
Initial program 99.5%
Final simplification99.5%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.5%
Taylor expanded in z around 0 38.4%
(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 2024101
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
:precision binary64
:alt
(- x (* (* 6.0 z) (- x y)))
(+ x (* (* (- y x) 6.0) z)))