
(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(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
(let* ((t_0 (* 6.0 (* y z))) (t_1 (* -6.0 (* x z))))
(if (<= z -1.2e+147)
t_0
(if (<= z -0.165)
t_1
(if (<= z 0.032)
x
(if (or (<= z 6.6e+121) (not (<= z 1.36e+144))) 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.2e+147) {
tmp = t_0;
} else if (z <= -0.165) {
tmp = t_1;
} else if (z <= 0.032) {
tmp = x;
} else if ((z <= 6.6e+121) || !(z <= 1.36e+144)) {
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.2d+147)) then
tmp = t_0
else if (z <= (-0.165d0)) then
tmp = t_1
else if (z <= 0.032d0) then
tmp = x
else if ((z <= 6.6d+121) .or. (.not. (z <= 1.36d+144))) 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.2e+147) {
tmp = t_0;
} else if (z <= -0.165) {
tmp = t_1;
} else if (z <= 0.032) {
tmp = x;
} else if ((z <= 6.6e+121) || !(z <= 1.36e+144)) {
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.2e+147: tmp = t_0 elif z <= -0.165: tmp = t_1 elif z <= 0.032: tmp = x elif (z <= 6.6e+121) or not (z <= 1.36e+144): 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.2e+147) tmp = t_0; elseif (z <= -0.165) tmp = t_1; elseif (z <= 0.032) tmp = x; elseif ((z <= 6.6e+121) || !(z <= 1.36e+144)) 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.2e+147) tmp = t_0; elseif (z <= -0.165) tmp = t_1; elseif (z <= 0.032) tmp = x; elseif ((z <= 6.6e+121) || ~((z <= 1.36e+144))) 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.2e+147], t$95$0, If[LessEqual[z, -0.165], t$95$1, If[LessEqual[z, 0.032], x, If[Or[LessEqual[z, 6.6e+121], N[Not[LessEqual[z, 1.36e+144]], $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.2 \cdot 10^{+147}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -0.165:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 0.032:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{+121} \lor \neg \left(z \leq 1.36 \cdot 10^{+144}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -1.20000000000000001e147 or 0.032000000000000001 < z < 6.59999999999999958e121 or 1.35999999999999993e144 < z Initial program 99.7%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.9%
fma-def99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 67.2%
*-commutative67.2%
Simplified67.2%
if -1.20000000000000001e147 < z < -0.165000000000000008 or 6.59999999999999958e121 < z < 1.35999999999999993e144Initial program 99.5%
Taylor expanded in x around inf 74.1%
Taylor expanded in z around inf 69.7%
Taylor expanded in z around 0 69.5%
if -0.165000000000000008 < z < 0.032000000000000001Initial program 99.9%
Taylor expanded in z around 0 71.0%
Final simplification69.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))) (t_1 (* -6.0 (* x z))))
(if (<= z -2.45e+148)
t_0
(if (<= z -0.165)
t_1
(if (<= z 0.032)
x
(if (<= z 1.18e+126)
(* y (* 6.0 z))
(if (<= z 1.3e+144) t_1 t_0)))))))
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 <= -2.45e+148) {
tmp = t_0;
} else if (z <= -0.165) {
tmp = t_1;
} else if (z <= 0.032) {
tmp = x;
} else if (z <= 1.18e+126) {
tmp = y * (6.0 * z);
} else if (z <= 1.3e+144) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_0 = 6.0d0 * (y * z)
t_1 = (-6.0d0) * (x * z)
if (z <= (-2.45d+148)) then
tmp = t_0
else if (z <= (-0.165d0)) then
tmp = t_1
else if (z <= 0.032d0) then
tmp = x
else if (z <= 1.18d+126) then
tmp = y * (6.0d0 * z)
else if (z <= 1.3d+144) then
tmp = t_1
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 t_1 = -6.0 * (x * z);
double tmp;
if (z <= -2.45e+148) {
tmp = t_0;
} else if (z <= -0.165) {
tmp = t_1;
} else if (z <= 0.032) {
tmp = x;
} else if (z <= 1.18e+126) {
tmp = y * (6.0 * z);
} else if (z <= 1.3e+144) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) t_1 = -6.0 * (x * z) tmp = 0 if z <= -2.45e+148: tmp = t_0 elif z <= -0.165: tmp = t_1 elif z <= 0.032: tmp = x elif z <= 1.18e+126: tmp = y * (6.0 * z) elif z <= 1.3e+144: tmp = t_1 else: tmp = t_0 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 <= -2.45e+148) tmp = t_0; elseif (z <= -0.165) tmp = t_1; elseif (z <= 0.032) tmp = x; elseif (z <= 1.18e+126) tmp = Float64(y * Float64(6.0 * z)); elseif (z <= 1.3e+144) tmp = t_1; else tmp = t_0; 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 <= -2.45e+148) tmp = t_0; elseif (z <= -0.165) tmp = t_1; elseif (z <= 0.032) tmp = x; elseif (z <= 1.18e+126) tmp = y * (6.0 * z); elseif (z <= 1.3e+144) tmp = t_1; 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]}, Block[{t$95$1 = N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.45e+148], t$95$0, If[LessEqual[z, -0.165], t$95$1, If[LessEqual[z, 0.032], x, If[LessEqual[z, 1.18e+126], N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.3e+144], t$95$1, t$95$0]]]]]]]
\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 -2.45 \cdot 10^{+148}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -0.165:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 0.032:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.18 \cdot 10^{+126}:\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{+144}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -2.45e148 or 1.2999999999999999e144 < z Initial program 99.8%
associate-*r*99.9%
+-commutative99.9%
*-commutative99.9%
associate-*r*99.9%
fma-def99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 69.0%
*-commutative69.0%
Simplified69.0%
if -2.45e148 < z < -0.165000000000000008 or 1.18e126 < z < 1.2999999999999999e144Initial program 99.5%
Taylor expanded in x around inf 74.1%
Taylor expanded in z around inf 69.7%
Taylor expanded in z around 0 69.5%
if -0.165000000000000008 < z < 0.032000000000000001Initial program 99.9%
Taylor expanded in z around 0 71.0%
if 0.032000000000000001 < z < 1.18e126Initial program 99.4%
associate-*r*99.6%
+-commutative99.6%
*-commutative99.6%
associate-*r*99.8%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 62.5%
*-commutative62.5%
associate-*r*62.5%
Simplified62.5%
Final simplification69.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))) (t_1 (* x (* z -6.0))))
(if (<= z -1.45e+147)
t_0
(if (<= z -0.165)
t_1
(if (<= z 0.032)
x
(if (<= z 2.9e+117) (* y (* 6.0 z)) (if (<= z 6.5e+144) t_1 t_0)))))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double t_1 = x * (z * -6.0);
double tmp;
if (z <= -1.45e+147) {
tmp = t_0;
} else if (z <= -0.165) {
tmp = t_1;
} else if (z <= 0.032) {
tmp = x;
} else if (z <= 2.9e+117) {
tmp = y * (6.0 * z);
} else if (z <= 6.5e+144) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_0 = 6.0d0 * (y * z)
t_1 = x * (z * (-6.0d0))
if (z <= (-1.45d+147)) then
tmp = t_0
else if (z <= (-0.165d0)) then
tmp = t_1
else if (z <= 0.032d0) then
tmp = x
else if (z <= 2.9d+117) then
tmp = y * (6.0d0 * z)
else if (z <= 6.5d+144) then
tmp = t_1
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 t_1 = x * (z * -6.0);
double tmp;
if (z <= -1.45e+147) {
tmp = t_0;
} else if (z <= -0.165) {
tmp = t_1;
} else if (z <= 0.032) {
tmp = x;
} else if (z <= 2.9e+117) {
tmp = y * (6.0 * z);
} else if (z <= 6.5e+144) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) t_1 = x * (z * -6.0) tmp = 0 if z <= -1.45e+147: tmp = t_0 elif z <= -0.165: tmp = t_1 elif z <= 0.032: tmp = x elif z <= 2.9e+117: tmp = y * (6.0 * z) elif z <= 6.5e+144: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(y * z)) t_1 = Float64(x * Float64(z * -6.0)) tmp = 0.0 if (z <= -1.45e+147) tmp = t_0; elseif (z <= -0.165) tmp = t_1; elseif (z <= 0.032) tmp = x; elseif (z <= 2.9e+117) tmp = Float64(y * Float64(6.0 * z)); elseif (z <= 6.5e+144) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * (y * z); t_1 = x * (z * -6.0); tmp = 0.0; if (z <= -1.45e+147) tmp = t_0; elseif (z <= -0.165) tmp = t_1; elseif (z <= 0.032) tmp = x; elseif (z <= 2.9e+117) tmp = y * (6.0 * z); elseif (z <= 6.5e+144) tmp = t_1; 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]}, Block[{t$95$1 = N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.45e+147], t$95$0, If[LessEqual[z, -0.165], t$95$1, If[LessEqual[z, 0.032], x, If[LessEqual[z, 2.9e+117], N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.5e+144], t$95$1, t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot z\right)\\
t_1 := x \cdot \left(z \cdot -6\right)\\
\mathbf{if}\;z \leq -1.45 \cdot 10^{+147}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -0.165:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 0.032:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+117}:\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{+144}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -1.4499999999999999e147 or 6.50000000000000007e144 < z Initial program 99.8%
associate-*r*99.9%
+-commutative99.9%
*-commutative99.9%
associate-*r*99.9%
fma-def99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 69.0%
*-commutative69.0%
Simplified69.0%
if -1.4499999999999999e147 < z < -0.165000000000000008 or 2.90000000000000027e117 < z < 6.50000000000000007e144Initial program 99.5%
Taylor expanded in x around inf 74.1%
Taylor expanded in z around inf 69.7%
if -0.165000000000000008 < z < 0.032000000000000001Initial program 99.9%
Taylor expanded in z around 0 71.0%
if 0.032000000000000001 < z < 2.90000000000000027e117Initial program 99.4%
associate-*r*99.6%
+-commutative99.6%
*-commutative99.6%
associate-*r*99.8%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 62.5%
*-commutative62.5%
associate-*r*62.5%
Simplified62.5%
Final simplification69.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.6e-15) (not (<= z 0.032))) (* 6.0 (* (- y x) z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.6e-15) || !(z <= 0.032)) {
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.6d-15)) .or. (.not. (z <= 0.032d0))) 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.6e-15) || !(z <= 0.032)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.6e-15) or not (z <= 0.032): tmp = 6.0 * ((y - x) * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.6e-15) || !(z <= 0.032)) 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.6e-15) || ~((z <= 0.032))) tmp = 6.0 * ((y - x) * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.6e-15], N[Not[LessEqual[z, 0.032]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{-15} \lor \neg \left(z \leq 0.032\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.6000000000000001e-15 or 0.032000000000000001 < z Initial program 99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 97.4%
if -3.6000000000000001e-15 < z < 0.032000000000000001Initial program 99.9%
Taylor expanded in z around 0 71.5%
Final simplification85.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -8.5e-7) (not (<= z 54000000000.0))) (* 6.0 (* (- y x) z)) (* x (+ 1.0 (* z -6.0)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -8.5e-7) || !(z <= 54000000000.0)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x * (1.0 + (z * -6.0));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-8.5d-7)) .or. (.not. (z <= 54000000000.0d0))) then
tmp = 6.0d0 * ((y - x) * z)
else
tmp = x * (1.0d0 + (z * (-6.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -8.5e-7) || !(z <= 54000000000.0)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x * (1.0 + (z * -6.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -8.5e-7) or not (z <= 54000000000.0): tmp = 6.0 * ((y - x) * z) else: tmp = x * (1.0 + (z * -6.0)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -8.5e-7) || !(z <= 54000000000.0)) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); else tmp = Float64(x * Float64(1.0 + Float64(z * -6.0))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -8.5e-7) || ~((z <= 54000000000.0))) tmp = 6.0 * ((y - x) * z); else tmp = x * (1.0 + (z * -6.0)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -8.5e-7], N[Not[LessEqual[z, 54000000000.0]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{-7} \lor \neg \left(z \leq 54000000000\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + z \cdot -6\right)\\
\end{array}
\end{array}
if z < -8.50000000000000014e-7 or 5.4e10 < z Initial program 99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 98.4%
if -8.50000000000000014e-7 < z < 5.4e10Initial program 99.9%
Taylor expanded in x around inf 73.0%
Final simplification86.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.165) (not (<= z 0.17))) (* 6.0 (* (- y x) z)) (+ x (* 6.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.165) || !(z <= 0.17)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-0.165d0)) .or. (.not. (z <= 0.17d0))) then
tmp = 6.0d0 * ((y - x) * z)
else
tmp = x + (6.0d0 * (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.165) || !(z <= 0.17)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.165) or not (z <= 0.17): tmp = 6.0 * ((y - x) * z) else: tmp = x + (6.0 * (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.165) || !(z <= 0.17)) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); else tmp = Float64(x + Float64(6.0 * Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.165) || ~((z <= 0.17))) tmp = 6.0 * ((y - x) * z); else tmp = x + (6.0 * (y * z)); 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[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.165 \lor \neg \left(z \leq 0.17\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if z < -0.165000000000000008 or 0.170000000000000012 < z Initial program 99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 97.4%
if -0.165000000000000008 < z < 0.170000000000000012Initial program 99.9%
Taylor expanded in y around inf 99.0%
Final simplification98.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.145) (not (<= z 0.17))) (* 6.0 (* (- y x) z)) (+ x (* z (* y 6.0)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.145) || !(z <= 0.17)) {
tmp = 6.0 * ((y - x) * z);
} 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 ((z <= (-0.145d0)) .or. (.not. (z <= 0.17d0))) then
tmp = 6.0d0 * ((y - x) * z)
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 ((z <= -0.145) || !(z <= 0.17)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x + (z * (y * 6.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.145) or not (z <= 0.17): tmp = 6.0 * ((y - x) * z) else: tmp = x + (z * (y * 6.0)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.145) || !(z <= 0.17)) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); 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 ((z <= -0.145) || ~((z <= 0.17))) tmp = 6.0 * ((y - x) * z); else tmp = x + (z * (y * 6.0)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.145], N[Not[LessEqual[z, 0.17]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.145 \lor \neg \left(z \leq 0.17\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y \cdot 6\right)\\
\end{array}
\end{array}
if z < -0.14499999999999999 or 0.170000000000000012 < z Initial program 99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 97.4%
if -0.14499999999999999 < z < 0.170000000000000012Initial program 99.9%
Taylor expanded in y around inf 99.0%
associate-*r*99.0%
Simplified99.0%
Final simplification98.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.7%
Taylor expanded in x around inf 54.1%
Taylor expanded in z around inf 51.7%
Taylor expanded in z around 0 51.7%
if -0.165000000000000008 < z < 0.170000000000000012Initial program 99.9%
Taylor expanded in z around 0 71.0%
Final simplification60.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.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 35.4%
Final simplification35.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 2023200
(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)))