
(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 12 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.9%
associate-*l*99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))) (t_1 (* -6.0 (* x z))))
(if (<= z -4.9e+241)
t_0
(if (<= z -1.3e+130)
t_1
(if (<= z -1.55e+71)
t_0
(if (<= z -3700.0)
t_1
(if (<= z 0.065) x (if (<= z 2.1e+216) 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 <= -4.9e+241) {
tmp = t_0;
} else if (z <= -1.3e+130) {
tmp = t_1;
} else if (z <= -1.55e+71) {
tmp = t_0;
} else if (z <= -3700.0) {
tmp = t_1;
} else if (z <= 0.065) {
tmp = x;
} else if (z <= 2.1e+216) {
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 <= (-4.9d+241)) then
tmp = t_0
else if (z <= (-1.3d+130)) then
tmp = t_1
else if (z <= (-1.55d+71)) then
tmp = t_0
else if (z <= (-3700.0d0)) then
tmp = t_1
else if (z <= 0.065d0) then
tmp = x
else if (z <= 2.1d+216) 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 <= -4.9e+241) {
tmp = t_0;
} else if (z <= -1.3e+130) {
tmp = t_1;
} else if (z <= -1.55e+71) {
tmp = t_0;
} else if (z <= -3700.0) {
tmp = t_1;
} else if (z <= 0.065) {
tmp = x;
} else if (z <= 2.1e+216) {
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 <= -4.9e+241: tmp = t_0 elif z <= -1.3e+130: tmp = t_1 elif z <= -1.55e+71: tmp = t_0 elif z <= -3700.0: tmp = t_1 elif z <= 0.065: tmp = x elif z <= 2.1e+216: 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 <= -4.9e+241) tmp = t_0; elseif (z <= -1.3e+130) tmp = t_1; elseif (z <= -1.55e+71) tmp = t_0; elseif (z <= -3700.0) tmp = t_1; elseif (z <= 0.065) tmp = x; elseif (z <= 2.1e+216) 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 <= -4.9e+241) tmp = t_0; elseif (z <= -1.3e+130) tmp = t_1; elseif (z <= -1.55e+71) tmp = t_0; elseif (z <= -3700.0) tmp = t_1; elseif (z <= 0.065) tmp = x; elseif (z <= 2.1e+216) 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, -4.9e+241], t$95$0, If[LessEqual[z, -1.3e+130], t$95$1, If[LessEqual[z, -1.55e+71], t$95$0, If[LessEqual[z, -3700.0], t$95$1, If[LessEqual[z, 0.065], x, If[LessEqual[z, 2.1e+216], 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 -4.9 \cdot 10^{+241}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.3 \cdot 10^{+130}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.55 \cdot 10^{+71}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -3700:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.065:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{+216}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.89999999999999972e241 or -1.2999999999999999e130 < z < -1.55000000000000009e71 or 0.065000000000000002 < z < 2.10000000000000001e216Initial program 99.8%
Taylor expanded in x around 0 94.7%
Taylor expanded in y around inf 64.4%
*-commutative64.4%
Simplified64.4%
if -4.89999999999999972e241 < z < -1.2999999999999999e130 or -1.55000000000000009e71 < z < -3700 or 2.10000000000000001e216 < z Initial program 99.7%
+-commutative99.7%
*-commutative99.7%
fma-define99.8%
remove-double-neg99.8%
distribute-lft-neg-in99.8%
distribute-rgt-neg-in99.8%
sub-neg99.8%
distribute-neg-in99.8%
remove-double-neg99.8%
+-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around inf 97.1%
Taylor expanded in x around inf 65.8%
if -3700 < z < 0.065000000000000002Initial program 100.0%
Taylor expanded in z around 0 79.5%
Final simplification71.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))) (t_1 (* x (* z -6.0))))
(if (<= z -3.1e+241)
t_0
(if (<= z -1.1e+130)
(* -6.0 (* x z))
(if (<= z -1.26e+70)
t_0
(if (<= z -3700.0)
t_1
(if (<= z 0.065) x (if (<= z 4.5e+215) t_0 t_1))))))))
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 <= -3.1e+241) {
tmp = t_0;
} else if (z <= -1.1e+130) {
tmp = -6.0 * (x * z);
} else if (z <= -1.26e+70) {
tmp = t_0;
} else if (z <= -3700.0) {
tmp = t_1;
} else if (z <= 0.065) {
tmp = x;
} else if (z <= 4.5e+215) {
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 = x * (z * (-6.0d0))
if (z <= (-3.1d+241)) then
tmp = t_0
else if (z <= (-1.1d+130)) then
tmp = (-6.0d0) * (x * z)
else if (z <= (-1.26d+70)) then
tmp = t_0
else if (z <= (-3700.0d0)) then
tmp = t_1
else if (z <= 0.065d0) then
tmp = x
else if (z <= 4.5d+215) 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 = x * (z * -6.0);
double tmp;
if (z <= -3.1e+241) {
tmp = t_0;
} else if (z <= -1.1e+130) {
tmp = -6.0 * (x * z);
} else if (z <= -1.26e+70) {
tmp = t_0;
} else if (z <= -3700.0) {
tmp = t_1;
} else if (z <= 0.065) {
tmp = x;
} else if (z <= 4.5e+215) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) t_1 = x * (z * -6.0) tmp = 0 if z <= -3.1e+241: tmp = t_0 elif z <= -1.1e+130: tmp = -6.0 * (x * z) elif z <= -1.26e+70: tmp = t_0 elif z <= -3700.0: tmp = t_1 elif z <= 0.065: tmp = x elif z <= 4.5e+215: 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(x * Float64(z * -6.0)) tmp = 0.0 if (z <= -3.1e+241) tmp = t_0; elseif (z <= -1.1e+130) tmp = Float64(-6.0 * Float64(x * z)); elseif (z <= -1.26e+70) tmp = t_0; elseif (z <= -3700.0) tmp = t_1; elseif (z <= 0.065) tmp = x; elseif (z <= 4.5e+215) 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 = x * (z * -6.0); tmp = 0.0; if (z <= -3.1e+241) tmp = t_0; elseif (z <= -1.1e+130) tmp = -6.0 * (x * z); elseif (z <= -1.26e+70) tmp = t_0; elseif (z <= -3700.0) tmp = t_1; elseif (z <= 0.065) tmp = x; elseif (z <= 4.5e+215) 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[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.1e+241], t$95$0, If[LessEqual[z, -1.1e+130], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.26e+70], t$95$0, If[LessEqual[z, -3700.0], t$95$1, If[LessEqual[z, 0.065], x, If[LessEqual[z, 4.5e+215], t$95$0, t$95$1]]]]]]]]
\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 -3.1 \cdot 10^{+241}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.1 \cdot 10^{+130}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -1.26 \cdot 10^{+70}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -3700:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.065:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+215}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.1000000000000001e241 or -1.09999999999999997e130 < z < -1.26000000000000001e70 or 0.065000000000000002 < z < 4.5000000000000002e215Initial program 99.8%
Taylor expanded in x around 0 94.7%
Taylor expanded in y around inf 64.4%
*-commutative64.4%
Simplified64.4%
if -3.1000000000000001e241 < z < -1.09999999999999997e130Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
fma-define99.9%
remove-double-neg99.9%
distribute-lft-neg-in99.9%
distribute-rgt-neg-in99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around inf 99.9%
Taylor expanded in x around inf 70.7%
if -1.26000000000000001e70 < z < -3700 or 4.5000000000000002e215 < z Initial program 99.7%
Taylor expanded in x around 0 94.5%
Taylor expanded in z around inf 95.4%
metadata-eval95.4%
associate-*r*95.4%
neg-mul-195.4%
distribute-lft-in95.5%
sub-neg95.5%
associate-*r*95.6%
*-commutative95.6%
Simplified95.6%
Taylor expanded in x around inf 62.9%
associate-*r*62.9%
*-commutative62.9%
Simplified62.9%
Taylor expanded in z around 0 62.9%
*-commutative62.9%
associate-*l*63.0%
Simplified63.0%
if -3700 < z < 0.065000000000000002Initial program 100.0%
Taylor expanded in z around 0 79.5%
Final simplification71.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))) (t_1 (* x (* z -6.0))))
(if (<= z -3.5e+242)
t_0
(if (<= z -3.3e+130)
(* z (* x -6.0))
(if (<= z -9e+70)
t_0
(if (<= z -3700.0)
t_1
(if (<= z 0.065) x (if (<= z 9e+219) t_0 t_1))))))))
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 <= -3.5e+242) {
tmp = t_0;
} else if (z <= -3.3e+130) {
tmp = z * (x * -6.0);
} else if (z <= -9e+70) {
tmp = t_0;
} else if (z <= -3700.0) {
tmp = t_1;
} else if (z <= 0.065) {
tmp = x;
} else if (z <= 9e+219) {
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 = x * (z * (-6.0d0))
if (z <= (-3.5d+242)) then
tmp = t_0
else if (z <= (-3.3d+130)) then
tmp = z * (x * (-6.0d0))
else if (z <= (-9d+70)) then
tmp = t_0
else if (z <= (-3700.0d0)) then
tmp = t_1
else if (z <= 0.065d0) then
tmp = x
else if (z <= 9d+219) 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 = x * (z * -6.0);
double tmp;
if (z <= -3.5e+242) {
tmp = t_0;
} else if (z <= -3.3e+130) {
tmp = z * (x * -6.0);
} else if (z <= -9e+70) {
tmp = t_0;
} else if (z <= -3700.0) {
tmp = t_1;
} else if (z <= 0.065) {
tmp = x;
} else if (z <= 9e+219) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) t_1 = x * (z * -6.0) tmp = 0 if z <= -3.5e+242: tmp = t_0 elif z <= -3.3e+130: tmp = z * (x * -6.0) elif z <= -9e+70: tmp = t_0 elif z <= -3700.0: tmp = t_1 elif z <= 0.065: tmp = x elif z <= 9e+219: 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(x * Float64(z * -6.0)) tmp = 0.0 if (z <= -3.5e+242) tmp = t_0; elseif (z <= -3.3e+130) tmp = Float64(z * Float64(x * -6.0)); elseif (z <= -9e+70) tmp = t_0; elseif (z <= -3700.0) tmp = t_1; elseif (z <= 0.065) tmp = x; elseif (z <= 9e+219) 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 = x * (z * -6.0); tmp = 0.0; if (z <= -3.5e+242) tmp = t_0; elseif (z <= -3.3e+130) tmp = z * (x * -6.0); elseif (z <= -9e+70) tmp = t_0; elseif (z <= -3700.0) tmp = t_1; elseif (z <= 0.065) tmp = x; elseif (z <= 9e+219) 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[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.5e+242], t$95$0, If[LessEqual[z, -3.3e+130], N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -9e+70], t$95$0, If[LessEqual[z, -3700.0], t$95$1, If[LessEqual[z, 0.065], x, If[LessEqual[z, 9e+219], t$95$0, t$95$1]]]]]]]]
\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 -3.5 \cdot 10^{+242}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -3.3 \cdot 10^{+130}:\\
\;\;\;\;z \cdot \left(x \cdot -6\right)\\
\mathbf{elif}\;z \leq -9 \cdot 10^{+70}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -3700:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.065:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 9 \cdot 10^{+219}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.4999999999999999e242 or -3.3e130 < z < -8.9999999999999999e70 or 0.065000000000000002 < z < 9.00000000000000047e219Initial program 99.8%
Taylor expanded in x around 0 94.7%
Taylor expanded in y around inf 64.4%
*-commutative64.4%
Simplified64.4%
if -3.4999999999999999e242 < z < -3.3e130Initial program 99.9%
Taylor expanded in x around 0 99.7%
Taylor expanded in z around inf 99.9%
metadata-eval99.9%
associate-*r*99.9%
neg-mul-199.9%
distribute-lft-in99.9%
sub-neg99.9%
associate-*r*99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 70.7%
associate-*r*70.7%
*-commutative70.7%
Simplified70.7%
if -8.9999999999999999e70 < z < -3700 or 9.00000000000000047e219 < z Initial program 99.7%
Taylor expanded in x around 0 94.5%
Taylor expanded in z around inf 95.4%
metadata-eval95.4%
associate-*r*95.4%
neg-mul-195.4%
distribute-lft-in95.5%
sub-neg95.5%
associate-*r*95.6%
*-commutative95.6%
Simplified95.6%
Taylor expanded in x around inf 62.9%
associate-*r*62.9%
*-commutative62.9%
Simplified62.9%
Taylor expanded in z around 0 62.9%
*-commutative62.9%
associate-*l*63.0%
Simplified63.0%
if -3700 < z < 0.065000000000000002Initial program 100.0%
Taylor expanded in z around 0 79.5%
Final simplification71.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))) (t_1 (* x (* z -6.0))))
(if (<= z -1.7e+242)
t_0
(if (<= z -1.06e+130)
(* z (* x -6.0))
(if (<= z -1.06e+71)
t_0
(if (<= z -3700.0)
t_1
(if (<= z 0.065) x (if (<= z 1.2e+216) (* z (* y 6.0)) t_1))))))))
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.7e+242) {
tmp = t_0;
} else if (z <= -1.06e+130) {
tmp = z * (x * -6.0);
} else if (z <= -1.06e+71) {
tmp = t_0;
} else if (z <= -3700.0) {
tmp = t_1;
} else if (z <= 0.065) {
tmp = x;
} else if (z <= 1.2e+216) {
tmp = z * (y * 6.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 = x * (z * (-6.0d0))
if (z <= (-1.7d+242)) then
tmp = t_0
else if (z <= (-1.06d+130)) then
tmp = z * (x * (-6.0d0))
else if (z <= (-1.06d+71)) then
tmp = t_0
else if (z <= (-3700.0d0)) then
tmp = t_1
else if (z <= 0.065d0) then
tmp = x
else if (z <= 1.2d+216) then
tmp = z * (y * 6.0d0)
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 = x * (z * -6.0);
double tmp;
if (z <= -1.7e+242) {
tmp = t_0;
} else if (z <= -1.06e+130) {
tmp = z * (x * -6.0);
} else if (z <= -1.06e+71) {
tmp = t_0;
} else if (z <= -3700.0) {
tmp = t_1;
} else if (z <= 0.065) {
tmp = x;
} else if (z <= 1.2e+216) {
tmp = z * (y * 6.0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) t_1 = x * (z * -6.0) tmp = 0 if z <= -1.7e+242: tmp = t_0 elif z <= -1.06e+130: tmp = z * (x * -6.0) elif z <= -1.06e+71: tmp = t_0 elif z <= -3700.0: tmp = t_1 elif z <= 0.065: tmp = x elif z <= 1.2e+216: tmp = z * (y * 6.0) else: tmp = t_1 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.7e+242) tmp = t_0; elseif (z <= -1.06e+130) tmp = Float64(z * Float64(x * -6.0)); elseif (z <= -1.06e+71) tmp = t_0; elseif (z <= -3700.0) tmp = t_1; elseif (z <= 0.065) tmp = x; elseif (z <= 1.2e+216) tmp = Float64(z * Float64(y * 6.0)); else tmp = t_1; 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.7e+242) tmp = t_0; elseif (z <= -1.06e+130) tmp = z * (x * -6.0); elseif (z <= -1.06e+71) tmp = t_0; elseif (z <= -3700.0) tmp = t_1; elseif (z <= 0.065) tmp = x; elseif (z <= 1.2e+216) tmp = z * (y * 6.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[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.7e+242], t$95$0, If[LessEqual[z, -1.06e+130], N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.06e+71], t$95$0, If[LessEqual[z, -3700.0], t$95$1, If[LessEqual[z, 0.065], x, If[LessEqual[z, 1.2e+216], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]]
\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.7 \cdot 10^{+242}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.06 \cdot 10^{+130}:\\
\;\;\;\;z \cdot \left(x \cdot -6\right)\\
\mathbf{elif}\;z \leq -1.06 \cdot 10^{+71}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -3700:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.065:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+216}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.69999999999999991e242 or -1.06e130 < z < -1.06e71Initial program 99.8%
Taylor expanded in x around 0 93.9%
Taylor expanded in y around inf 70.4%
*-commutative70.4%
Simplified70.4%
if -1.69999999999999991e242 < z < -1.06e130Initial program 99.9%
Taylor expanded in x around 0 99.7%
Taylor expanded in z around inf 99.9%
metadata-eval99.9%
associate-*r*99.9%
neg-mul-199.9%
distribute-lft-in99.9%
sub-neg99.9%
associate-*r*99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 70.7%
associate-*r*70.7%
*-commutative70.7%
Simplified70.7%
if -1.06e71 < z < -3700 or 1.2e216 < z Initial program 99.7%
Taylor expanded in x around 0 94.5%
Taylor expanded in z around inf 95.4%
metadata-eval95.4%
associate-*r*95.4%
neg-mul-195.4%
distribute-lft-in95.5%
sub-neg95.5%
associate-*r*95.6%
*-commutative95.6%
Simplified95.6%
Taylor expanded in x around inf 62.9%
associate-*r*62.9%
*-commutative62.9%
Simplified62.9%
Taylor expanded in z around 0 62.9%
*-commutative62.9%
associate-*l*63.0%
Simplified63.0%
if -3700 < z < 0.065000000000000002Initial program 100.0%
Taylor expanded in z around 0 79.5%
if 0.065000000000000002 < z < 1.2e216Initial program 99.8%
Taylor expanded in x around 0 95.3%
Taylor expanded in y around inf 59.9%
associate-*r*60.1%
*-commutative60.1%
Simplified60.1%
Final simplification71.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.4e-14) (not (<= z 0.065))) (* -6.0 (* z (- x y))) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.4e-14) || !(z <= 0.065)) {
tmp = -6.0 * (z * (x - y));
} 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.4d-14)) .or. (.not. (z <= 0.065d0))) then
tmp = (-6.0d0) * (z * (x - y))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -3.4e-14) || !(z <= 0.065)) {
tmp = -6.0 * (z * (x - y));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.4e-14) or not (z <= 0.065): tmp = -6.0 * (z * (x - y)) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.4e-14) || !(z <= 0.065)) tmp = Float64(-6.0 * Float64(z * Float64(x - y))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -3.4e-14) || ~((z <= 0.065))) tmp = -6.0 * (z * (x - y)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.4e-14], N[Not[LessEqual[z, 0.065]], $MachinePrecision]], N[(-6.0 * N[(z * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.4 \cdot 10^{-14} \lor \neg \left(z \leq 0.065\right):\\
\;\;\;\;-6 \cdot \left(z \cdot \left(x - y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.40000000000000003e-14 or 0.065000000000000002 < z Initial program 99.8%
+-commutative99.8%
*-commutative99.8%
fma-define99.8%
remove-double-neg99.8%
distribute-lft-neg-in99.8%
distribute-rgt-neg-in99.8%
sub-neg99.8%
distribute-neg-in99.8%
remove-double-neg99.8%
+-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around inf 98.1%
if -3.40000000000000003e-14 < z < 0.065000000000000002Initial program 100.0%
Taylor expanded in z around 0 80.9%
Final simplification90.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -9.5e-11) (not (<= z 0.065))) (* (* z -6.0) (- x y)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -9.5e-11) || !(z <= 0.065)) {
tmp = (z * -6.0) * (x - y);
} 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 <= (-9.5d-11)) .or. (.not. (z <= 0.065d0))) then
tmp = (z * (-6.0d0)) * (x - y)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -9.5e-11) || !(z <= 0.065)) {
tmp = (z * -6.0) * (x - y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -9.5e-11) or not (z <= 0.065): tmp = (z * -6.0) * (x - y) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -9.5e-11) || !(z <= 0.065)) tmp = Float64(Float64(z * -6.0) * Float64(x - y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -9.5e-11) || ~((z <= 0.065))) tmp = (z * -6.0) * (x - y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -9.5e-11], N[Not[LessEqual[z, 0.065]], $MachinePrecision]], N[(N[(z * -6.0), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{-11} \lor \neg \left(z \leq 0.065\right):\\
\;\;\;\;\left(z \cdot -6\right) \cdot \left(x - y\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -9.49999999999999951e-11 or 0.065000000000000002 < z Initial program 99.8%
Taylor expanded in x around 0 95.5%
Taylor expanded in z around inf 98.2%
metadata-eval98.2%
associate-*r*98.2%
neg-mul-198.2%
distribute-lft-in98.2%
sub-neg98.2%
associate-*r*98.3%
*-commutative98.3%
Simplified98.3%
if -9.49999999999999951e-11 < z < 0.065000000000000002Initial program 100.0%
Taylor expanded in z around 0 80.9%
Final simplification90.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -6e-12) (not (<= z 70.0))) (* (* z -6.0) (- x y)) (+ x (* x (* z -6.0)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6e-12) || !(z <= 70.0)) {
tmp = (z * -6.0) * (x - y);
} else {
tmp = x + (x * (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 <= (-6d-12)) .or. (.not. (z <= 70.0d0))) then
tmp = (z * (-6.0d0)) * (x - y)
else
tmp = x + (x * (z * (-6.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -6e-12) || !(z <= 70.0)) {
tmp = (z * -6.0) * (x - y);
} else {
tmp = x + (x * (z * -6.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6e-12) or not (z <= 70.0): tmp = (z * -6.0) * (x - y) else: tmp = x + (x * (z * -6.0)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6e-12) || !(z <= 70.0)) tmp = Float64(Float64(z * -6.0) * Float64(x - y)); else tmp = Float64(x + Float64(x * Float64(z * -6.0))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -6e-12) || ~((z <= 70.0))) tmp = (z * -6.0) * (x - y); else tmp = x + (x * (z * -6.0)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6e-12], N[Not[LessEqual[z, 70.0]], $MachinePrecision]], N[(N[(z * -6.0), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{-12} \lor \neg \left(z \leq 70\right):\\
\;\;\;\;\left(z \cdot -6\right) \cdot \left(x - y\right)\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot \left(z \cdot -6\right)\\
\end{array}
\end{array}
if z < -6.0000000000000003e-12 or 70 < z Initial program 99.8%
Taylor expanded in x around 0 95.5%
Taylor expanded in z around inf 98.2%
metadata-eval98.2%
associate-*r*98.2%
neg-mul-198.2%
distribute-lft-in98.2%
sub-neg98.2%
associate-*r*98.3%
*-commutative98.3%
Simplified98.3%
if -6.0000000000000003e-12 < z < 70Initial program 100.0%
Taylor expanded in y around 0 82.6%
associate-*r*82.6%
*-commutative82.6%
associate-*r*82.6%
Simplified82.6%
Final simplification91.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.165) (not (<= z 0.17))) (* (* z -6.0) (- x y)) (+ x (* y (* 6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.165) || !(z <= 0.17)) {
tmp = (z * -6.0) * (x - y);
} else {
tmp = x + (y * (6.0 * 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 = (z * (-6.0d0)) * (x - y)
else
tmp = x + (y * (6.0d0 * 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 = (z * -6.0) * (x - y);
} else {
tmp = x + (y * (6.0 * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.165) or not (z <= 0.17): tmp = (z * -6.0) * (x - y) else: tmp = x + (y * (6.0 * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.165) || !(z <= 0.17)) tmp = Float64(Float64(z * -6.0) * Float64(x - y)); else tmp = Float64(x + Float64(y * Float64(6.0 * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.165) || ~((z <= 0.17))) tmp = (z * -6.0) * (x - y); else tmp = x + (y * (6.0 * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.165], N[Not[LessEqual[z, 0.17]], $MachinePrecision]], N[(N[(z * -6.0), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.165 \lor \neg \left(z \leq 0.17\right):\\
\;\;\;\;\left(z \cdot -6\right) \cdot \left(x - y\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if z < -0.165000000000000008 or 0.170000000000000012 < z Initial program 99.8%
Taylor expanded in x around 0 95.5%
Taylor expanded in z around inf 98.2%
metadata-eval98.2%
associate-*r*98.2%
neg-mul-198.2%
distribute-lft-in98.2%
sub-neg98.2%
associate-*r*98.3%
*-commutative98.3%
Simplified98.3%
if -0.165000000000000008 < z < 0.170000000000000012Initial program 100.0%
Taylor expanded in y around inf 98.3%
Taylor expanded in y around 0 98.2%
*-commutative98.2%
associate-*l*98.3%
Simplified98.3%
Final simplification98.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -3700.0) (not (<= z 0.17))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3700.0) || !(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 <= (-3700.0d0)) .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 <= -3700.0) || !(z <= 0.17)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3700.0) 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 <= -3700.0) || !(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 <= -3700.0) || ~((z <= 0.17))) tmp = -6.0 * (x * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3700.0], 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 -3700 \lor \neg \left(z \leq 0.17\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3700 or 0.170000000000000012 < z Initial program 99.8%
+-commutative99.8%
*-commutative99.8%
fma-define99.8%
remove-double-neg99.8%
distribute-lft-neg-in99.8%
distribute-rgt-neg-in99.8%
sub-neg99.8%
distribute-neg-in99.8%
remove-double-neg99.8%
+-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around inf 98.6%
Taylor expanded in x around inf 51.7%
if -3700 < z < 0.170000000000000012Initial program 100.0%
Taylor expanded in z around 0 79.5%
Final simplification64.3%
(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.9%
Final simplification99.9%
(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.9%
Taylor expanded in z around 0 37.7%
Final simplification37.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 2024040
(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)))