
(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(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}
Initial program 99.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.22e+30)
t_0
(if (<= z -2.9e-87)
t_1
(if (<= z 2.15e-34)
x
(if (or (<= z 9600.0) (not (<= z 7.5e+82))) 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.22e+30) {
tmp = t_0;
} else if (z <= -2.9e-87) {
tmp = t_1;
} else if (z <= 2.15e-34) {
tmp = x;
} else if ((z <= 9600.0) || !(z <= 7.5e+82)) {
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.22d+30)) then
tmp = t_0
else if (z <= (-2.9d-87)) then
tmp = t_1
else if (z <= 2.15d-34) then
tmp = x
else if ((z <= 9600.0d0) .or. (.not. (z <= 7.5d+82))) 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.22e+30) {
tmp = t_0;
} else if (z <= -2.9e-87) {
tmp = t_1;
} else if (z <= 2.15e-34) {
tmp = x;
} else if ((z <= 9600.0) || !(z <= 7.5e+82)) {
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.22e+30: tmp = t_0 elif z <= -2.9e-87: tmp = t_1 elif z <= 2.15e-34: tmp = x elif (z <= 9600.0) or not (z <= 7.5e+82): 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.22e+30) tmp = t_0; elseif (z <= -2.9e-87) tmp = t_1; elseif (z <= 2.15e-34) tmp = x; elseif ((z <= 9600.0) || !(z <= 7.5e+82)) 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.22e+30) tmp = t_0; elseif (z <= -2.9e-87) tmp = t_1; elseif (z <= 2.15e-34) tmp = x; elseif ((z <= 9600.0) || ~((z <= 7.5e+82))) 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.22e+30], t$95$0, If[LessEqual[z, -2.9e-87], t$95$1, If[LessEqual[z, 2.15e-34], x, If[Or[LessEqual[z, 9600.0], N[Not[LessEqual[z, 7.5e+82]], $MachinePrecision]], 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.22 \cdot 10^{+30}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -2.9 \cdot 10^{-87}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{-34}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 9600 \lor \neg \left(z \leq 7.5 \cdot 10^{+82}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -1.22e30 or 9600 < z < 7.4999999999999999e82Initial program 99.7%
Taylor expanded in x around inf 62.9%
Taylor expanded in z around inf 61.5%
if -1.22e30 < z < -2.8999999999999999e-87 or 2.15e-34 < z < 9600 or 7.4999999999999999e82 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.8%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 64.0%
if -2.8999999999999999e-87 < z < 2.15e-34Initial program 99.9%
Taylor expanded in z around 0 80.4%
Final simplification69.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* x z))) (t_1 (* 6.0 (* y z))))
(if (<= z -1.12e+30)
t_0
(if (<= z -2.6e-87)
t_1
(if (<= z 8.4e-36)
x
(if (<= z 9600.0) (* y (* 6.0 z)) (if (<= z 1.9e+82) 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 <= -1.12e+30) {
tmp = t_0;
} else if (z <= -2.6e-87) {
tmp = t_1;
} else if (z <= 8.4e-36) {
tmp = x;
} else if (z <= 9600.0) {
tmp = y * (6.0 * z);
} else if (z <= 1.9e+82) {
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 <= (-1.12d+30)) then
tmp = t_0
else if (z <= (-2.6d-87)) then
tmp = t_1
else if (z <= 8.4d-36) then
tmp = x
else if (z <= 9600.0d0) then
tmp = y * (6.0d0 * z)
else if (z <= 1.9d+82) 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 <= -1.12e+30) {
tmp = t_0;
} else if (z <= -2.6e-87) {
tmp = t_1;
} else if (z <= 8.4e-36) {
tmp = x;
} else if (z <= 9600.0) {
tmp = y * (6.0 * z);
} else if (z <= 1.9e+82) {
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 <= -1.12e+30: tmp = t_0 elif z <= -2.6e-87: tmp = t_1 elif z <= 8.4e-36: tmp = x elif z <= 9600.0: tmp = y * (6.0 * z) elif z <= 1.9e+82: 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 <= -1.12e+30) tmp = t_0; elseif (z <= -2.6e-87) tmp = t_1; elseif (z <= 8.4e-36) tmp = x; elseif (z <= 9600.0) tmp = Float64(y * Float64(6.0 * z)); elseif (z <= 1.9e+82) 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 <= -1.12e+30) tmp = t_0; elseif (z <= -2.6e-87) tmp = t_1; elseif (z <= 8.4e-36) tmp = x; elseif (z <= 9600.0) tmp = y * (6.0 * z); elseif (z <= 1.9e+82) 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, -1.12e+30], t$95$0, If[LessEqual[z, -2.6e-87], t$95$1, If[LessEqual[z, 8.4e-36], x, If[LessEqual[z, 9600.0], N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.9e+82], 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 -1.12 \cdot 10^{+30}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -2.6 \cdot 10^{-87}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 8.4 \cdot 10^{-36}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 9600:\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{+82}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -1.12e30 or 9600 < z < 1.90000000000000017e82Initial program 99.7%
Taylor expanded in x around inf 62.9%
Taylor expanded in z around inf 61.5%
if -1.12e30 < z < -2.60000000000000002e-87 or 1.90000000000000017e82 < z Initial program 99.8%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.9%
fma-def99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 62.6%
if -2.60000000000000002e-87 < z < 8.39999999999999964e-36Initial program 99.9%
Taylor expanded in z around 0 80.4%
if 8.39999999999999964e-36 < z < 9600Initial program 99.7%
associate-*r*99.6%
+-commutative99.6%
*-commutative99.6%
associate-*r*99.4%
fma-def99.4%
Applied egg-rr99.4%
Taylor expanded in z around inf 72.3%
Taylor expanded in y around inf 72.8%
*-commutative72.8%
associate-*r*73.0%
Simplified73.0%
Final simplification69.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* x z))) (t_1 (* 6.0 (* y z))))
(if (<= z -4.5e+30)
t_0
(if (<= z -5.5e-88)
t_1
(if (<= z 1.12e-36)
x
(if (<= z 7800.0) (* z (* y 6.0)) (if (<= z 1.18e+83) 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 <= -4.5e+30) {
tmp = t_0;
} else if (z <= -5.5e-88) {
tmp = t_1;
} else if (z <= 1.12e-36) {
tmp = x;
} else if (z <= 7800.0) {
tmp = z * (y * 6.0);
} else if (z <= 1.18e+83) {
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 <= (-4.5d+30)) then
tmp = t_0
else if (z <= (-5.5d-88)) then
tmp = t_1
else if (z <= 1.12d-36) then
tmp = x
else if (z <= 7800.0d0) then
tmp = z * (y * 6.0d0)
else if (z <= 1.18d+83) 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 <= -4.5e+30) {
tmp = t_0;
} else if (z <= -5.5e-88) {
tmp = t_1;
} else if (z <= 1.12e-36) {
tmp = x;
} else if (z <= 7800.0) {
tmp = z * (y * 6.0);
} else if (z <= 1.18e+83) {
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 <= -4.5e+30: tmp = t_0 elif z <= -5.5e-88: tmp = t_1 elif z <= 1.12e-36: tmp = x elif z <= 7800.0: tmp = z * (y * 6.0) elif z <= 1.18e+83: 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 <= -4.5e+30) tmp = t_0; elseif (z <= -5.5e-88) tmp = t_1; elseif (z <= 1.12e-36) tmp = x; elseif (z <= 7800.0) tmp = Float64(z * Float64(y * 6.0)); elseif (z <= 1.18e+83) 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 <= -4.5e+30) tmp = t_0; elseif (z <= -5.5e-88) tmp = t_1; elseif (z <= 1.12e-36) tmp = x; elseif (z <= 7800.0) tmp = z * (y * 6.0); elseif (z <= 1.18e+83) 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, -4.5e+30], t$95$0, If[LessEqual[z, -5.5e-88], t$95$1, If[LessEqual[z, 1.12e-36], x, If[LessEqual[z, 7800.0], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.18e+83], 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 -4.5 \cdot 10^{+30}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -5.5 \cdot 10^{-88}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.12 \cdot 10^{-36}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 7800:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{elif}\;z \leq 1.18 \cdot 10^{+83}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -4.49999999999999995e30 or 7800 < z < 1.1799999999999999e83Initial program 99.7%
Taylor expanded in x around inf 62.9%
Taylor expanded in z around inf 61.5%
if -4.49999999999999995e30 < z < -5.49999999999999971e-88 or 1.1799999999999999e83 < z Initial program 99.8%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.9%
fma-def99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 62.6%
if -5.49999999999999971e-88 < z < 1.12e-36Initial program 99.9%
Taylor expanded in z around 0 80.4%
if 1.12e-36 < z < 7800Initial program 99.7%
associate-*r*99.6%
+-commutative99.6%
*-commutative99.6%
associate-*r*99.4%
fma-def99.4%
Applied egg-rr99.4%
Taylor expanded in y around inf 72.8%
*-commutative72.8%
*-commutative72.8%
associate-*r*73.1%
*-commutative73.1%
Simplified73.1%
Final simplification69.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))))
(if (<= z -2.55e+26)
(* -6.0 (* x z))
(if (<= z -2.8e-87)
t_0
(if (<= z 5.7e-33)
x
(if (<= z 3200.0)
(* z (* y 6.0))
(if (<= z 1.1e+83) (* z (* x -6.0)) t_0)))))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double tmp;
if (z <= -2.55e+26) {
tmp = -6.0 * (x * z);
} else if (z <= -2.8e-87) {
tmp = t_0;
} else if (z <= 5.7e-33) {
tmp = x;
} else if (z <= 3200.0) {
tmp = z * (y * 6.0);
} else if (z <= 1.1e+83) {
tmp = z * (x * -6.0);
} 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) :: tmp
t_0 = 6.0d0 * (y * z)
if (z <= (-2.55d+26)) then
tmp = (-6.0d0) * (x * z)
else if (z <= (-2.8d-87)) then
tmp = t_0
else if (z <= 5.7d-33) then
tmp = x
else if (z <= 3200.0d0) then
tmp = z * (y * 6.0d0)
else if (z <= 1.1d+83) then
tmp = z * (x * (-6.0d0))
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 tmp;
if (z <= -2.55e+26) {
tmp = -6.0 * (x * z);
} else if (z <= -2.8e-87) {
tmp = t_0;
} else if (z <= 5.7e-33) {
tmp = x;
} else if (z <= 3200.0) {
tmp = z * (y * 6.0);
} else if (z <= 1.1e+83) {
tmp = z * (x * -6.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) tmp = 0 if z <= -2.55e+26: tmp = -6.0 * (x * z) elif z <= -2.8e-87: tmp = t_0 elif z <= 5.7e-33: tmp = x elif z <= 3200.0: tmp = z * (y * 6.0) elif z <= 1.1e+83: tmp = z * (x * -6.0) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -2.55e+26) tmp = Float64(-6.0 * Float64(x * z)); elseif (z <= -2.8e-87) tmp = t_0; elseif (z <= 5.7e-33) tmp = x; elseif (z <= 3200.0) tmp = Float64(z * Float64(y * 6.0)); elseif (z <= 1.1e+83) tmp = Float64(z * Float64(x * -6.0)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * (y * z); tmp = 0.0; if (z <= -2.55e+26) tmp = -6.0 * (x * z); elseif (z <= -2.8e-87) tmp = t_0; elseif (z <= 5.7e-33) tmp = x; elseif (z <= 3200.0) tmp = z * (y * 6.0); elseif (z <= 1.1e+83) tmp = z * (x * -6.0); 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]}, If[LessEqual[z, -2.55e+26], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -2.8e-87], t$95$0, If[LessEqual[z, 5.7e-33], x, If[LessEqual[z, 3200.0], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.1e+83], N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -2.55 \cdot 10^{+26}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -2.8 \cdot 10^{-87}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 5.7 \cdot 10^{-33}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 3200:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{+83}:\\
\;\;\;\;z \cdot \left(x \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -2.5499999999999999e26Initial program 99.8%
Taylor expanded in x around inf 62.3%
Taylor expanded in z around inf 62.4%
if -2.5499999999999999e26 < z < -2.8000000000000001e-87 or 1.09999999999999999e83 < z Initial program 99.8%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.9%
fma-def99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 62.6%
if -2.8000000000000001e-87 < z < 5.70000000000000025e-33Initial program 99.9%
Taylor expanded in z around 0 80.4%
if 5.70000000000000025e-33 < z < 3200Initial program 99.7%
associate-*r*99.6%
+-commutative99.6%
*-commutative99.6%
associate-*r*99.4%
fma-def99.4%
Applied egg-rr99.4%
Taylor expanded in y around inf 72.8%
*-commutative72.8%
*-commutative72.8%
associate-*r*73.1%
*-commutative73.1%
Simplified73.1%
if 3200 < z < 1.09999999999999999e83Initial program 99.6%
Taylor expanded in x around inf 64.1%
Taylor expanded in z around inf 59.8%
associate-*r*59.8%
*-commutative59.8%
Simplified59.8%
Final simplification69.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.56e-87) (not (<= z 1.15e-35))) (* 6.0 (* (- y x) z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.56e-87) || !(z <= 1.15e-35)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-1.56d-87)) .or. (.not. (z <= 1.15d-35))) then
tmp = 6.0d0 * ((y - x) * z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.56e-87) || !(z <= 1.15e-35)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.56e-87) or not (z <= 1.15e-35): tmp = 6.0 * ((y - x) * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.56e-87) || !(z <= 1.15e-35)) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.56e-87) || ~((z <= 1.15e-35))) tmp = 6.0 * ((y - x) * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.56e-87], N[Not[LessEqual[z, 1.15e-35]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.56 \cdot 10^{-87} \lor \neg \left(z \leq 1.15 \cdot 10^{-35}\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.55999999999999997e-87 or 1.1499999999999999e-35 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.8%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 93.9%
if -1.55999999999999997e-87 < z < 1.1499999999999999e-35Initial program 99.9%
Taylor expanded in z around 0 80.4%
Final simplification88.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.6e-87) (not (<= z 5.7e-33))) (* 6.0 (* (- y x) z)) (* x (+ 1.0 (* z -6.0)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.6e-87) || !(z <= 5.7e-33)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x * (1.0 + (z * -6.0));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-2.6d-87)) .or. (.not. (z <= 5.7d-33))) then
tmp = 6.0d0 * ((y - x) * z)
else
tmp = x * (1.0d0 + (z * (-6.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -2.6e-87) || !(z <= 5.7e-33)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x * (1.0 + (z * -6.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.6e-87) or not (z <= 5.7e-33): tmp = 6.0 * ((y - x) * z) else: tmp = x * (1.0 + (z * -6.0)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.6e-87) || !(z <= 5.7e-33)) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); else tmp = Float64(x * Float64(1.0 + Float64(z * -6.0))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.6e-87) || ~((z <= 5.7e-33))) tmp = 6.0 * ((y - x) * z); else tmp = x * (1.0 + (z * -6.0)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.6e-87], N[Not[LessEqual[z, 5.7e-33]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{-87} \lor \neg \left(z \leq 5.7 \cdot 10^{-33}\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + z \cdot -6\right)\\
\end{array}
\end{array}
if z < -2.60000000000000002e-87 or 5.70000000000000025e-33 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.8%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 93.9%
if -2.60000000000000002e-87 < z < 5.70000000000000025e-33Initial program 99.9%
Taylor expanded in x around inf 80.4%
Final simplification88.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.17) (not (<= z 2.8e-18))) (* 6.0 (* (- y x) z)) (+ x (* 6.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.17) || !(z <= 2.8e-18)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-0.17d0)) .or. (.not. (z <= 2.8d-18))) then
tmp = 6.0d0 * ((y - x) * z)
else
tmp = x + (6.0d0 * (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.17) || !(z <= 2.8e-18)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.17) or not (z <= 2.8e-18): tmp = 6.0 * ((y - x) * z) else: tmp = x + (6.0 * (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.17) || !(z <= 2.8e-18)) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); else tmp = Float64(x + Float64(6.0 * Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.17) || ~((z <= 2.8e-18))) tmp = 6.0 * ((y - x) * z); else tmp = x + (6.0 * (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.17], N[Not[LessEqual[z, 2.8e-18]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.17 \lor \neg \left(z \leq 2.8 \cdot 10^{-18}\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if z < -0.170000000000000012 or 2.80000000000000012e-18 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.8%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 97.9%
if -0.170000000000000012 < z < 2.80000000000000012e-18Initial program 99.9%
Taylor expanded in y around inf 99.7%
*-commutative99.7%
Simplified99.7%
Final simplification98.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.23) (not (<= z 1.2e-9))) (* 6.0 (* (- y x) z)) (+ x (* z (* y 6.0)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.23) || !(z <= 1.2e-9)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x + (z * (y * 6.0));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-0.23d0)) .or. (.not. (z <= 1.2d-9))) then
tmp = 6.0d0 * ((y - x) * z)
else
tmp = x + (z * (y * 6.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.23) || !(z <= 1.2e-9)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x + (z * (y * 6.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.23) or not (z <= 1.2e-9): tmp = 6.0 * ((y - x) * z) else: tmp = x + (z * (y * 6.0)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.23) || !(z <= 1.2e-9)) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); else tmp = Float64(x + Float64(z * Float64(y * 6.0))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.23) || ~((z <= 1.2e-9))) tmp = 6.0 * ((y - x) * z); else tmp = x + (z * (y * 6.0)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.23], N[Not[LessEqual[z, 1.2e-9]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.23 \lor \neg \left(z \leq 1.2 \cdot 10^{-9}\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y \cdot 6\right)\\
\end{array}
\end{array}
if z < -0.23000000000000001 or 1.2e-9 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.8%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 97.9%
if -0.23000000000000001 < z < 1.2e-9Initial program 99.9%
Taylor expanded in y around inf 99.7%
Final simplification98.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.7e-23) (not (<= z 2.8e-18))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.7e-23) || !(z <= 2.8e-18)) {
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 <= (-3.7d-23)) .or. (.not. (z <= 2.8d-18))) 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 <= -3.7e-23) || !(z <= 2.8e-18)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.7e-23) or not (z <= 2.8e-18): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.7e-23) || !(z <= 2.8e-18)) 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 <= -3.7e-23) || ~((z <= 2.8e-18))) tmp = -6.0 * (x * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.7e-23], N[Not[LessEqual[z, 2.8e-18]], $MachinePrecision]], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.7 \cdot 10^{-23} \lor \neg \left(z \leq 2.8 \cdot 10^{-18}\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.7000000000000003e-23 or 2.80000000000000012e-18 < z Initial program 99.7%
Taylor expanded in x around inf 52.4%
Taylor expanded in z around inf 50.6%
if -3.7000000000000003e-23 < z < 2.80000000000000012e-18Initial program 99.9%
Taylor expanded in z around 0 74.2%
Final simplification61.5%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.8%
Taylor expanded in z around 0 35.8%
Final simplification35.8%
(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 2024018
(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)))