
(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 10 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%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* x z))) (t_1 (* 6.0 (* y z))))
(if (<= z -1.08e+238)
t_0
(if (<= z -3.6e+148)
t_1
(if (<= z -1.35e+124)
t_0
(if (<= z -8e+66)
t_1
(if (<= z -1.38e+20)
t_0
(if (<= z -3.6e-66)
t_1
(if (<= z 5.1e-98) x (if (<= z 1.35e+229) t_1 t_0))))))))))
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 <= -1.08e+238) {
tmp = t_0;
} else if (z <= -3.6e+148) {
tmp = t_1;
} else if (z <= -1.35e+124) {
tmp = t_0;
} else if (z <= -8e+66) {
tmp = t_1;
} else if (z <= -1.38e+20) {
tmp = t_0;
} else if (z <= -3.6e-66) {
tmp = t_1;
} else if (z <= 5.1e-98) {
tmp = x;
} else if (z <= 1.35e+229) {
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) * (x * z)
t_1 = 6.0d0 * (y * z)
if (z <= (-1.08d+238)) then
tmp = t_0
else if (z <= (-3.6d+148)) then
tmp = t_1
else if (z <= (-1.35d+124)) then
tmp = t_0
else if (z <= (-8d+66)) then
tmp = t_1
else if (z <= (-1.38d+20)) then
tmp = t_0
else if (z <= (-3.6d-66)) then
tmp = t_1
else if (z <= 5.1d-98) then
tmp = x
else if (z <= 1.35d+229) 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 * (x * z);
double t_1 = 6.0 * (y * z);
double tmp;
if (z <= -1.08e+238) {
tmp = t_0;
} else if (z <= -3.6e+148) {
tmp = t_1;
} else if (z <= -1.35e+124) {
tmp = t_0;
} else if (z <= -8e+66) {
tmp = t_1;
} else if (z <= -1.38e+20) {
tmp = t_0;
} else if (z <= -3.6e-66) {
tmp = t_1;
} else if (z <= 5.1e-98) {
tmp = x;
} else if (z <= 1.35e+229) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * (x * z) t_1 = 6.0 * (y * z) tmp = 0 if z <= -1.08e+238: tmp = t_0 elif z <= -3.6e+148: tmp = t_1 elif z <= -1.35e+124: tmp = t_0 elif z <= -8e+66: tmp = t_1 elif z <= -1.38e+20: tmp = t_0 elif z <= -3.6e-66: tmp = t_1 elif z <= 5.1e-98: tmp = x elif z <= 1.35e+229: tmp = t_1 else: tmp = t_0 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 <= -1.08e+238) tmp = t_0; elseif (z <= -3.6e+148) tmp = t_1; elseif (z <= -1.35e+124) tmp = t_0; elseif (z <= -8e+66) tmp = t_1; elseif (z <= -1.38e+20) tmp = t_0; elseif (z <= -3.6e-66) tmp = t_1; elseif (z <= 5.1e-98) tmp = x; elseif (z <= 1.35e+229) tmp = t_1; else tmp = t_0; 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 <= -1.08e+238) tmp = t_0; elseif (z <= -3.6e+148) tmp = t_1; elseif (z <= -1.35e+124) tmp = t_0; elseif (z <= -8e+66) tmp = t_1; elseif (z <= -1.38e+20) tmp = t_0; elseif (z <= -3.6e-66) tmp = t_1; elseif (z <= 5.1e-98) tmp = x; elseif (z <= 1.35e+229) tmp = t_1; else tmp = t_0; 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, -1.08e+238], t$95$0, If[LessEqual[z, -3.6e+148], t$95$1, If[LessEqual[z, -1.35e+124], t$95$0, If[LessEqual[z, -8e+66], t$95$1, If[LessEqual[z, -1.38e+20], t$95$0, If[LessEqual[z, -3.6e-66], t$95$1, If[LessEqual[z, 5.1e-98], x, If[LessEqual[z, 1.35e+229], t$95$1, t$95$0]]]]]]]]]]
\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 -1.08 \cdot 10^{+238}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -3.6 \cdot 10^{+148}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.35 \cdot 10^{+124}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -8 \cdot 10^{+66}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.38 \cdot 10^{+20}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -3.6 \cdot 10^{-66}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.1 \cdot 10^{-98}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+229}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.08e238 or -3.60000000000000006e148 < z < -1.34999999999999989e124 or -7.99999999999999956e66 < z < -1.38e20 or 1.35e229 < z Initial program 99.8%
Taylor expanded in y around 0 99.8%
Taylor expanded in x around inf 84.4%
+-commutative84.4%
*-commutative84.4%
Simplified84.4%
Taylor expanded in z around inf 84.4%
if -1.08e238 < z < -3.60000000000000006e148 or -1.34999999999999989e124 < z < -7.99999999999999956e66 or -1.38e20 < z < -3.60000000000000012e-66 or 5.10000000000000022e-98 < z < 1.35e229Initial program 99.6%
Taylor expanded in y around inf 73.2%
*-commutative73.2%
Simplified73.2%
Taylor expanded in x around inf 58.6%
Taylor expanded in y around inf 51.8%
Taylor expanded in x around 0 66.3%
if -3.60000000000000012e-66 < z < 5.10000000000000022e-98Initial program 98.8%
Taylor expanded in z around 0 82.0%
Final simplification75.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (* z -6.0))) (t_1 (* -6.0 (* x z))) (t_2 (* 6.0 (* y z))))
(if (<= z -1.8e+238)
t_0
(if (<= z -3.2e+149)
t_2
(if (<= z -2.3e+120)
t_0
(if (<= z -3.3e+60)
t_2
(if (<= z -1.38e+20)
t_1
(if (<= z -1.76e-65)
t_2
(if (<= z 3.05e-99) x (if (<= z 1.95e+229) t_2 t_1))))))))))
double code(double x, double y, double z) {
double t_0 = x * (z * -6.0);
double t_1 = -6.0 * (x * z);
double t_2 = 6.0 * (y * z);
double tmp;
if (z <= -1.8e+238) {
tmp = t_0;
} else if (z <= -3.2e+149) {
tmp = t_2;
} else if (z <= -2.3e+120) {
tmp = t_0;
} else if (z <= -3.3e+60) {
tmp = t_2;
} else if (z <= -1.38e+20) {
tmp = t_1;
} else if (z <= -1.76e-65) {
tmp = t_2;
} else if (z <= 3.05e-99) {
tmp = x;
} else if (z <= 1.95e+229) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_0 = x * (z * (-6.0d0))
t_1 = (-6.0d0) * (x * z)
t_2 = 6.0d0 * (y * z)
if (z <= (-1.8d+238)) then
tmp = t_0
else if (z <= (-3.2d+149)) then
tmp = t_2
else if (z <= (-2.3d+120)) then
tmp = t_0
else if (z <= (-3.3d+60)) then
tmp = t_2
else if (z <= (-1.38d+20)) then
tmp = t_1
else if (z <= (-1.76d-65)) then
tmp = t_2
else if (z <= 3.05d-99) then
tmp = x
else if (z <= 1.95d+229) then
tmp = t_2
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 * (x * z);
double t_2 = 6.0 * (y * z);
double tmp;
if (z <= -1.8e+238) {
tmp = t_0;
} else if (z <= -3.2e+149) {
tmp = t_2;
} else if (z <= -2.3e+120) {
tmp = t_0;
} else if (z <= -3.3e+60) {
tmp = t_2;
} else if (z <= -1.38e+20) {
tmp = t_1;
} else if (z <= -1.76e-65) {
tmp = t_2;
} else if (z <= 3.05e-99) {
tmp = x;
} else if (z <= 1.95e+229) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = x * (z * -6.0) t_1 = -6.0 * (x * z) t_2 = 6.0 * (y * z) tmp = 0 if z <= -1.8e+238: tmp = t_0 elif z <= -3.2e+149: tmp = t_2 elif z <= -2.3e+120: tmp = t_0 elif z <= -3.3e+60: tmp = t_2 elif z <= -1.38e+20: tmp = t_1 elif z <= -1.76e-65: tmp = t_2 elif z <= 3.05e-99: tmp = x elif z <= 1.95e+229: tmp = t_2 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(x * z)) t_2 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -1.8e+238) tmp = t_0; elseif (z <= -3.2e+149) tmp = t_2; elseif (z <= -2.3e+120) tmp = t_0; elseif (z <= -3.3e+60) tmp = t_2; elseif (z <= -1.38e+20) tmp = t_1; elseif (z <= -1.76e-65) tmp = t_2; elseif (z <= 3.05e-99) tmp = x; elseif (z <= 1.95e+229) tmp = t_2; 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 * (x * z); t_2 = 6.0 * (y * z); tmp = 0.0; if (z <= -1.8e+238) tmp = t_0; elseif (z <= -3.2e+149) tmp = t_2; elseif (z <= -2.3e+120) tmp = t_0; elseif (z <= -3.3e+60) tmp = t_2; elseif (z <= -1.38e+20) tmp = t_1; elseif (z <= -1.76e-65) tmp = t_2; elseif (z <= 3.05e-99) tmp = x; elseif (z <= 1.95e+229) tmp = t_2; 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[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.8e+238], t$95$0, If[LessEqual[z, -3.2e+149], t$95$2, If[LessEqual[z, -2.3e+120], t$95$0, If[LessEqual[z, -3.3e+60], t$95$2, If[LessEqual[z, -1.38e+20], t$95$1, If[LessEqual[z, -1.76e-65], t$95$2, If[LessEqual[z, 3.05e-99], x, If[LessEqual[z, 1.95e+229], t$95$2, t$95$1]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(z \cdot -6\right)\\
t_1 := -6 \cdot \left(x \cdot z\right)\\
t_2 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -1.8 \cdot 10^{+238}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -3.2 \cdot 10^{+149}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -2.3 \cdot 10^{+120}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -3.3 \cdot 10^{+60}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -1.38 \cdot 10^{+20}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.76 \cdot 10^{-65}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 3.05 \cdot 10^{-99}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.95 \cdot 10^{+229}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.79999999999999986e238 or -3.2000000000000002e149 < z < -2.29999999999999993e120Initial program 99.8%
Taylor expanded in y around 0 99.8%
Taylor expanded in x around inf 95.2%
+-commutative95.2%
*-commutative95.2%
Simplified95.2%
Taylor expanded in z around inf 95.2%
*-commutative95.2%
Simplified95.2%
if -1.79999999999999986e238 < z < -3.2000000000000002e149 or -2.29999999999999993e120 < z < -3.2999999999999998e60 or -1.38e20 < z < -1.7600000000000001e-65 or 3.0500000000000002e-99 < z < 1.9499999999999999e229Initial program 99.6%
Taylor expanded in y around inf 73.2%
*-commutative73.2%
Simplified73.2%
Taylor expanded in x around inf 58.6%
Taylor expanded in y around inf 51.8%
Taylor expanded in x around 0 66.3%
if -3.2999999999999998e60 < z < -1.38e20 or 1.9499999999999999e229 < z Initial program 99.7%
Taylor expanded in y around 0 99.7%
Taylor expanded in x around inf 77.3%
+-commutative77.3%
*-commutative77.3%
Simplified77.3%
Taylor expanded in z around inf 77.3%
if -1.7600000000000001e-65 < z < 3.0500000000000002e-99Initial program 98.8%
Taylor expanded in z around 0 82.0%
Final simplification75.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z)))
(t_1 (* x (* z -6.0)))
(t_2 (* -6.0 (* x z)))
(t_3 (* y (* 6.0 z))))
(if (<= z -4.5e+237)
t_1
(if (<= z -3.1e+149)
t_3
(if (<= z -1.5e+124)
t_1
(if (<= z -2.55e+72)
t_3
(if (<= z -7.2e+19)
t_2
(if (<= z -3.6e-66)
t_0
(if (<= z 3.05e-99) x (if (<= z 4.6e+229) t_0 t_2))))))))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double t_1 = x * (z * -6.0);
double t_2 = -6.0 * (x * z);
double t_3 = y * (6.0 * z);
double tmp;
if (z <= -4.5e+237) {
tmp = t_1;
} else if (z <= -3.1e+149) {
tmp = t_3;
} else if (z <= -1.5e+124) {
tmp = t_1;
} else if (z <= -2.55e+72) {
tmp = t_3;
} else if (z <= -7.2e+19) {
tmp = t_2;
} else if (z <= -3.6e-66) {
tmp = t_0;
} else if (z <= 3.05e-99) {
tmp = x;
} else if (z <= 4.6e+229) {
tmp = t_0;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = 6.0d0 * (y * z)
t_1 = x * (z * (-6.0d0))
t_2 = (-6.0d0) * (x * z)
t_3 = y * (6.0d0 * z)
if (z <= (-4.5d+237)) then
tmp = t_1
else if (z <= (-3.1d+149)) then
tmp = t_3
else if (z <= (-1.5d+124)) then
tmp = t_1
else if (z <= (-2.55d+72)) then
tmp = t_3
else if (z <= (-7.2d+19)) then
tmp = t_2
else if (z <= (-3.6d-66)) then
tmp = t_0
else if (z <= 3.05d-99) then
tmp = x
else if (z <= 4.6d+229) then
tmp = t_0
else
tmp = t_2
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 t_2 = -6.0 * (x * z);
double t_3 = y * (6.0 * z);
double tmp;
if (z <= -4.5e+237) {
tmp = t_1;
} else if (z <= -3.1e+149) {
tmp = t_3;
} else if (z <= -1.5e+124) {
tmp = t_1;
} else if (z <= -2.55e+72) {
tmp = t_3;
} else if (z <= -7.2e+19) {
tmp = t_2;
} else if (z <= -3.6e-66) {
tmp = t_0;
} else if (z <= 3.05e-99) {
tmp = x;
} else if (z <= 4.6e+229) {
tmp = t_0;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) t_1 = x * (z * -6.0) t_2 = -6.0 * (x * z) t_3 = y * (6.0 * z) tmp = 0 if z <= -4.5e+237: tmp = t_1 elif z <= -3.1e+149: tmp = t_3 elif z <= -1.5e+124: tmp = t_1 elif z <= -2.55e+72: tmp = t_3 elif z <= -7.2e+19: tmp = t_2 elif z <= -3.6e-66: tmp = t_0 elif z <= 3.05e-99: tmp = x elif z <= 4.6e+229: tmp = t_0 else: tmp = t_2 return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(y * z)) t_1 = Float64(x * Float64(z * -6.0)) t_2 = Float64(-6.0 * Float64(x * z)) t_3 = Float64(y * Float64(6.0 * z)) tmp = 0.0 if (z <= -4.5e+237) tmp = t_1; elseif (z <= -3.1e+149) tmp = t_3; elseif (z <= -1.5e+124) tmp = t_1; elseif (z <= -2.55e+72) tmp = t_3; elseif (z <= -7.2e+19) tmp = t_2; elseif (z <= -3.6e-66) tmp = t_0; elseif (z <= 3.05e-99) tmp = x; elseif (z <= 4.6e+229) tmp = t_0; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * (y * z); t_1 = x * (z * -6.0); t_2 = -6.0 * (x * z); t_3 = y * (6.0 * z); tmp = 0.0; if (z <= -4.5e+237) tmp = t_1; elseif (z <= -3.1e+149) tmp = t_3; elseif (z <= -1.5e+124) tmp = t_1; elseif (z <= -2.55e+72) tmp = t_3; elseif (z <= -7.2e+19) tmp = t_2; elseif (z <= -3.6e-66) tmp = t_0; elseif (z <= 3.05e-99) tmp = x; elseif (z <= 4.6e+229) tmp = t_0; else tmp = t_2; 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]}, Block[{t$95$2 = N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.5e+237], t$95$1, If[LessEqual[z, -3.1e+149], t$95$3, If[LessEqual[z, -1.5e+124], t$95$1, If[LessEqual[z, -2.55e+72], t$95$3, If[LessEqual[z, -7.2e+19], t$95$2, If[LessEqual[z, -3.6e-66], t$95$0, If[LessEqual[z, 3.05e-99], x, If[LessEqual[z, 4.6e+229], t$95$0, t$95$2]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot z\right)\\
t_1 := x \cdot \left(z \cdot -6\right)\\
t_2 := -6 \cdot \left(x \cdot z\right)\\
t_3 := y \cdot \left(6 \cdot z\right)\\
\mathbf{if}\;z \leq -4.5 \cdot 10^{+237}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -3.1 \cdot 10^{+149}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;z \leq -1.5 \cdot 10^{+124}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.55 \cdot 10^{+72}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;z \leq -7.2 \cdot 10^{+19}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -3.6 \cdot 10^{-66}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 3.05 \cdot 10^{-99}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{+229}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -4.49999999999999964e237 or -3.09999999999999987e149 < z < -1.5e124Initial program 99.8%
Taylor expanded in y around 0 99.8%
Taylor expanded in x around inf 95.2%
+-commutative95.2%
*-commutative95.2%
Simplified95.2%
Taylor expanded in z around inf 95.2%
*-commutative95.2%
Simplified95.2%
if -4.49999999999999964e237 < z < -3.09999999999999987e149 or -1.5e124 < z < -2.54999999999999989e72Initial program 99.7%
Taylor expanded in y around inf 69.6%
*-commutative69.6%
Simplified69.6%
Taylor expanded in x around inf 48.3%
Taylor expanded in y around inf 48.0%
Taylor expanded in x around 0 69.2%
*-commutative69.2%
associate-*l*69.3%
*-commutative69.3%
Simplified69.3%
if -2.54999999999999989e72 < z < -7.2e19 or 4.5999999999999999e229 < z Initial program 99.7%
Taylor expanded in y around 0 99.7%
Taylor expanded in x around inf 77.3%
+-commutative77.3%
*-commutative77.3%
Simplified77.3%
Taylor expanded in z around inf 77.3%
if -7.2e19 < z < -3.60000000000000012e-66 or 3.0500000000000002e-99 < z < 4.5999999999999999e229Initial program 99.6%
Taylor expanded in y around inf 74.6%
*-commutative74.6%
Simplified74.6%
Taylor expanded in x around inf 62.7%
Taylor expanded in y around inf 53.3%
Taylor expanded in x around 0 65.2%
if -3.60000000000000012e-66 < z < 3.0500000000000002e-99Initial program 98.8%
Taylor expanded in z around 0 82.0%
Final simplification75.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.02e+78) (not (<= y 6.5e+76))) (* y (* 6.0 z)) (* x (+ (* z -6.0) 1.0))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.02e+78) || !(y <= 6.5e+76)) {
tmp = 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 <= (-1.02d+78)) .or. (.not. (y <= 6.5d+76))) then
tmp = 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 <= -1.02e+78) || !(y <= 6.5e+76)) {
tmp = y * (6.0 * z);
} else {
tmp = x * ((z * -6.0) + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.02e+78) or not (y <= 6.5e+76): tmp = y * (6.0 * z) else: tmp = x * ((z * -6.0) + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.02e+78) || !(y <= 6.5e+76)) tmp = 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 <= -1.02e+78) || ~((y <= 6.5e+76))) tmp = 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, -1.02e+78], N[Not[LessEqual[y, 6.5e+76]], $MachinePrecision]], N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(z * -6.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.02 \cdot 10^{+78} \lor \neg \left(y \leq 6.5 \cdot 10^{+76}\right):\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\
\end{array}
\end{array}
if y < -1.01999999999999994e78 or 6.5000000000000005e76 < y Initial program 98.9%
Taylor expanded in y around inf 97.2%
*-commutative97.2%
Simplified97.2%
Taylor expanded in x around inf 84.6%
Taylor expanded in y around inf 64.5%
Taylor expanded in x around 0 77.1%
*-commutative77.1%
associate-*l*77.2%
*-commutative77.2%
Simplified77.2%
if -1.01999999999999994e78 < y < 6.5000000000000005e76Initial program 99.7%
Taylor expanded in x around inf 78.1%
+-commutative78.1%
Simplified78.1%
Final simplification77.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -6.2e-130) (not (<= y 7.8e+62))) (+ x (* 6.0 (* y z))) (* x (+ (* z -6.0) 1.0))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -6.2e-130) || !(y <= 7.8e+62)) {
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 <= (-6.2d-130)) .or. (.not. (y <= 7.8d+62))) 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 <= -6.2e-130) || !(y <= 7.8e+62)) {
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 <= -6.2e-130) or not (y <= 7.8e+62): 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 <= -6.2e-130) || !(y <= 7.8e+62)) 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 <= -6.2e-130) || ~((y <= 7.8e+62))) 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, -6.2e-130], N[Not[LessEqual[y, 7.8e+62]], $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 -6.2 \cdot 10^{-130} \lor \neg \left(y \leq 7.8 \cdot 10^{+62}\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 < -6.20000000000000021e-130 or 7.8e62 < y Initial program 99.1%
Taylor expanded in y around inf 90.4%
*-commutative90.4%
Simplified90.4%
if -6.20000000000000021e-130 < y < 7.8e62Initial program 99.8%
Taylor expanded in x around inf 84.6%
+-commutative84.6%
Simplified84.6%
Final simplification88.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -6e-130) (not (<= y 8.2e+62))) (+ x (* y (* 6.0 z))) (* x (+ (* z -6.0) 1.0))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -6e-130) || !(y <= 8.2e+62)) {
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 <= (-6d-130)) .or. (.not. (y <= 8.2d+62))) 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 <= -6e-130) || !(y <= 8.2e+62)) {
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 <= -6e-130) or not (y <= 8.2e+62): 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 <= -6e-130) || !(y <= 8.2e+62)) 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 <= -6e-130) || ~((y <= 8.2e+62))) 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, -6e-130], N[Not[LessEqual[y, 8.2e+62]], $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 -6 \cdot 10^{-130} \lor \neg \left(y \leq 8.2 \cdot 10^{+62}\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 < -5.99999999999999972e-130 or 8.19999999999999967e62 < y Initial program 99.1%
Taylor expanded in y around inf 90.4%
*-commutative90.4%
associate-*r*90.5%
Simplified90.5%
if -5.99999999999999972e-130 < y < 8.19999999999999967e62Initial program 99.8%
Taylor expanded in x around inf 84.6%
+-commutative84.6%
Simplified84.6%
Final simplification88.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.17) (not (<= z 0.165))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.17) || !(z <= 0.165)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-0.17d0)) .or. (.not. (z <= 0.165d0))) then
tmp = (-6.0d0) * (x * z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.17) || !(z <= 0.165)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.17) or not (z <= 0.165): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.17) || !(z <= 0.165)) tmp = Float64(-6.0 * Float64(x * z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.17) || ~((z <= 0.165))) tmp = -6.0 * (x * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.17], N[Not[LessEqual[z, 0.165]], $MachinePrecision]], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.17 \lor \neg \left(z \leq 0.165\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.170000000000000012 or 0.165000000000000008 < z Initial program 99.7%
Taylor expanded in y around 0 99.7%
Taylor expanded in x around inf 52.3%
+-commutative52.3%
*-commutative52.3%
Simplified52.3%
Taylor expanded in z around inf 51.7%
if -0.170000000000000012 < z < 0.165000000000000008Initial program 99.0%
Taylor expanded in z around 0 70.6%
Final simplification59.9%
(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.3%
Final simplification32.3%
(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 2024071
(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)))