
(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 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) z)))
double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (((y - x) * 6.0d0) * z)
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
def code(x, y, z): return x + (((y - x) * 6.0) * z)
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * z)) end
function tmp = code(x, y, z) tmp = x + (((y - x) * 6.0) * z); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
\end{array}
(FPCore (x y z) :precision binary64 (fma (* (- y x) z) 6.0 x))
double code(double x, double y, double z) {
return fma(((y - x) * z), 6.0, x);
}
function code(x, y, z) return fma(Float64(Float64(y - x) * z), 6.0, x) end
code[x_, y_, z_] := N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] * 6.0 + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(y - x\right) \cdot z, 6, x\right)
\end{array}
Initial program 99.8%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
fma-define99.8%
Applied egg-rr99.8%
(FPCore (x y z)
:precision binary64
(if (<= z -4e+161)
(* -6.0 (* x z))
(if (<= z -8.2e-28)
(* 6.0 (* y z))
(if (<= z 1.85e-104)
x
(if (<= z 2.5e+123) (* z (* y 6.0)) (* z (* x -6.0)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -4e+161) {
tmp = -6.0 * (x * z);
} else if (z <= -8.2e-28) {
tmp = 6.0 * (y * z);
} else if (z <= 1.85e-104) {
tmp = x;
} else if (z <= 2.5e+123) {
tmp = z * (y * 6.0);
} else {
tmp = z * (x * -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 <= (-4d+161)) then
tmp = (-6.0d0) * (x * z)
else if (z <= (-8.2d-28)) then
tmp = 6.0d0 * (y * z)
else if (z <= 1.85d-104) then
tmp = x
else if (z <= 2.5d+123) then
tmp = z * (y * 6.0d0)
else
tmp = z * (x * (-6.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -4e+161) {
tmp = -6.0 * (x * z);
} else if (z <= -8.2e-28) {
tmp = 6.0 * (y * z);
} else if (z <= 1.85e-104) {
tmp = x;
} else if (z <= 2.5e+123) {
tmp = z * (y * 6.0);
} else {
tmp = z * (x * -6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4e+161: tmp = -6.0 * (x * z) elif z <= -8.2e-28: tmp = 6.0 * (y * z) elif z <= 1.85e-104: tmp = x elif z <= 2.5e+123: tmp = z * (y * 6.0) else: tmp = z * (x * -6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4e+161) tmp = Float64(-6.0 * Float64(x * z)); elseif (z <= -8.2e-28) tmp = Float64(6.0 * Float64(y * z)); elseif (z <= 1.85e-104) tmp = x; elseif (z <= 2.5e+123) tmp = Float64(z * Float64(y * 6.0)); else tmp = Float64(z * Float64(x * -6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -4e+161) tmp = -6.0 * (x * z); elseif (z <= -8.2e-28) tmp = 6.0 * (y * z); elseif (z <= 1.85e-104) tmp = x; elseif (z <= 2.5e+123) tmp = z * (y * 6.0); else tmp = z * (x * -6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4e+161], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -8.2e-28], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.85e-104], x, If[LessEqual[z, 2.5e+123], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{+161}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -8.2 \cdot 10^{-28}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{-104}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{+123}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(x \cdot -6\right)\\
\end{array}
\end{array}
if z < -4.0000000000000002e161Initial program 99.9%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.9%
fma-define99.9%
Applied egg-rr99.9%
Taylor expanded in z around inf 99.9%
associate-*r*99.8%
*-commutative99.8%
associate-*r*99.9%
Simplified99.9%
Taylor expanded in y around 0 67.2%
Taylor expanded in z around 0 67.2%
if -4.0000000000000002e161 < z < -8.2000000000000005e-28Initial program 99.6%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 61.2%
if -8.2000000000000005e-28 < z < 1.85e-104Initial program 99.9%
Taylor expanded in z around 0 78.6%
if 1.85e-104 < z < 2.49999999999999987e123Initial program 99.7%
associate-*r*99.6%
+-commutative99.6%
*-commutative99.6%
associate-*r*99.7%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 62.5%
associate-*r*62.6%
*-commutative62.6%
Simplified62.6%
if 2.49999999999999987e123 < z Initial program 99.8%
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 99.8%
associate-*r*99.8%
*-commutative99.8%
associate-*r*99.8%
Simplified99.8%
Taylor expanded in y around 0 64.9%
Final simplification69.1%
(FPCore (x y z)
:precision binary64
(if (<= z -1.1e+163)
(* -6.0 (* x z))
(if (<= z -2.1e-33)
(* 6.0 (* y z))
(if (<= z 1.85e-104)
x
(if (<= z 3.4e+123) (* y (* z 6.0)) (* z (* x -6.0)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.1e+163) {
tmp = -6.0 * (x * z);
} else if (z <= -2.1e-33) {
tmp = 6.0 * (y * z);
} else if (z <= 1.85e-104) {
tmp = x;
} else if (z <= 3.4e+123) {
tmp = y * (z * 6.0);
} else {
tmp = z * (x * -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.1d+163)) then
tmp = (-6.0d0) * (x * z)
else if (z <= (-2.1d-33)) then
tmp = 6.0d0 * (y * z)
else if (z <= 1.85d-104) then
tmp = x
else if (z <= 3.4d+123) then
tmp = y * (z * 6.0d0)
else
tmp = z * (x * (-6.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.1e+163) {
tmp = -6.0 * (x * z);
} else if (z <= -2.1e-33) {
tmp = 6.0 * (y * z);
} else if (z <= 1.85e-104) {
tmp = x;
} else if (z <= 3.4e+123) {
tmp = y * (z * 6.0);
} else {
tmp = z * (x * -6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.1e+163: tmp = -6.0 * (x * z) elif z <= -2.1e-33: tmp = 6.0 * (y * z) elif z <= 1.85e-104: tmp = x elif z <= 3.4e+123: tmp = y * (z * 6.0) else: tmp = z * (x * -6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.1e+163) tmp = Float64(-6.0 * Float64(x * z)); elseif (z <= -2.1e-33) tmp = Float64(6.0 * Float64(y * z)); elseif (z <= 1.85e-104) tmp = x; elseif (z <= 3.4e+123) tmp = Float64(y * Float64(z * 6.0)); else tmp = Float64(z * Float64(x * -6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.1e+163) tmp = -6.0 * (x * z); elseif (z <= -2.1e-33) tmp = 6.0 * (y * z); elseif (z <= 1.85e-104) tmp = x; elseif (z <= 3.4e+123) tmp = y * (z * 6.0); else tmp = z * (x * -6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.1e+163], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -2.1e-33], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.85e-104], x, If[LessEqual[z, 3.4e+123], N[(y * N[(z * 6.0), $MachinePrecision]), $MachinePrecision], N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \cdot 10^{+163}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -2.1 \cdot 10^{-33}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{-104}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 3.4 \cdot 10^{+123}:\\
\;\;\;\;y \cdot \left(z \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(x \cdot -6\right)\\
\end{array}
\end{array}
if z < -1.09999999999999993e163Initial program 99.9%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.9%
fma-define99.9%
Applied egg-rr99.9%
Taylor expanded in z around inf 99.9%
associate-*r*99.8%
*-commutative99.8%
associate-*r*99.9%
Simplified99.9%
Taylor expanded in y around 0 67.2%
Taylor expanded in z around 0 67.2%
if -1.09999999999999993e163 < z < -2.1e-33Initial program 99.6%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 61.2%
if -2.1e-33 < z < 1.85e-104Initial program 99.9%
Taylor expanded in z around 0 78.6%
if 1.85e-104 < z < 3.40000000000000001e123Initial program 99.7%
associate-*r*99.6%
+-commutative99.6%
*-commutative99.6%
associate-*r*99.7%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 62.5%
*-commutative62.5%
associate-*r*62.5%
Simplified62.5%
if 3.40000000000000001e123 < z Initial program 99.8%
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 99.8%
associate-*r*99.8%
*-commutative99.8%
associate-*r*99.8%
Simplified99.8%
Taylor expanded in y around 0 64.9%
Final simplification69.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* x z))))
(if (<= z -4e+161)
t_0
(if (<= z -3.4e-26)
(* 6.0 (* y z))
(if (<= z 1.85e-104) x (if (<= z 1.1e+125) (* y (* z 6.0)) t_0))))))
double code(double x, double y, double z) {
double t_0 = -6.0 * (x * z);
double tmp;
if (z <= -4e+161) {
tmp = t_0;
} else if (z <= -3.4e-26) {
tmp = 6.0 * (y * z);
} else if (z <= 1.85e-104) {
tmp = x;
} else if (z <= 1.1e+125) {
tmp = y * (z * 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) * (x * z)
if (z <= (-4d+161)) then
tmp = t_0
else if (z <= (-3.4d-26)) then
tmp = 6.0d0 * (y * z)
else if (z <= 1.85d-104) then
tmp = x
else if (z <= 1.1d+125) then
tmp = y * (z * 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 * (x * z);
double tmp;
if (z <= -4e+161) {
tmp = t_0;
} else if (z <= -3.4e-26) {
tmp = 6.0 * (y * z);
} else if (z <= 1.85e-104) {
tmp = x;
} else if (z <= 1.1e+125) {
tmp = y * (z * 6.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * (x * z) tmp = 0 if z <= -4e+161: tmp = t_0 elif z <= -3.4e-26: tmp = 6.0 * (y * z) elif z <= 1.85e-104: tmp = x elif z <= 1.1e+125: tmp = y * (z * 6.0) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-6.0 * Float64(x * z)) tmp = 0.0 if (z <= -4e+161) tmp = t_0; elseif (z <= -3.4e-26) tmp = Float64(6.0 * Float64(y * z)); elseif (z <= 1.85e-104) tmp = x; elseif (z <= 1.1e+125) tmp = Float64(y * Float64(z * 6.0)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -6.0 * (x * z); tmp = 0.0; if (z <= -4e+161) tmp = t_0; elseif (z <= -3.4e-26) tmp = 6.0 * (y * z); elseif (z <= 1.85e-104) tmp = x; elseif (z <= 1.1e+125) tmp = y * (z * 6.0); 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]}, If[LessEqual[z, -4e+161], t$95$0, If[LessEqual[z, -3.4e-26], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.85e-104], x, If[LessEqual[z, 1.1e+125], N[(y * N[(z * 6.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -6 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;z \leq -4 \cdot 10^{+161}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -3.4 \cdot 10^{-26}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{-104}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{+125}:\\
\;\;\;\;y \cdot \left(z \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -4.0000000000000002e161 or 1.09999999999999995e125 < z Initial program 99.9%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
fma-define99.9%
Applied egg-rr99.9%
Taylor expanded in z around inf 99.8%
associate-*r*99.8%
*-commutative99.8%
associate-*r*99.9%
Simplified99.9%
Taylor expanded in y around 0 65.9%
Taylor expanded in z around 0 65.9%
if -4.0000000000000002e161 < z < -3.40000000000000013e-26Initial program 99.6%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 61.2%
if -3.40000000000000013e-26 < z < 1.85e-104Initial program 99.9%
Taylor expanded in z around 0 78.6%
if 1.85e-104 < z < 1.09999999999999995e125Initial program 99.7%
associate-*r*99.6%
+-commutative99.6%
*-commutative99.6%
associate-*r*99.7%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 62.5%
*-commutative62.5%
associate-*r*62.5%
Simplified62.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* x z))) (t_1 (* 6.0 (* y z))))
(if (<= z -3.2e+161)
t_0
(if (<= z -6.8e-37)
t_1
(if (<= z 1.85e-104) x (if (<= z 1.66e+124) 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 <= -3.2e+161) {
tmp = t_0;
} else if (z <= -6.8e-37) {
tmp = t_1;
} else if (z <= 1.85e-104) {
tmp = x;
} else if (z <= 1.66e+124) {
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 <= (-3.2d+161)) then
tmp = t_0
else if (z <= (-6.8d-37)) then
tmp = t_1
else if (z <= 1.85d-104) then
tmp = x
else if (z <= 1.66d+124) 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 <= -3.2e+161) {
tmp = t_0;
} else if (z <= -6.8e-37) {
tmp = t_1;
} else if (z <= 1.85e-104) {
tmp = x;
} else if (z <= 1.66e+124) {
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 <= -3.2e+161: tmp = t_0 elif z <= -6.8e-37: tmp = t_1 elif z <= 1.85e-104: tmp = x elif z <= 1.66e+124: 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 <= -3.2e+161) tmp = t_0; elseif (z <= -6.8e-37) tmp = t_1; elseif (z <= 1.85e-104) tmp = x; elseif (z <= 1.66e+124) 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 <= -3.2e+161) tmp = t_0; elseif (z <= -6.8e-37) tmp = t_1; elseif (z <= 1.85e-104) tmp = x; elseif (z <= 1.66e+124) 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, -3.2e+161], t$95$0, If[LessEqual[z, -6.8e-37], t$95$1, If[LessEqual[z, 1.85e-104], x, If[LessEqual[z, 1.66e+124], 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 -3.2 \cdot 10^{+161}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -6.8 \cdot 10^{-37}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{-104}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.66 \cdot 10^{+124}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -3.20000000000000002e161 or 1.66e124 < z Initial program 99.9%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
fma-define99.9%
Applied egg-rr99.9%
Taylor expanded in z around inf 99.8%
associate-*r*99.8%
*-commutative99.8%
associate-*r*99.9%
Simplified99.9%
Taylor expanded in y around 0 65.9%
Taylor expanded in z around 0 65.9%
if -3.20000000000000002e161 < z < -6.80000000000000037e-37 or 1.85e-104 < z < 1.66e124Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 61.8%
if -6.80000000000000037e-37 < z < 1.85e-104Initial program 99.9%
Taylor expanded in z around 0 78.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -5.1e-36) (not (<= z 6e-105))) (* 6.0 (* (- y x) z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.1e-36) || !(z <= 6e-105)) {
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 <= (-5.1d-36)) .or. (.not. (z <= 6d-105))) 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 <= -5.1e-36) || !(z <= 6e-105)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5.1e-36) or not (z <= 6e-105): tmp = 6.0 * ((y - x) * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5.1e-36) || !(z <= 6e-105)) 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 <= -5.1e-36) || ~((z <= 6e-105))) tmp = 6.0 * ((y - x) * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.1e-36], N[Not[LessEqual[z, 6e-105]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.1 \cdot 10^{-36} \lor \neg \left(z \leq 6 \cdot 10^{-105}\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -5.09999999999999973e-36 or 6.0000000000000002e-105 < z Initial program 99.8%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.8%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 91.7%
if -5.09999999999999973e-36 < z < 6.0000000000000002e-105Initial program 99.9%
Taylor expanded in z around 0 78.6%
Final simplification87.0%
(FPCore (x y z) :precision binary64 (if (<= z -0.165) (* 6.0 (* (- y x) z)) (if (<= z 0.31) (+ x (* 6.0 (* y z))) (* z (* (- y x) 6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.165) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 0.31) {
tmp = x + (6.0 * (y * z));
} else {
tmp = z * ((y - x) * 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.165d0)) then
tmp = 6.0d0 * ((y - x) * z)
else if (z <= 0.31d0) then
tmp = x + (6.0d0 * (y * z))
else
tmp = z * ((y - x) * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.165) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 0.31) {
tmp = x + (6.0 * (y * z));
} else {
tmp = z * ((y - x) * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.165: tmp = 6.0 * ((y - x) * z) elif z <= 0.31: tmp = x + (6.0 * (y * z)) else: tmp = z * ((y - x) * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.165) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); elseif (z <= 0.31) tmp = Float64(x + Float64(6.0 * Float64(y * z))); else tmp = Float64(z * Float64(Float64(y - x) * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.165) tmp = 6.0 * ((y - x) * z); elseif (z <= 0.31) tmp = x + (6.0 * (y * z)); else tmp = z * ((y - x) * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.165], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.31], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.165:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{elif}\;z \leq 0.31:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\end{array}
\end{array}
if z < -0.165000000000000008Initial 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 99.0%
if -0.165000000000000008 < z < 0.309999999999999998Initial program 99.9%
Taylor expanded in y around inf 97.3%
*-commutative97.3%
Simplified97.3%
if 0.309999999999999998 < z Initial program 99.8%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*r*99.8%
Simplified99.8%
Final simplification98.4%
(FPCore (x y z) :precision binary64 (if (<= z -0.0135) (* 6.0 (* (- y x) z)) (if (<= z 1.8e-104) (+ x (* -6.0 (* x z))) (* z (* (- y x) 6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.0135) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 1.8e-104) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = z * ((y - x) * 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.0135d0)) then
tmp = 6.0d0 * ((y - x) * z)
else if (z <= 1.8d-104) then
tmp = x + ((-6.0d0) * (x * z))
else
tmp = z * ((y - x) * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.0135) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 1.8e-104) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = z * ((y - x) * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.0135: tmp = 6.0 * ((y - x) * z) elif z <= 1.8e-104: tmp = x + (-6.0 * (x * z)) else: tmp = z * ((y - x) * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.0135) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); elseif (z <= 1.8e-104) tmp = Float64(x + Float64(-6.0 * Float64(x * z))); else tmp = Float64(z * Float64(Float64(y - x) * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.0135) tmp = 6.0 * ((y - x) * z); elseif (z <= 1.8e-104) tmp = x + (-6.0 * (x * z)); else tmp = z * ((y - x) * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.0135], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.8e-104], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.0135:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{-104}:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\end{array}
\end{array}
if z < -0.0134999999999999998Initial 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 99.1%
if -0.0134999999999999998 < z < 1.7999999999999999e-104Initial program 99.9%
Taylor expanded in y around 0 77.8%
if 1.7999999999999999e-104 < z Initial program 99.8%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 88.1%
associate-*r*88.1%
*-commutative88.1%
associate-*r*88.1%
Simplified88.1%
Final simplification87.3%
(FPCore (x y z) :precision binary64 (if (<= z -1.96e-41) (* 6.0 (* (- y x) z)) (if (<= z 1.05e-104) x (* z (* (- y x) 6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.96e-41) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 1.05e-104) {
tmp = x;
} else {
tmp = z * ((y - x) * 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.96d-41)) then
tmp = 6.0d0 * ((y - x) * z)
else if (z <= 1.05d-104) then
tmp = x
else
tmp = z * ((y - x) * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.96e-41) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 1.05e-104) {
tmp = x;
} else {
tmp = z * ((y - x) * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.96e-41: tmp = 6.0 * ((y - x) * z) elif z <= 1.05e-104: tmp = x else: tmp = z * ((y - x) * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.96e-41) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); elseif (z <= 1.05e-104) tmp = x; else tmp = Float64(z * Float64(Float64(y - x) * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.96e-41) tmp = 6.0 * ((y - x) * z); elseif (z <= 1.05e-104) tmp = x; else tmp = z * ((y - x) * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.96e-41], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.05e-104], x, N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.96 \cdot 10^{-41}:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{-104}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\end{array}
\end{array}
if z < -1.96e-41Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.8%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 95.7%
if -1.96e-41 < z < 1.04999999999999999e-104Initial program 99.9%
Taylor expanded in z around 0 78.6%
if 1.04999999999999999e-104 < z Initial program 99.8%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 88.1%
associate-*r*88.1%
*-commutative88.1%
associate-*r*88.1%
Simplified88.1%
Final simplification87.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.032) (not (<= z 0.17))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.032) || !(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.032d0)) .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.032) || !(z <= 0.17)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.032) 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.032) || !(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.032) || ~((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.032], 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.032 \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.032000000000000001 or 0.170000000000000012 < z Initial program 99.7%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.7%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 99.3%
associate-*r*99.4%
*-commutative99.4%
associate-*r*99.3%
Simplified99.3%
Taylor expanded in y around 0 51.8%
Taylor expanded in z around 0 51.9%
if -0.032000000000000001 < z < 0.170000000000000012Initial program 99.9%
Taylor expanded in z around 0 70.1%
Final simplification60.4%
(FPCore (x y z) :precision binary64 (+ x (* (- y x) (* z 6.0))))
double code(double x, double y, double z) {
return x + ((y - x) * (z * 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 + ((y - x) * (z * 6.0d0))
end function
public static double code(double x, double y, double z) {
return x + ((y - x) * (z * 6.0));
}
def code(x, y, z): return x + ((y - x) * (z * 6.0))
function code(x, y, z) return Float64(x + Float64(Float64(y - x) * Float64(z * 6.0))) end
function tmp = code(x, y, z) tmp = x + ((y - x) * (z * 6.0)); end
code[x_, y_, z_] := N[(x + N[(N[(y - x), $MachinePrecision] * N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \left(z \cdot 6\right)
\end{array}
Initial program 99.8%
associate-*l*99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (+ x (* 6.0 (* (- y x) z))))
double code(double x, double y, double z) {
return x + (6.0 * ((y - x) * 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 + (6.0d0 * ((y - x) * z))
end function
public static double code(double x, double y, double z) {
return x + (6.0 * ((y - x) * z));
}
def code(x, y, z): return x + (6.0 * ((y - x) * z))
function code(x, y, z) return Float64(x + Float64(6.0 * Float64(Float64(y - x) * z))) end
function tmp = code(x, y, z) tmp = x + (6.0 * ((y - x) * z)); end
code[x_, y_, z_] := N[(x + N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + 6 \cdot \left(\left(y - x\right) \cdot z\right)
\end{array}
Initial program 99.8%
Taylor expanded in z around 0 99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.8%
Taylor expanded in z around 0 34.2%
(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 2024137
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
:precision binary64
:alt
(! :herbie-platform default (- x (* (* 6 z) (- x y))))
(+ x (* (* (- y x) 6.0) z)))