
(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.4%
associate-*l*99.8%
Simplified99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))) (t_1 (* x (* z -6.0))))
(if (<= z -3.3e+90)
(* z (* y 6.0))
(if (<= z -470.0)
t_1
(if (<= z -4.2e-119)
t_0
(if (<= z 5.7e-86)
x
(if (<= z 5.2e-20)
t_0
(if (<= z 0.17)
x
(if (or (<= z 7.5e+49) (not (<= z 2.15e+83))) 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 <= -3.3e+90) {
tmp = z * (y * 6.0);
} else if (z <= -470.0) {
tmp = t_1;
} else if (z <= -4.2e-119) {
tmp = t_0;
} else if (z <= 5.7e-86) {
tmp = x;
} else if (z <= 5.2e-20) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else if ((z <= 7.5e+49) || !(z <= 2.15e+83)) {
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 <= (-3.3d+90)) then
tmp = z * (y * 6.0d0)
else if (z <= (-470.0d0)) then
tmp = t_1
else if (z <= (-4.2d-119)) then
tmp = t_0
else if (z <= 5.7d-86) then
tmp = x
else if (z <= 5.2d-20) then
tmp = t_0
else if (z <= 0.17d0) then
tmp = x
else if ((z <= 7.5d+49) .or. (.not. (z <= 2.15d+83))) 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 <= -3.3e+90) {
tmp = z * (y * 6.0);
} else if (z <= -470.0) {
tmp = t_1;
} else if (z <= -4.2e-119) {
tmp = t_0;
} else if (z <= 5.7e-86) {
tmp = x;
} else if (z <= 5.2e-20) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else if ((z <= 7.5e+49) || !(z <= 2.15e+83)) {
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 <= -3.3e+90: tmp = z * (y * 6.0) elif z <= -470.0: tmp = t_1 elif z <= -4.2e-119: tmp = t_0 elif z <= 5.7e-86: tmp = x elif z <= 5.2e-20: tmp = t_0 elif z <= 0.17: tmp = x elif (z <= 7.5e+49) or not (z <= 2.15e+83): 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 <= -3.3e+90) tmp = Float64(z * Float64(y * 6.0)); elseif (z <= -470.0) tmp = t_1; elseif (z <= -4.2e-119) tmp = t_0; elseif (z <= 5.7e-86) tmp = x; elseif (z <= 5.2e-20) tmp = t_0; elseif (z <= 0.17) tmp = x; elseif ((z <= 7.5e+49) || !(z <= 2.15e+83)) 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 <= -3.3e+90) tmp = z * (y * 6.0); elseif (z <= -470.0) tmp = t_1; elseif (z <= -4.2e-119) tmp = t_0; elseif (z <= 5.7e-86) tmp = x; elseif (z <= 5.2e-20) tmp = t_0; elseif (z <= 0.17) tmp = x; elseif ((z <= 7.5e+49) || ~((z <= 2.15e+83))) 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, -3.3e+90], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -470.0], t$95$1, If[LessEqual[z, -4.2e-119], t$95$0, If[LessEqual[z, 5.7e-86], x, If[LessEqual[z, 5.2e-20], t$95$0, If[LessEqual[z, 0.17], x, If[Or[LessEqual[z, 7.5e+49], N[Not[LessEqual[z, 2.15e+83]], $MachinePrecision]], 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 -3.3 \cdot 10^{+90}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{elif}\;z \leq -470:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -4.2 \cdot 10^{-119}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 5.7 \cdot 10^{-86}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{-20}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{+49} \lor \neg \left(z \leq 2.15 \cdot 10^{+83}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -3.30000000000000008e90Initial program 99.8%
Taylor expanded in y around inf 66.8%
*-commutative66.8%
associate-*r*66.9%
Simplified66.9%
Taylor expanded in z around inf 66.9%
fma-define66.9%
Simplified66.9%
Taylor expanded in z around inf 66.3%
associate-*r*66.4%
*-commutative66.4%
Simplified66.4%
if -3.30000000000000008e90 < z < -470 or 0.170000000000000012 < z < 7.4999999999999995e49 or 2.15e83 < z Initial program 99.7%
Taylor expanded in x around inf 65.0%
+-commutative65.0%
Simplified65.0%
Taylor expanded in z around inf 62.3%
associate-*r*62.3%
*-commutative62.3%
associate-*r*63.4%
Simplified63.4%
if -470 < z < -4.2e-119 or 5.7000000000000004e-86 < z < 5.1999999999999999e-20 or 7.4999999999999995e49 < z < 2.15e83Initial program 99.7%
Taylor expanded in y around inf 97.4%
*-commutative97.4%
associate-*r*97.3%
Simplified97.3%
Taylor expanded in z around inf 88.6%
fma-define88.7%
Simplified88.7%
Taylor expanded in z around inf 65.8%
if -4.2e-119 < z < 5.7000000000000004e-86 or 5.1999999999999999e-20 < z < 0.170000000000000012Initial program 98.6%
Taylor expanded in z around 0 89.0%
Final simplification71.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))) (t_1 (* x (* z -6.0))))
(if (<= z -3.4e+90)
t_0
(if (<= z -470.0)
t_1
(if (<= z -1.05e-119)
t_0
(if (<= z 5.7e-86)
x
(if (<= z 1.35e-19)
t_0
(if (<= z 0.17)
x
(if (or (<= z 2e+49) (not (<= z 9.5e+78))) 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 <= -3.4e+90) {
tmp = t_0;
} else if (z <= -470.0) {
tmp = t_1;
} else if (z <= -1.05e-119) {
tmp = t_0;
} else if (z <= 5.7e-86) {
tmp = x;
} else if (z <= 1.35e-19) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else if ((z <= 2e+49) || !(z <= 9.5e+78)) {
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 <= (-3.4d+90)) then
tmp = t_0
else if (z <= (-470.0d0)) then
tmp = t_1
else if (z <= (-1.05d-119)) then
tmp = t_0
else if (z <= 5.7d-86) then
tmp = x
else if (z <= 1.35d-19) then
tmp = t_0
else if (z <= 0.17d0) then
tmp = x
else if ((z <= 2d+49) .or. (.not. (z <= 9.5d+78))) 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 <= -3.4e+90) {
tmp = t_0;
} else if (z <= -470.0) {
tmp = t_1;
} else if (z <= -1.05e-119) {
tmp = t_0;
} else if (z <= 5.7e-86) {
tmp = x;
} else if (z <= 1.35e-19) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else if ((z <= 2e+49) || !(z <= 9.5e+78)) {
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 <= -3.4e+90: tmp = t_0 elif z <= -470.0: tmp = t_1 elif z <= -1.05e-119: tmp = t_0 elif z <= 5.7e-86: tmp = x elif z <= 1.35e-19: tmp = t_0 elif z <= 0.17: tmp = x elif (z <= 2e+49) or not (z <= 9.5e+78): 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 <= -3.4e+90) tmp = t_0; elseif (z <= -470.0) tmp = t_1; elseif (z <= -1.05e-119) tmp = t_0; elseif (z <= 5.7e-86) tmp = x; elseif (z <= 1.35e-19) tmp = t_0; elseif (z <= 0.17) tmp = x; elseif ((z <= 2e+49) || !(z <= 9.5e+78)) 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 <= -3.4e+90) tmp = t_0; elseif (z <= -470.0) tmp = t_1; elseif (z <= -1.05e-119) tmp = t_0; elseif (z <= 5.7e-86) tmp = x; elseif (z <= 1.35e-19) tmp = t_0; elseif (z <= 0.17) tmp = x; elseif ((z <= 2e+49) || ~((z <= 9.5e+78))) 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, -3.4e+90], t$95$0, If[LessEqual[z, -470.0], t$95$1, If[LessEqual[z, -1.05e-119], t$95$0, If[LessEqual[z, 5.7e-86], x, If[LessEqual[z, 1.35e-19], t$95$0, If[LessEqual[z, 0.17], x, If[Or[LessEqual[z, 2e+49], N[Not[LessEqual[z, 9.5e+78]], $MachinePrecision]], 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 -3.4 \cdot 10^{+90}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -470:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.05 \cdot 10^{-119}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 5.7 \cdot 10^{-86}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{-19}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+49} \lor \neg \left(z \leq 9.5 \cdot 10^{+78}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -3.40000000000000018e90 or -470 < z < -1.05e-119 or 5.7000000000000004e-86 < z < 1.35e-19 or 1.99999999999999989e49 < z < 9.5000000000000006e78Initial program 99.7%
Taylor expanded in y around inf 80.6%
*-commutative80.6%
associate-*r*80.6%
Simplified80.6%
Taylor expanded in z around inf 76.7%
fma-define76.7%
Simplified76.7%
Taylor expanded in z around inf 66.1%
if -3.40000000000000018e90 < z < -470 or 0.170000000000000012 < z < 1.99999999999999989e49 or 9.5000000000000006e78 < z Initial program 99.7%
Taylor expanded in x around inf 65.0%
+-commutative65.0%
Simplified65.0%
Taylor expanded in z around inf 62.3%
associate-*r*62.3%
*-commutative62.3%
associate-*r*63.4%
Simplified63.4%
if -1.05e-119 < z < 5.7000000000000004e-86 or 1.35e-19 < z < 0.170000000000000012Initial program 98.6%
Taylor expanded in z around 0 89.0%
Final simplification71.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))) (t_1 (* -6.0 (* x z))))
(if (<= z -3.6e+90)
t_0
(if (<= z -470.0)
t_1
(if (<= z -4.2e-119)
t_0
(if (<= z 0.17)
x
(if (or (<= z 8.5e+48) (not (<= z 1.4e+85))) 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 <= -3.6e+90) {
tmp = t_0;
} else if (z <= -470.0) {
tmp = t_1;
} else if (z <= -4.2e-119) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else if ((z <= 8.5e+48) || !(z <= 1.4e+85)) {
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 <= (-3.6d+90)) then
tmp = t_0
else if (z <= (-470.0d0)) then
tmp = t_1
else if (z <= (-4.2d-119)) then
tmp = t_0
else if (z <= 0.17d0) then
tmp = x
else if ((z <= 8.5d+48) .or. (.not. (z <= 1.4d+85))) 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 <= -3.6e+90) {
tmp = t_0;
} else if (z <= -470.0) {
tmp = t_1;
} else if (z <= -4.2e-119) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else if ((z <= 8.5e+48) || !(z <= 1.4e+85)) {
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 <= -3.6e+90: tmp = t_0 elif z <= -470.0: tmp = t_1 elif z <= -4.2e-119: tmp = t_0 elif z <= 0.17: tmp = x elif (z <= 8.5e+48) or not (z <= 1.4e+85): 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 <= -3.6e+90) tmp = t_0; elseif (z <= -470.0) tmp = t_1; elseif (z <= -4.2e-119) tmp = t_0; elseif (z <= 0.17) tmp = x; elseif ((z <= 8.5e+48) || !(z <= 1.4e+85)) 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 <= -3.6e+90) tmp = t_0; elseif (z <= -470.0) tmp = t_1; elseif (z <= -4.2e-119) tmp = t_0; elseif (z <= 0.17) tmp = x; elseif ((z <= 8.5e+48) || ~((z <= 1.4e+85))) 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, -3.6e+90], t$95$0, If[LessEqual[z, -470.0], t$95$1, If[LessEqual[z, -4.2e-119], t$95$0, If[LessEqual[z, 0.17], x, If[Or[LessEqual[z, 8.5e+48], N[Not[LessEqual[z, 1.4e+85]], $MachinePrecision]], 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 -3.6 \cdot 10^{+90}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -470:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -4.2 \cdot 10^{-119}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+48} \lor \neg \left(z \leq 1.4 \cdot 10^{+85}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -3.6e90 or -470 < z < -4.2e-119 or 8.5000000000000001e48 < z < 1.4e85Initial program 99.8%
Taylor expanded in y around inf 77.0%
*-commutative77.0%
associate-*r*76.9%
Simplified76.9%
Taylor expanded in z around inf 74.6%
fma-define74.6%
Simplified74.6%
Taylor expanded in z around inf 66.7%
if -3.6e90 < z < -470 or 0.170000000000000012 < z < 8.5000000000000001e48 or 1.4e85 < z Initial program 99.7%
Taylor expanded in x around inf 65.0%
+-commutative65.0%
Simplified65.0%
Taylor expanded in z around inf 62.3%
if -4.2e-119 < z < 0.170000000000000012Initial program 98.8%
Taylor expanded in z around 0 80.1%
Final simplification69.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (+ (* z -6.0) 1.0))))
(if (<= x -6.4e-28)
t_0
(if (<= x 2.8e-122)
(* z (* y 6.0))
(if (or (<= x 9e-74) (not (<= x 7.6e-50))) t_0 (* 6.0 (* y z)))))))
double code(double x, double y, double z) {
double t_0 = x * ((z * -6.0) + 1.0);
double tmp;
if (x <= -6.4e-28) {
tmp = t_0;
} else if (x <= 2.8e-122) {
tmp = z * (y * 6.0);
} else if ((x <= 9e-74) || !(x <= 7.6e-50)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = x * ((z * (-6.0d0)) + 1.0d0)
if (x <= (-6.4d-28)) then
tmp = t_0
else if (x <= 2.8d-122) then
tmp = z * (y * 6.0d0)
else if ((x <= 9d-74) .or. (.not. (x <= 7.6d-50))) then
tmp = t_0
else
tmp = 6.0d0 * (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * ((z * -6.0) + 1.0);
double tmp;
if (x <= -6.4e-28) {
tmp = t_0;
} else if (x <= 2.8e-122) {
tmp = z * (y * 6.0);
} else if ((x <= 9e-74) || !(x <= 7.6e-50)) {
tmp = t_0;
} else {
tmp = 6.0 * (y * z);
}
return tmp;
}
def code(x, y, z): t_0 = x * ((z * -6.0) + 1.0) tmp = 0 if x <= -6.4e-28: tmp = t_0 elif x <= 2.8e-122: tmp = z * (y * 6.0) elif (x <= 9e-74) or not (x <= 7.6e-50): tmp = t_0 else: tmp = 6.0 * (y * z) return tmp
function code(x, y, z) t_0 = Float64(x * Float64(Float64(z * -6.0) + 1.0)) tmp = 0.0 if (x <= -6.4e-28) tmp = t_0; elseif (x <= 2.8e-122) tmp = Float64(z * Float64(y * 6.0)); elseif ((x <= 9e-74) || !(x <= 7.6e-50)) tmp = t_0; else tmp = Float64(6.0 * Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * ((z * -6.0) + 1.0); tmp = 0.0; if (x <= -6.4e-28) tmp = t_0; elseif (x <= 2.8e-122) tmp = z * (y * 6.0); elseif ((x <= 9e-74) || ~((x <= 7.6e-50))) tmp = t_0; else tmp = 6.0 * (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(N[(z * -6.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.4e-28], t$95$0, If[LessEqual[x, 2.8e-122], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, 9e-74], N[Not[LessEqual[x, 7.6e-50]], $MachinePrecision]], t$95$0, N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(z \cdot -6 + 1\right)\\
\mathbf{if}\;x \leq -6.4 \cdot 10^{-28}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-122}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{elif}\;x \leq 9 \cdot 10^{-74} \lor \neg \left(x \leq 7.6 \cdot 10^{-50}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if x < -6.39999999999999964e-28 or 2.7999999999999999e-122 < x < 8.9999999999999998e-74 or 7.5999999999999998e-50 < x Initial program 99.2%
Taylor expanded in x around inf 84.7%
+-commutative84.7%
Simplified84.7%
if -6.39999999999999964e-28 < x < 2.7999999999999999e-122Initial program 99.7%
Taylor expanded in y around inf 91.3%
*-commutative91.3%
associate-*r*91.3%
Simplified91.3%
Taylor expanded in z around inf 91.3%
fma-define91.4%
Simplified91.4%
Taylor expanded in z around inf 71.9%
associate-*r*72.0%
*-commutative72.0%
Simplified72.0%
if 8.9999999999999998e-74 < x < 7.5999999999999998e-50Initial program 99.1%
Taylor expanded in y around inf 87.1%
*-commutative87.1%
associate-*r*87.1%
Simplified87.1%
Taylor expanded in z around inf 86.2%
fma-define86.2%
Simplified86.2%
Taylor expanded in z around inf 86.5%
Final simplification79.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (+ (* z -6.0) 1.0))))
(if (<= x -1.8e-28)
t_0
(if (<= x 2.3e-121)
(* z (* y 6.0))
(if (<= x 2.3e-75)
t_0
(if (<= x 6.3e-52) (* 6.0 (* y z)) (+ x (* -6.0 (* x z)))))))))
double code(double x, double y, double z) {
double t_0 = x * ((z * -6.0) + 1.0);
double tmp;
if (x <= -1.8e-28) {
tmp = t_0;
} else if (x <= 2.3e-121) {
tmp = z * (y * 6.0);
} else if (x <= 2.3e-75) {
tmp = t_0;
} else if (x <= 6.3e-52) {
tmp = 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) :: t_0
real(8) :: tmp
t_0 = x * ((z * (-6.0d0)) + 1.0d0)
if (x <= (-1.8d-28)) then
tmp = t_0
else if (x <= 2.3d-121) then
tmp = z * (y * 6.0d0)
else if (x <= 2.3d-75) then
tmp = t_0
else if (x <= 6.3d-52) then
tmp = 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 t_0 = x * ((z * -6.0) + 1.0);
double tmp;
if (x <= -1.8e-28) {
tmp = t_0;
} else if (x <= 2.3e-121) {
tmp = z * (y * 6.0);
} else if (x <= 2.3e-75) {
tmp = t_0;
} else if (x <= 6.3e-52) {
tmp = 6.0 * (y * z);
} else {
tmp = x + (-6.0 * (x * z));
}
return tmp;
}
def code(x, y, z): t_0 = x * ((z * -6.0) + 1.0) tmp = 0 if x <= -1.8e-28: tmp = t_0 elif x <= 2.3e-121: tmp = z * (y * 6.0) elif x <= 2.3e-75: tmp = t_0 elif x <= 6.3e-52: tmp = 6.0 * (y * z) else: tmp = x + (-6.0 * (x * z)) return tmp
function code(x, y, z) t_0 = Float64(x * Float64(Float64(z * -6.0) + 1.0)) tmp = 0.0 if (x <= -1.8e-28) tmp = t_0; elseif (x <= 2.3e-121) tmp = Float64(z * Float64(y * 6.0)); elseif (x <= 2.3e-75) tmp = t_0; elseif (x <= 6.3e-52) tmp = 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) t_0 = x * ((z * -6.0) + 1.0); tmp = 0.0; if (x <= -1.8e-28) tmp = t_0; elseif (x <= 2.3e-121) tmp = z * (y * 6.0); elseif (x <= 2.3e-75) tmp = t_0; elseif (x <= 6.3e-52) tmp = 6.0 * (y * z); else tmp = x + (-6.0 * (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(N[(z * -6.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.8e-28], t$95$0, If[LessEqual[x, 2.3e-121], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.3e-75], t$95$0, If[LessEqual[x, 6.3e-52], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(z \cdot -6 + 1\right)\\
\mathbf{if}\;x \leq -1.8 \cdot 10^{-28}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-121}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-75}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 6.3 \cdot 10^{-52}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if x < -1.7999999999999999e-28 or 2.30000000000000012e-121 < x < 2.3e-75Initial program 98.6%
Taylor expanded in x around inf 83.2%
+-commutative83.2%
Simplified83.2%
if -1.7999999999999999e-28 < x < 2.30000000000000012e-121Initial program 99.7%
Taylor expanded in y around inf 91.3%
*-commutative91.3%
associate-*r*91.3%
Simplified91.3%
Taylor expanded in z around inf 91.3%
fma-define91.4%
Simplified91.4%
Taylor expanded in z around inf 71.9%
associate-*r*72.0%
*-commutative72.0%
Simplified72.0%
if 2.3e-75 < x < 6.3000000000000003e-52Initial program 99.1%
Taylor expanded in y around inf 87.1%
*-commutative87.1%
associate-*r*87.1%
Simplified87.1%
Taylor expanded in z around inf 86.2%
fma-define86.2%
Simplified86.2%
Taylor expanded in z around inf 86.5%
if 6.3000000000000003e-52 < x Initial program 99.9%
Taylor expanded in y around 0 86.1%
Final simplification79.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.2e-16) (not (<= y 2.8e-77))) (+ x (* 6.0 (* y z))) (* x (+ (* z -6.0) 1.0))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.2e-16) || !(y <= 2.8e-77)) {
tmp = x + (6.0 * (y * 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.2d-16)) .or. (.not. (y <= 2.8d-77))) then
tmp = x + (6.0d0 * (y * 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.2e-16) || !(y <= 2.8e-77)) {
tmp = x + (6.0 * (y * z));
} else {
tmp = x * ((z * -6.0) + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3.2e-16) or not (y <= 2.8e-77): tmp = x + (6.0 * (y * z)) else: tmp = x * ((z * -6.0) + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3.2e-16) || !(y <= 2.8e-77)) tmp = Float64(x + Float64(6.0 * Float64(y * 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.2e-16) || ~((y <= 2.8e-77))) tmp = x + (6.0 * (y * z)); else tmp = x * ((z * -6.0) + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.2e-16], N[Not[LessEqual[y, 2.8e-77]], $MachinePrecision]], N[(x + N[(6.0 * N[(y * 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.2 \cdot 10^{-16} \lor \neg \left(y \leq 2.8 \cdot 10^{-77}\right):\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\
\end{array}
\end{array}
if y < -3.20000000000000023e-16 or 2.7999999999999999e-77 < y Initial program 99.8%
Taylor expanded in y around inf 88.5%
*-commutative88.5%
Simplified88.5%
if -3.20000000000000023e-16 < y < 2.7999999999999999e-77Initial program 98.9%
Taylor expanded in x around inf 88.2%
+-commutative88.2%
Simplified88.2%
Final simplification88.4%
(FPCore (x y z) :precision binary64 (if (<= y -1.35e-16) (+ x (* 6.0 (* y z))) (if (<= y 1.2e-76) (* x (+ (* z -6.0) 1.0)) (+ x (* y (* 6.0 z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.35e-16) {
tmp = x + (6.0 * (y * z));
} else if (y <= 1.2e-76) {
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 <= (-1.35d-16)) then
tmp = x + (6.0d0 * (y * z))
else if (y <= 1.2d-76) 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 <= -1.35e-16) {
tmp = x + (6.0 * (y * z));
} else if (y <= 1.2e-76) {
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 <= -1.35e-16: tmp = x + (6.0 * (y * z)) elif y <= 1.2e-76: 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 <= -1.35e-16) tmp = Float64(x + Float64(6.0 * Float64(y * z))); elseif (y <= 1.2e-76) 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 <= -1.35e-16) tmp = x + (6.0 * (y * z)); elseif (y <= 1.2e-76) 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, -1.35e-16], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.2e-76], 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 -1.35 \cdot 10^{-16}:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{-76}:\\
\;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if y < -1.35e-16Initial program 99.7%
Taylor expanded in y around inf 87.6%
*-commutative87.6%
Simplified87.6%
if -1.35e-16 < y < 1.20000000000000007e-76Initial program 98.9%
Taylor expanded in x around inf 88.2%
+-commutative88.2%
Simplified88.2%
if 1.20000000000000007e-76 < y Initial program 99.9%
Taylor expanded in y around inf 89.4%
*-commutative89.4%
associate-*r*89.6%
Simplified89.6%
Final simplification88.4%
(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.8%
Taylor expanded in x around inf 53.8%
+-commutative53.8%
Simplified53.8%
Taylor expanded in z around inf 52.1%
if -0.165000000000000008 < z < 0.170000000000000012Initial program 98.9%
Taylor expanded in z around 0 72.5%
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.4%
Final simplification99.4%
(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.4%
Taylor expanded in z around 0 32.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 2024085
(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)))