
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) z)))
double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (((y - x) * 6.0d0) * z)
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
def code(x, y, z): return x + (((y - x) * 6.0) * z)
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * z)) end
function tmp = code(x, y, z) tmp = x + (((y - x) * 6.0) * z); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) z)))
double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (((y - x) * 6.0d0) * z)
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
def code(x, y, z): return x + (((y - x) * 6.0) * z)
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * z)) end
function tmp = code(x, y, z) tmp = x + (((y - x) * 6.0) * z); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
\end{array}
(FPCore (x y z) :precision binary64 (+ x (* (- y x) (* 6.0 z))))
double code(double x, double y, double z) {
return x + ((y - x) * (6.0 * z));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + ((y - x) * (6.0d0 * z))
end function
public static double code(double x, double y, double z) {
return x + ((y - x) * (6.0 * z));
}
def code(x, y, z): return x + ((y - x) * (6.0 * z))
function code(x, y, z) return Float64(x + Float64(Float64(y - x) * Float64(6.0 * z))) end
function tmp = code(x, y, z) tmp = x + ((y - x) * (6.0 * z)); end
code[x_, y_, z_] := N[(x + N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \left(6 \cdot z\right)
\end{array}
Initial program 99.5%
associate-*l*99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))))
(if (<= z -2.7e-72)
t_0
(if (<= z 1.5e-21)
x
(if (or (<= z 8.2e+31) (not (<= z 1.02e+136))) t_0 (* -6.0 (* x z)))))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double tmp;
if (z <= -2.7e-72) {
tmp = t_0;
} else if (z <= 1.5e-21) {
tmp = x;
} else if ((z <= 8.2e+31) || !(z <= 1.02e+136)) {
tmp = t_0;
} else {
tmp = -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 = 6.0d0 * (y * z)
if (z <= (-2.7d-72)) then
tmp = t_0
else if (z <= 1.5d-21) then
tmp = x
else if ((z <= 8.2d+31) .or. (.not. (z <= 1.02d+136))) then
tmp = t_0
else
tmp = (-6.0d0) * (x * z)
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.7e-72) {
tmp = t_0;
} else if (z <= 1.5e-21) {
tmp = x;
} else if ((z <= 8.2e+31) || !(z <= 1.02e+136)) {
tmp = t_0;
} else {
tmp = -6.0 * (x * z);
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) tmp = 0 if z <= -2.7e-72: tmp = t_0 elif z <= 1.5e-21: tmp = x elif (z <= 8.2e+31) or not (z <= 1.02e+136): tmp = t_0 else: tmp = -6.0 * (x * z) return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -2.7e-72) tmp = t_0; elseif (z <= 1.5e-21) tmp = x; elseif ((z <= 8.2e+31) || !(z <= 1.02e+136)) tmp = t_0; else tmp = Float64(-6.0 * Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * (y * z); tmp = 0.0; if (z <= -2.7e-72) tmp = t_0; elseif (z <= 1.5e-21) tmp = x; elseif ((z <= 8.2e+31) || ~((z <= 1.02e+136))) tmp = t_0; else tmp = -6.0 * (x * z); 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.7e-72], t$95$0, If[LessEqual[z, 1.5e-21], x, If[Or[LessEqual[z, 8.2e+31], N[Not[LessEqual[z, 1.02e+136]], $MachinePrecision]], t$95$0, N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -2.7 \cdot 10^{-72}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{-21}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{+31} \lor \neg \left(z \leq 1.02 \cdot 10^{+136}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if z < -2.7e-72 or 1.49999999999999996e-21 < z < 8.2000000000000003e31 or 1.01999999999999996e136 < z Initial program 99.7%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 62.4%
*-commutative62.4%
Simplified62.4%
if -2.7e-72 < z < 1.49999999999999996e-21Initial program 99.2%
Taylor expanded in z around 0 82.3%
if 8.2000000000000003e31 < z < 1.01999999999999996e136Initial program 99.9%
Taylor expanded in y around 0 83.8%
Taylor expanded in z around inf 83.8%
Final simplification73.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))))
(if (<= z -1.25e-71)
t_0
(if (<= z 6.2e-25)
x
(if (<= z 4.2e+22)
(* y (* 6.0 z))
(if (<= z 2.3e+138) (* -6.0 (* x z)) t_0))))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double tmp;
if (z <= -1.25e-71) {
tmp = t_0;
} else if (z <= 6.2e-25) {
tmp = x;
} else if (z <= 4.2e+22) {
tmp = y * (6.0 * z);
} else if (z <= 2.3e+138) {
tmp = -6.0 * (x * z);
} 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 <= (-1.25d-71)) then
tmp = t_0
else if (z <= 6.2d-25) then
tmp = x
else if (z <= 4.2d+22) then
tmp = y * (6.0d0 * z)
else if (z <= 2.3d+138) then
tmp = (-6.0d0) * (x * z)
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 <= -1.25e-71) {
tmp = t_0;
} else if (z <= 6.2e-25) {
tmp = x;
} else if (z <= 4.2e+22) {
tmp = y * (6.0 * z);
} else if (z <= 2.3e+138) {
tmp = -6.0 * (x * z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) tmp = 0 if z <= -1.25e-71: tmp = t_0 elif z <= 6.2e-25: tmp = x elif z <= 4.2e+22: tmp = y * (6.0 * z) elif z <= 2.3e+138: tmp = -6.0 * (x * z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -1.25e-71) tmp = t_0; elseif (z <= 6.2e-25) tmp = x; elseif (z <= 4.2e+22) tmp = Float64(y * Float64(6.0 * z)); elseif (z <= 2.3e+138) tmp = Float64(-6.0 * Float64(x * z)); 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 <= -1.25e-71) tmp = t_0; elseif (z <= 6.2e-25) tmp = x; elseif (z <= 4.2e+22) tmp = y * (6.0 * z); elseif (z <= 2.3e+138) tmp = -6.0 * (x * z); 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, -1.25e-71], t$95$0, If[LessEqual[z, 6.2e-25], x, If[LessEqual[z, 4.2e+22], N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.3e+138], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -1.25 \cdot 10^{-71}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-25}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+22}:\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{+138}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.24999999999999999e-71 or 2.30000000000000008e138 < z Initial program 99.8%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 60.8%
*-commutative60.8%
Simplified60.8%
if -1.24999999999999999e-71 < z < 6.19999999999999989e-25Initial program 99.2%
Taylor expanded in z around 0 82.3%
if 6.19999999999999989e-25 < z < 4.1999999999999996e22Initial program 99.3%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.6%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 86.2%
*-commutative86.2%
associate-*r*86.5%
Simplified86.5%
if 4.1999999999999996e22 < z < 2.30000000000000008e138Initial program 99.9%
Taylor expanded in y around 0 83.8%
Taylor expanded in z around inf 83.8%
Final simplification73.7%
(FPCore (x y z)
:precision binary64
(if (<= z -1.25e-71)
(* 6.0 (* y z))
(if (<= z 1.2e-26)
x
(if (<= z 1.08e+21)
(* y (* 6.0 z))
(if (<= z 2.5e+137) (* -6.0 (* x z)) (* z (* y 6.0)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.25e-71) {
tmp = 6.0 * (y * z);
} else if (z <= 1.2e-26) {
tmp = x;
} else if (z <= 1.08e+21) {
tmp = y * (6.0 * z);
} else if (z <= 2.5e+137) {
tmp = -6.0 * (x * z);
} else {
tmp = z * (y * 6.0);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1.25d-71)) then
tmp = 6.0d0 * (y * z)
else if (z <= 1.2d-26) then
tmp = x
else if (z <= 1.08d+21) then
tmp = y * (6.0d0 * z)
else if (z <= 2.5d+137) then
tmp = (-6.0d0) * (x * z)
else
tmp = z * (y * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.25e-71) {
tmp = 6.0 * (y * z);
} else if (z <= 1.2e-26) {
tmp = x;
} else if (z <= 1.08e+21) {
tmp = y * (6.0 * z);
} else if (z <= 2.5e+137) {
tmp = -6.0 * (x * z);
} else {
tmp = z * (y * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.25e-71: tmp = 6.0 * (y * z) elif z <= 1.2e-26: tmp = x elif z <= 1.08e+21: tmp = y * (6.0 * z) elif z <= 2.5e+137: tmp = -6.0 * (x * z) else: tmp = z * (y * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.25e-71) tmp = Float64(6.0 * Float64(y * z)); elseif (z <= 1.2e-26) tmp = x; elseif (z <= 1.08e+21) tmp = Float64(y * Float64(6.0 * z)); elseif (z <= 2.5e+137) tmp = Float64(-6.0 * Float64(x * z)); else tmp = Float64(z * Float64(y * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.25e-71) tmp = 6.0 * (y * z); elseif (z <= 1.2e-26) tmp = x; elseif (z <= 1.08e+21) tmp = y * (6.0 * z); elseif (z <= 2.5e+137) tmp = -6.0 * (x * z); else tmp = z * (y * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.25e-71], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.2e-26], x, If[LessEqual[z, 1.08e+21], N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.5e+137], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{-71}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{-26}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.08 \cdot 10^{+21}:\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{+137}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\end{array}
\end{array}
if z < -1.24999999999999999e-71Initial program 99.7%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 61.9%
*-commutative61.9%
Simplified61.9%
if -1.24999999999999999e-71 < z < 1.2e-26Initial program 99.2%
Taylor expanded in z around 0 82.3%
if 1.2e-26 < z < 1.08e21Initial program 99.3%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.6%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 86.2%
*-commutative86.2%
associate-*r*86.5%
Simplified86.5%
if 1.08e21 < z < 2.5000000000000001e137Initial program 99.9%
Taylor expanded in y around 0 83.8%
Taylor expanded in z around inf 83.8%
if 2.5000000000000001e137 < z Initial program 99.9%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
fma-define99.6%
Applied egg-rr99.6%
Taylor expanded in y around inf 58.4%
associate-*r*58.5%
*-commutative58.5%
Simplified58.5%
Final simplification73.8%
(FPCore (x y z)
:precision binary64
(if (<= z -2.4e-71)
(* 6.0 (* y z))
(if (<= z 1.45e-28)
x
(if (<= z 1.18e+32)
(* y (* 6.0 z))
(if (<= z 2.1e+137) (* z (* x -6.0)) (* z (* y 6.0)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.4e-71) {
tmp = 6.0 * (y * z);
} else if (z <= 1.45e-28) {
tmp = x;
} else if (z <= 1.18e+32) {
tmp = y * (6.0 * z);
} else if (z <= 2.1e+137) {
tmp = z * (x * -6.0);
} else {
tmp = z * (y * 6.0);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-2.4d-71)) then
tmp = 6.0d0 * (y * z)
else if (z <= 1.45d-28) then
tmp = x
else if (z <= 1.18d+32) then
tmp = y * (6.0d0 * z)
else if (z <= 2.1d+137) then
tmp = z * (x * (-6.0d0))
else
tmp = z * (y * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -2.4e-71) {
tmp = 6.0 * (y * z);
} else if (z <= 1.45e-28) {
tmp = x;
} else if (z <= 1.18e+32) {
tmp = y * (6.0 * z);
} else if (z <= 2.1e+137) {
tmp = z * (x * -6.0);
} else {
tmp = z * (y * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.4e-71: tmp = 6.0 * (y * z) elif z <= 1.45e-28: tmp = x elif z <= 1.18e+32: tmp = y * (6.0 * z) elif z <= 2.1e+137: tmp = z * (x * -6.0) else: tmp = z * (y * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.4e-71) tmp = Float64(6.0 * Float64(y * z)); elseif (z <= 1.45e-28) tmp = x; elseif (z <= 1.18e+32) tmp = Float64(y * Float64(6.0 * z)); elseif (z <= 2.1e+137) tmp = Float64(z * Float64(x * -6.0)); else tmp = Float64(z * Float64(y * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2.4e-71) tmp = 6.0 * (y * z); elseif (z <= 1.45e-28) tmp = x; elseif (z <= 1.18e+32) tmp = y * (6.0 * z); elseif (z <= 2.1e+137) tmp = z * (x * -6.0); else tmp = z * (y * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.4e-71], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.45e-28], x, If[LessEqual[z, 1.18e+32], N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.1e+137], N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{-71}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{-28}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.18 \cdot 10^{+32}:\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{+137}:\\
\;\;\;\;z \cdot \left(x \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\end{array}
\end{array}
if z < -2.4e-71Initial program 99.7%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 61.9%
*-commutative61.9%
Simplified61.9%
if -2.4e-71 < z < 1.45000000000000006e-28Initial program 99.2%
Taylor expanded in z around 0 82.3%
if 1.45000000000000006e-28 < z < 1.1800000000000001e32Initial program 99.3%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.6%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 86.2%
*-commutative86.2%
associate-*r*86.5%
Simplified86.5%
if 1.1800000000000001e32 < z < 2.0999999999999999e137Initial program 99.9%
Taylor expanded in y around 0 83.8%
Taylor expanded in z around inf 83.8%
*-commutative83.8%
associate-*r*83.5%
*-commutative83.5%
Simplified83.5%
Taylor expanded in x around 0 83.8%
*-commutative83.8%
*-commutative83.8%
associate-*l*84.0%
Simplified84.0%
if 2.0999999999999999e137 < z Initial program 99.9%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
fma-define99.6%
Applied egg-rr99.6%
Taylor expanded in y around inf 58.4%
associate-*r*58.5%
*-commutative58.5%
Simplified58.5%
Final simplification73.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.65e-71) (not (<= z 1.05e-23))) (* 6.0 (* (- y x) z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.65e-71) || !(z <= 1.05e-23)) {
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 <= (-2.65d-71)) .or. (.not. (z <= 1.05d-23))) 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 <= -2.65e-71) || !(z <= 1.05e-23)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.65e-71) or not (z <= 1.05e-23): tmp = 6.0 * ((y - x) * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.65e-71) || !(z <= 1.05e-23)) 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 <= -2.65e-71) || ~((z <= 1.05e-23))) tmp = 6.0 * ((y - x) * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.65e-71], N[Not[LessEqual[z, 1.05e-23]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.65 \cdot 10^{-71} \lor \neg \left(z \leq 1.05 \cdot 10^{-23}\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.65e-71 or 1.05e-23 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 96.2%
if -2.65e-71 < z < 1.05e-23Initial program 99.2%
Taylor expanded in z around 0 82.3%
Final simplification89.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -150000.0) (not (<= z 0.0028))) (* 6.0 (* (- y x) z)) (+ x (* 6.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -150000.0) || !(z <= 0.0028)) {
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 <= (-150000.0d0)) .or. (.not. (z <= 0.0028d0))) 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 <= -150000.0) || !(z <= 0.0028)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -150000.0) or not (z <= 0.0028): 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 <= -150000.0) || !(z <= 0.0028)) 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 <= -150000.0) || ~((z <= 0.0028))) 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, -150000.0], N[Not[LessEqual[z, 0.0028]], $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 -150000 \lor \neg \left(z \leq 0.0028\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 < -1.5e5 or 0.00279999999999999997 < z Initial program 99.8%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.8%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 99.1%
if -1.5e5 < z < 0.00279999999999999997Initial program 99.3%
Taylor expanded in y around inf 99.0%
*-commutative99.0%
Simplified99.0%
Final simplification99.0%
(FPCore (x y z) :precision binary64 (if (<= z -1.2e-71) (* (- y x) (* 6.0 z)) (if (<= z 1.46e-27) x (* 6.0 (* (- y x) z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.2e-71) {
tmp = (y - x) * (6.0 * z);
} else if (z <= 1.46e-27) {
tmp = x;
} else {
tmp = 6.0 * ((y - 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) :: tmp
if (z <= (-1.2d-71)) then
tmp = (y - x) * (6.0d0 * z)
else if (z <= 1.46d-27) then
tmp = x
else
tmp = 6.0d0 * ((y - x) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.2e-71) {
tmp = (y - x) * (6.0 * z);
} else if (z <= 1.46e-27) {
tmp = x;
} else {
tmp = 6.0 * ((y - x) * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.2e-71: tmp = (y - x) * (6.0 * z) elif z <= 1.46e-27: tmp = x else: tmp = 6.0 * ((y - x) * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.2e-71) tmp = Float64(Float64(y - x) * Float64(6.0 * z)); elseif (z <= 1.46e-27) tmp = x; else tmp = Float64(6.0 * Float64(Float64(y - x) * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.2e-71) tmp = (y - x) * (6.0 * z); elseif (z <= 1.46e-27) tmp = x; else tmp = 6.0 * ((y - x) * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.2e-71], N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.46e-27], x, N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{-71}:\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq 1.46 \cdot 10^{-27}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\end{array}
\end{array}
if z < -1.2e-71Initial program 99.7%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 95.0%
associate-*r*95.0%
*-commutative95.0%
*-commutative95.0%
Simplified95.0%
if -1.2e-71 < z < 1.45999999999999992e-27Initial program 99.2%
Taylor expanded in z around 0 82.3%
if 1.45999999999999992e-27 < z Initial program 99.8%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-define99.6%
Applied egg-rr99.6%
Taylor expanded in z around inf 97.9%
Final simplification89.0%
(FPCore (x y z) :precision binary64 (if (<= z -2.65e-71) (* (- y x) (* 6.0 z)) (if (<= z 0.00045) (+ x (* -6.0 (* x z))) (* 6.0 (* (- y x) z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.65e-71) {
tmp = (y - x) * (6.0 * z);
} else if (z <= 0.00045) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = 6.0 * ((y - 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) :: tmp
if (z <= (-2.65d-71)) then
tmp = (y - x) * (6.0d0 * z)
else if (z <= 0.00045d0) then
tmp = x + ((-6.0d0) * (x * z))
else
tmp = 6.0d0 * ((y - x) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -2.65e-71) {
tmp = (y - x) * (6.0 * z);
} else if (z <= 0.00045) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = 6.0 * ((y - x) * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.65e-71: tmp = (y - x) * (6.0 * z) elif z <= 0.00045: tmp = x + (-6.0 * (x * z)) else: tmp = 6.0 * ((y - x) * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.65e-71) tmp = Float64(Float64(y - x) * Float64(6.0 * z)); elseif (z <= 0.00045) tmp = Float64(x + Float64(-6.0 * Float64(x * z))); else tmp = Float64(6.0 * Float64(Float64(y - x) * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2.65e-71) tmp = (y - x) * (6.0 * z); elseif (z <= 0.00045) tmp = x + (-6.0 * (x * z)); else tmp = 6.0 * ((y - x) * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.65e-71], N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.00045], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.65 \cdot 10^{-71}:\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq 0.00045:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\end{array}
\end{array}
if z < -2.65e-71Initial program 99.7%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 95.0%
associate-*r*95.0%
*-commutative95.0%
*-commutative95.0%
Simplified95.0%
if -2.65e-71 < z < 4.4999999999999999e-4Initial program 99.2%
Taylor expanded in y around 0 81.9%
if 4.4999999999999999e-4 < z Initial program 99.8%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-define99.6%
Applied egg-rr99.6%
Taylor expanded in z around inf 99.7%
Final simplification89.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.17) (not (<= z 6.2e+20))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.17) || !(z <= 6.2e+20)) {
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 <= 6.2d+20))) 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 <= 6.2e+20)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.17) or not (z <= 6.2e+20): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.17) || !(z <= 6.2e+20)) 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 <= 6.2e+20))) 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, 6.2e+20]], $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 6.2 \cdot 10^{+20}\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.170000000000000012 or 6.2e20 < z Initial program 99.8%
Taylor expanded in y around 0 48.7%
Taylor expanded in z around inf 48.0%
if -0.170000000000000012 < z < 6.2e20Initial program 99.3%
Taylor expanded in z around 0 74.9%
Final simplification63.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.5%
Final simplification99.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.5%
Taylor expanded in z around 0 45.1%
Final simplification45.1%
(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 2024053
(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)))