
(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 (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-define99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* x z))) (t_1 (* 6.0 (* y z))))
(if (<= z -7e+183)
t_0
(if (<= z -7.5e+140)
t_1
(if (<= z -1.55e+35)
t_0
(if (<= z -5.5e-82)
t_1
(if (<= z 0.17)
x
(if (or (<= z 1.35e+88) (not (<= z 8.8e+156))) t_0 t_1))))))))
double code(double x, double y, double z) {
double t_0 = -6.0 * (x * z);
double t_1 = 6.0 * (y * z);
double tmp;
if (z <= -7e+183) {
tmp = t_0;
} else if (z <= -7.5e+140) {
tmp = t_1;
} else if (z <= -1.55e+35) {
tmp = t_0;
} else if (z <= -5.5e-82) {
tmp = t_1;
} else if (z <= 0.17) {
tmp = x;
} else if ((z <= 1.35e+88) || !(z <= 8.8e+156)) {
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) * (x * z)
t_1 = 6.0d0 * (y * z)
if (z <= (-7d+183)) then
tmp = t_0
else if (z <= (-7.5d+140)) then
tmp = t_1
else if (z <= (-1.55d+35)) then
tmp = t_0
else if (z <= (-5.5d-82)) then
tmp = t_1
else if (z <= 0.17d0) then
tmp = x
else if ((z <= 1.35d+88) .or. (.not. (z <= 8.8d+156))) 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 * (x * z);
double t_1 = 6.0 * (y * z);
double tmp;
if (z <= -7e+183) {
tmp = t_0;
} else if (z <= -7.5e+140) {
tmp = t_1;
} else if (z <= -1.55e+35) {
tmp = t_0;
} else if (z <= -5.5e-82) {
tmp = t_1;
} else if (z <= 0.17) {
tmp = x;
} else if ((z <= 1.35e+88) || !(z <= 8.8e+156)) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * (x * z) t_1 = 6.0 * (y * z) tmp = 0 if z <= -7e+183: tmp = t_0 elif z <= -7.5e+140: tmp = t_1 elif z <= -1.55e+35: tmp = t_0 elif z <= -5.5e-82: tmp = t_1 elif z <= 0.17: tmp = x elif (z <= 1.35e+88) or not (z <= 8.8e+156): tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(-6.0 * Float64(x * z)) t_1 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -7e+183) tmp = t_0; elseif (z <= -7.5e+140) tmp = t_1; elseif (z <= -1.55e+35) tmp = t_0; elseif (z <= -5.5e-82) tmp = t_1; elseif (z <= 0.17) tmp = x; elseif ((z <= 1.35e+88) || !(z <= 8.8e+156)) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -6.0 * (x * z); t_1 = 6.0 * (y * z); tmp = 0.0; if (z <= -7e+183) tmp = t_0; elseif (z <= -7.5e+140) tmp = t_1; elseif (z <= -1.55e+35) tmp = t_0; elseif (z <= -5.5e-82) tmp = t_1; elseif (z <= 0.17) tmp = x; elseif ((z <= 1.35e+88) || ~((z <= 8.8e+156))) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7e+183], t$95$0, If[LessEqual[z, -7.5e+140], t$95$1, If[LessEqual[z, -1.55e+35], t$95$0, If[LessEqual[z, -5.5e-82], t$95$1, If[LessEqual[z, 0.17], x, If[Or[LessEqual[z, 1.35e+88], N[Not[LessEqual[z, 8.8e+156]], $MachinePrecision]], t$95$0, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -6 \cdot \left(x \cdot z\right)\\
t_1 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -7 \cdot 10^{+183}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -7.5 \cdot 10^{+140}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.55 \cdot 10^{+35}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -5.5 \cdot 10^{-82}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+88} \lor \neg \left(z \leq 8.8 \cdot 10^{+156}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.99999999999999974e183 or -7.4999999999999997e140 < z < -1.54999999999999993e35 or 0.170000000000000012 < z < 1.35000000000000008e88 or 8.80000000000000016e156 < z Initial program 99.7%
Taylor expanded in x around inf 69.5%
+-commutative69.5%
Simplified69.5%
Taylor expanded in z around inf 68.3%
if -6.99999999999999974e183 < z < -7.4999999999999997e140 or -1.54999999999999993e35 < z < -5.4999999999999998e-82 or 1.35000000000000008e88 < z < 8.80000000000000016e156Initial program 99.9%
Taylor expanded in x around inf 84.7%
Taylor expanded in y around inf 71.3%
associate-*r/64.8%
Simplified64.8%
*-commutative64.8%
distribute-rgt1-in64.8%
associate-*r*64.8%
*-commutative64.8%
associate-*l*64.8%
Applied egg-rr64.8%
Taylor expanded in y around inf 77.9%
if -5.4999999999999998e-82 < z < 0.170000000000000012Initial program 99.8%
Taylor expanded in z around 0 73.2%
Final simplification72.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (* z -6.0))) (t_1 (* 6.0 (* y z))))
(if (<= z -1.1e+186)
t_0
(if (<= z -1.6e+141)
t_1
(if (<= z -5.5e+48)
t_0
(if (<= z -1.65e-81)
t_1
(if (<= z 0.17)
x
(if (or (<= z 6.8e+87) (not (<= z 4.1e+156))) t_0 t_1))))))))
double code(double x, double y, double z) {
double t_0 = x * (z * -6.0);
double t_1 = 6.0 * (y * z);
double tmp;
if (z <= -1.1e+186) {
tmp = t_0;
} else if (z <= -1.6e+141) {
tmp = t_1;
} else if (z <= -5.5e+48) {
tmp = t_0;
} else if (z <= -1.65e-81) {
tmp = t_1;
} else if (z <= 0.17) {
tmp = x;
} else if ((z <= 6.8e+87) || !(z <= 4.1e+156)) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x * (z * (-6.0d0))
t_1 = 6.0d0 * (y * z)
if (z <= (-1.1d+186)) then
tmp = t_0
else if (z <= (-1.6d+141)) then
tmp = t_1
else if (z <= (-5.5d+48)) then
tmp = t_0
else if (z <= (-1.65d-81)) then
tmp = t_1
else if (z <= 0.17d0) then
tmp = x
else if ((z <= 6.8d+87) .or. (.not. (z <= 4.1d+156))) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (z * -6.0);
double t_1 = 6.0 * (y * z);
double tmp;
if (z <= -1.1e+186) {
tmp = t_0;
} else if (z <= -1.6e+141) {
tmp = t_1;
} else if (z <= -5.5e+48) {
tmp = t_0;
} else if (z <= -1.65e-81) {
tmp = t_1;
} else if (z <= 0.17) {
tmp = x;
} else if ((z <= 6.8e+87) || !(z <= 4.1e+156)) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = x * (z * -6.0) t_1 = 6.0 * (y * z) tmp = 0 if z <= -1.1e+186: tmp = t_0 elif z <= -1.6e+141: tmp = t_1 elif z <= -5.5e+48: tmp = t_0 elif z <= -1.65e-81: tmp = t_1 elif z <= 0.17: tmp = x elif (z <= 6.8e+87) or not (z <= 4.1e+156): tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(z * -6.0)) t_1 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -1.1e+186) tmp = t_0; elseif (z <= -1.6e+141) tmp = t_1; elseif (z <= -5.5e+48) tmp = t_0; elseif (z <= -1.65e-81) tmp = t_1; elseif (z <= 0.17) tmp = x; elseif ((z <= 6.8e+87) || !(z <= 4.1e+156)) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (z * -6.0); t_1 = 6.0 * (y * z); tmp = 0.0; if (z <= -1.1e+186) tmp = t_0; elseif (z <= -1.6e+141) tmp = t_1; elseif (z <= -5.5e+48) tmp = t_0; elseif (z <= -1.65e-81) tmp = t_1; elseif (z <= 0.17) tmp = x; elseif ((z <= 6.8e+87) || ~((z <= 4.1e+156))) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.1e+186], t$95$0, If[LessEqual[z, -1.6e+141], t$95$1, If[LessEqual[z, -5.5e+48], t$95$0, If[LessEqual[z, -1.65e-81], t$95$1, If[LessEqual[z, 0.17], x, If[Or[LessEqual[z, 6.8e+87], N[Not[LessEqual[z, 4.1e+156]], $MachinePrecision]], t$95$0, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(z \cdot -6\right)\\
t_1 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -1.1 \cdot 10^{+186}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.6 \cdot 10^{+141}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -5.5 \cdot 10^{+48}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.65 \cdot 10^{-81}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{+87} \lor \neg \left(z \leq 4.1 \cdot 10^{+156}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.0999999999999999e186 or -1.60000000000000009e141 < z < -5.5000000000000002e48 or 0.170000000000000012 < z < 6.8000000000000004e87 or 4.1000000000000002e156 < z Initial program 99.7%
Taylor expanded in x around inf 69.5%
+-commutative69.5%
Simplified69.5%
Taylor expanded in z around inf 68.3%
associate-*r*68.2%
*-commutative68.2%
associate-*l*68.4%
Simplified68.4%
if -1.0999999999999999e186 < z < -1.60000000000000009e141 or -5.5000000000000002e48 < z < -1.64999999999999994e-81 or 6.8000000000000004e87 < z < 4.1000000000000002e156Initial program 99.9%
Taylor expanded in x around inf 84.7%
Taylor expanded in y around inf 71.3%
associate-*r/64.8%
Simplified64.8%
*-commutative64.8%
distribute-rgt1-in64.8%
associate-*r*64.8%
*-commutative64.8%
associate-*l*64.8%
Applied egg-rr64.8%
Taylor expanded in y around inf 77.9%
if -1.64999999999999994e-81 < z < 0.170000000000000012Initial program 99.8%
Taylor expanded in z around 0 73.2%
Final simplification72.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (* z -6.0))) (t_1 (* 6.0 (* y z))))
(if (<= z -3.5e+181)
t_0
(if (<= z -1.1e+141)
t_1
(if (<= z -1.95e+38)
t_0
(if (<= z -1.8e-83)
t_1
(if (<= z 0.17)
x
(if (or (<= z 9e+87) (not (<= z 4.8e+156)))
t_0
(* z (* y 6.0))))))))))
double code(double x, double y, double z) {
double t_0 = x * (z * -6.0);
double t_1 = 6.0 * (y * z);
double tmp;
if (z <= -3.5e+181) {
tmp = t_0;
} else if (z <= -1.1e+141) {
tmp = t_1;
} else if (z <= -1.95e+38) {
tmp = t_0;
} else if (z <= -1.8e-83) {
tmp = t_1;
} else if (z <= 0.17) {
tmp = x;
} else if ((z <= 9e+87) || !(z <= 4.8e+156)) {
tmp = t_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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x * (z * (-6.0d0))
t_1 = 6.0d0 * (y * z)
if (z <= (-3.5d+181)) then
tmp = t_0
else if (z <= (-1.1d+141)) then
tmp = t_1
else if (z <= (-1.95d+38)) then
tmp = t_0
else if (z <= (-1.8d-83)) then
tmp = t_1
else if (z <= 0.17d0) then
tmp = x
else if ((z <= 9d+87) .or. (.not. (z <= 4.8d+156))) then
tmp = t_0
else
tmp = z * (y * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (z * -6.0);
double t_1 = 6.0 * (y * z);
double tmp;
if (z <= -3.5e+181) {
tmp = t_0;
} else if (z <= -1.1e+141) {
tmp = t_1;
} else if (z <= -1.95e+38) {
tmp = t_0;
} else if (z <= -1.8e-83) {
tmp = t_1;
} else if (z <= 0.17) {
tmp = x;
} else if ((z <= 9e+87) || !(z <= 4.8e+156)) {
tmp = t_0;
} else {
tmp = z * (y * 6.0);
}
return tmp;
}
def code(x, y, z): t_0 = x * (z * -6.0) t_1 = 6.0 * (y * z) tmp = 0 if z <= -3.5e+181: tmp = t_0 elif z <= -1.1e+141: tmp = t_1 elif z <= -1.95e+38: tmp = t_0 elif z <= -1.8e-83: tmp = t_1 elif z <= 0.17: tmp = x elif (z <= 9e+87) or not (z <= 4.8e+156): tmp = t_0 else: tmp = z * (y * 6.0) return tmp
function code(x, y, z) t_0 = Float64(x * Float64(z * -6.0)) t_1 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -3.5e+181) tmp = t_0; elseif (z <= -1.1e+141) tmp = t_1; elseif (z <= -1.95e+38) tmp = t_0; elseif (z <= -1.8e-83) tmp = t_1; elseif (z <= 0.17) tmp = x; elseif ((z <= 9e+87) || !(z <= 4.8e+156)) tmp = t_0; else tmp = Float64(z * Float64(y * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (z * -6.0); t_1 = 6.0 * (y * z); tmp = 0.0; if (z <= -3.5e+181) tmp = t_0; elseif (z <= -1.1e+141) tmp = t_1; elseif (z <= -1.95e+38) tmp = t_0; elseif (z <= -1.8e-83) tmp = t_1; elseif (z <= 0.17) tmp = x; elseif ((z <= 9e+87) || ~((z <= 4.8e+156))) tmp = t_0; else tmp = z * (y * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.5e+181], t$95$0, If[LessEqual[z, -1.1e+141], t$95$1, If[LessEqual[z, -1.95e+38], t$95$0, If[LessEqual[z, -1.8e-83], t$95$1, If[LessEqual[z, 0.17], x, If[Or[LessEqual[z, 9e+87], N[Not[LessEqual[z, 4.8e+156]], $MachinePrecision]], t$95$0, N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(z \cdot -6\right)\\
t_1 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -3.5 \cdot 10^{+181}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.1 \cdot 10^{+141}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.95 \cdot 10^{+38}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.8 \cdot 10^{-83}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 9 \cdot 10^{+87} \lor \neg \left(z \leq 4.8 \cdot 10^{+156}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\end{array}
\end{array}
if z < -3.50000000000000008e181 or -1.1e141 < z < -1.95000000000000012e38 or 0.170000000000000012 < z < 9.0000000000000005e87 or 4.8000000000000002e156 < z Initial program 99.7%
Taylor expanded in x around inf 69.5%
+-commutative69.5%
Simplified69.5%
Taylor expanded in z around inf 68.3%
associate-*r*68.2%
*-commutative68.2%
associate-*l*68.4%
Simplified68.4%
if -3.50000000000000008e181 < z < -1.1e141 or -1.95000000000000012e38 < z < -1.80000000000000006e-83Initial program 99.8%
Taylor expanded in x around inf 89.6%
Taylor expanded in y around inf 75.4%
associate-*r/72.0%
Simplified72.0%
*-commutative72.0%
distribute-rgt1-in72.0%
associate-*r*72.0%
*-commutative72.0%
associate-*l*72.0%
Applied egg-rr72.0%
Taylor expanded in y around inf 72.0%
if -1.80000000000000006e-83 < z < 0.170000000000000012Initial program 99.8%
Taylor expanded in z around 0 73.2%
if 9.0000000000000005e87 < z < 4.8000000000000002e156Initial program 99.9%
Taylor expanded in x around inf 76.1%
Taylor expanded in y around inf 64.0%
associate-*r/52.1%
Simplified52.1%
*-commutative52.1%
distribute-rgt1-in52.1%
associate-*r*52.1%
*-commutative52.1%
associate-*l*52.1%
Applied egg-rr52.1%
Taylor expanded in y around inf 88.2%
*-commutative88.2%
associate-*r*87.9%
*-commutative87.9%
associate-*l*88.3%
Simplified88.3%
Final simplification72.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -3.7e-104) (not (<= x 3.9e-88))) (* x (+ (* z -6.0) 1.0)) (* z (* y 6.0))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.7e-104) || !(x <= 3.9e-88)) {
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 ((x <= (-3.7d-104)) .or. (.not. (x <= 3.9d-88))) 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 ((x <= -3.7e-104) || !(x <= 3.9e-88)) {
tmp = x * ((z * -6.0) + 1.0);
} else {
tmp = z * (y * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.7e-104) or not (x <= 3.9e-88): tmp = x * ((z * -6.0) + 1.0) else: tmp = z * (y * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.7e-104) || !(x <= 3.9e-88)) 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 ((x <= -3.7e-104) || ~((x <= 3.9e-88))) tmp = x * ((z * -6.0) + 1.0); else tmp = z * (y * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.7e-104], N[Not[LessEqual[x, 3.9e-88]], $MachinePrecision]], 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}\;x \leq -3.7 \cdot 10^{-104} \lor \neg \left(x \leq 3.9 \cdot 10^{-88}\right):\\
\;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\end{array}
\end{array}
if x < -3.6999999999999999e-104 or 3.89999999999999992e-88 < x Initial program 99.8%
Taylor expanded in x around inf 80.5%
+-commutative80.5%
Simplified80.5%
if -3.6999999999999999e-104 < x < 3.89999999999999992e-88Initial program 99.7%
Taylor expanded in x around inf 78.3%
Taylor expanded in y around inf 67.3%
associate-*r/61.1%
Simplified61.1%
*-commutative61.1%
distribute-rgt1-in61.1%
associate-*r*61.2%
*-commutative61.2%
associate-*l*61.2%
Applied egg-rr61.2%
Taylor expanded in y around inf 74.1%
*-commutative74.1%
associate-*r*74.1%
*-commutative74.1%
associate-*l*74.2%
Simplified74.2%
Final simplification78.5%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.1e-96) (not (<= y 2.75e-53))) (+ x (* y (* 6.0 z))) (* x (+ (* z -6.0) 1.0))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.1e-96) || !(y <= 2.75e-53)) {
tmp = x + (y * (6.0 * z));
} else {
tmp = x * ((z * -6.0) + 1.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.1d-96)) .or. (.not. (y <= 2.75d-53))) then
tmp = x + (y * (6.0d0 * z))
else
tmp = x * ((z * (-6.0d0)) + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -3.1e-96) || !(y <= 2.75e-53)) {
tmp = x + (y * (6.0 * z));
} else {
tmp = x * ((z * -6.0) + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3.1e-96) or not (y <= 2.75e-53): tmp = x + (y * (6.0 * z)) else: tmp = x * ((z * -6.0) + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3.1e-96) || !(y <= 2.75e-53)) tmp = Float64(x + Float64(y * Float64(6.0 * z))); else tmp = Float64(x * Float64(Float64(z * -6.0) + 1.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -3.1e-96) || ~((y <= 2.75e-53))) tmp = x + (y * (6.0 * z)); else tmp = x * ((z * -6.0) + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.1e-96], N[Not[LessEqual[y, 2.75e-53]], $MachinePrecision]], N[(x + N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(z * -6.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.1 \cdot 10^{-96} \lor \neg \left(y \leq 2.75 \cdot 10^{-53}\right):\\
\;\;\;\;x + y \cdot \left(6 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\
\end{array}
\end{array}
if y < -3.0999999999999999e-96 or 2.75000000000000011e-53 < y Initial program 99.8%
Taylor expanded in y around inf 87.2%
*-commutative87.2%
associate-*r*87.2%
Simplified87.2%
if -3.0999999999999999e-96 < y < 2.75000000000000011e-53Initial program 99.8%
Taylor expanded in x around inf 88.9%
+-commutative88.9%
Simplified88.9%
Final simplification87.9%
(FPCore (x y z) :precision binary64 (if (<= y -2.6e-93) (+ x (* z (* y 6.0))) (if (<= y 1.4e-53) (* x (+ (* z -6.0) 1.0)) (+ x (* y (* 6.0 z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.6e-93) {
tmp = x + (z * (y * 6.0));
} else if (y <= 1.4e-53) {
tmp = x * ((z * -6.0) + 1.0);
} 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 (y <= (-2.6d-93)) then
tmp = x + (z * (y * 6.0d0))
else if (y <= 1.4d-53) then
tmp = x * ((z * (-6.0d0)) + 1.0d0)
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 (y <= -2.6e-93) {
tmp = x + (z * (y * 6.0));
} else if (y <= 1.4e-53) {
tmp = x * ((z * -6.0) + 1.0);
} else {
tmp = x + (y * (6.0 * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.6e-93: tmp = x + (z * (y * 6.0)) elif y <= 1.4e-53: tmp = x * ((z * -6.0) + 1.0) else: tmp = x + (y * (6.0 * z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.6e-93) tmp = Float64(x + Float64(z * Float64(y * 6.0))); elseif (y <= 1.4e-53) tmp = Float64(x * Float64(Float64(z * -6.0) + 1.0)); 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 (y <= -2.6e-93) tmp = x + (z * (y * 6.0)); elseif (y <= 1.4e-53) tmp = x * ((z * -6.0) + 1.0); else tmp = x + (y * (6.0 * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.6e-93], N[(x + N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.4e-53], N[(x * N[(N[(z * -6.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.6 \cdot 10^{-93}:\\
\;\;\;\;x + z \cdot \left(y \cdot 6\right)\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{-53}:\\
\;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if y < -2.5999999999999998e-93Initial program 99.8%
Taylor expanded in y around inf 89.4%
if -2.5999999999999998e-93 < y < 1.39999999999999993e-53Initial program 99.8%
Taylor expanded in x around inf 88.9%
+-commutative88.9%
Simplified88.9%
if 1.39999999999999993e-53 < y Initial program 99.8%
Taylor expanded in y around inf 84.5%
*-commutative84.5%
associate-*r*84.5%
Simplified84.5%
Final simplification87.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -60000000000000.0) (not (<= z 0.17))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -60000000000000.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 <= (-60000000000000.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 <= -60000000000000.0) || !(z <= 0.17)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -60000000000000.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 <= -60000000000000.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 <= -60000000000000.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, -60000000000000.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 -60000000000000 \lor \neg \left(z \leq 0.17\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -6e13 or 0.170000000000000012 < z Initial program 99.7%
Taylor expanded in x around inf 59.3%
+-commutative59.3%
Simplified59.3%
Taylor expanded in z around inf 58.3%
if -6e13 < z < 0.170000000000000012Initial program 99.8%
Taylor expanded in z around 0 68.5%
Final simplification63.1%
(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)
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 33.5%
Final simplification33.5%
(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 2024096
(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)))