
(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 (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-def99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))) (t_1 (* -6.0 (* x z))))
(if (<= z -3.6e+256)
t_0
(if (<= z -3.9e+214)
t_1
(if (<= z -2e+46)
t_0
(if (or (<= z -920.0) (not (<= z 0.0068))) t_1 x))))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double t_1 = -6.0 * (x * z);
double tmp;
if (z <= -3.6e+256) {
tmp = t_0;
} else if (z <= -3.9e+214) {
tmp = t_1;
} else if (z <= -2e+46) {
tmp = t_0;
} else if ((z <= -920.0) || !(z <= 0.0068)) {
tmp = t_1;
} 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 6.0d0 * (y * z)
t_1 = (-6.0d0) * (x * z)
if (z <= (-3.6d+256)) then
tmp = t_0
else if (z <= (-3.9d+214)) then
tmp = t_1
else if (z <= (-2d+46)) then
tmp = t_0
else if ((z <= (-920.0d0)) .or. (.not. (z <= 0.0068d0))) then
tmp = t_1
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double t_1 = -6.0 * (x * z);
double tmp;
if (z <= -3.6e+256) {
tmp = t_0;
} else if (z <= -3.9e+214) {
tmp = t_1;
} else if (z <= -2e+46) {
tmp = t_0;
} else if ((z <= -920.0) || !(z <= 0.0068)) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) t_1 = -6.0 * (x * z) tmp = 0 if z <= -3.6e+256: tmp = t_0 elif z <= -3.9e+214: tmp = t_1 elif z <= -2e+46: tmp = t_0 elif (z <= -920.0) or not (z <= 0.0068): tmp = t_1 else: tmp = x return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(y * z)) t_1 = Float64(-6.0 * Float64(x * z)) tmp = 0.0 if (z <= -3.6e+256) tmp = t_0; elseif (z <= -3.9e+214) tmp = t_1; elseif (z <= -2e+46) tmp = t_0; elseif ((z <= -920.0) || !(z <= 0.0068)) tmp = t_1; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * (y * z); t_1 = -6.0 * (x * z); tmp = 0.0; if (z <= -3.6e+256) tmp = t_0; elseif (z <= -3.9e+214) tmp = t_1; elseif (z <= -2e+46) tmp = t_0; elseif ((z <= -920.0) || ~((z <= 0.0068))) tmp = t_1; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.6e+256], t$95$0, If[LessEqual[z, -3.9e+214], t$95$1, If[LessEqual[z, -2e+46], t$95$0, If[Or[LessEqual[z, -920.0], N[Not[LessEqual[z, 0.0068]], $MachinePrecision]], t$95$1, x]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot z\right)\\
t_1 := -6 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;z \leq -3.6 \cdot 10^{+256}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -3.9 \cdot 10^{+214}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2 \cdot 10^{+46}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -920 \lor \neg \left(z \leq 0.0068\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.59999999999999971e256 or -3.90000000000000013e214 < z < -2e46Initial program 99.9%
associate-*r*100.0%
+-commutative100.0%
*-commutative100.0%
associate-*r*99.8%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 73.2%
*-commutative73.2%
Simplified73.2%
if -3.59999999999999971e256 < z < -3.90000000000000013e214 or -2e46 < z < -920 or 0.00679999999999999962 < z Initial program 99.6%
Taylor expanded in y around 0 60.8%
Taylor expanded in z around inf 59.7%
if -920 < z < 0.00679999999999999962Initial program 99.9%
Taylor expanded in z around 0 70.6%
Final simplification67.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))) (t_1 (* x (* z -6.0))))
(if (<= z -3.8e+256)
t_0
(if (<= z -2.1e+213)
t_1
(if (<= z -6.6e+47)
t_0
(if (or (<= z -920.0) (not (<= z 0.0068))) t_1 x))))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double t_1 = x * (z * -6.0);
double tmp;
if (z <= -3.8e+256) {
tmp = t_0;
} else if (z <= -2.1e+213) {
tmp = t_1;
} else if (z <= -6.6e+47) {
tmp = t_0;
} else if ((z <= -920.0) || !(z <= 0.0068)) {
tmp = t_1;
} 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 6.0d0 * (y * z)
t_1 = x * (z * (-6.0d0))
if (z <= (-3.8d+256)) then
tmp = t_0
else if (z <= (-2.1d+213)) then
tmp = t_1
else if (z <= (-6.6d+47)) then
tmp = t_0
else if ((z <= (-920.0d0)) .or. (.not. (z <= 0.0068d0))) then
tmp = t_1
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double t_1 = x * (z * -6.0);
double tmp;
if (z <= -3.8e+256) {
tmp = t_0;
} else if (z <= -2.1e+213) {
tmp = t_1;
} else if (z <= -6.6e+47) {
tmp = t_0;
} else if ((z <= -920.0) || !(z <= 0.0068)) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) t_1 = x * (z * -6.0) tmp = 0 if z <= -3.8e+256: tmp = t_0 elif z <= -2.1e+213: tmp = t_1 elif z <= -6.6e+47: tmp = t_0 elif (z <= -920.0) or not (z <= 0.0068): tmp = t_1 else: tmp = x return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(y * z)) t_1 = Float64(x * Float64(z * -6.0)) tmp = 0.0 if (z <= -3.8e+256) tmp = t_0; elseif (z <= -2.1e+213) tmp = t_1; elseif (z <= -6.6e+47) tmp = t_0; elseif ((z <= -920.0) || !(z <= 0.0068)) tmp = t_1; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * (y * z); t_1 = x * (z * -6.0); tmp = 0.0; if (z <= -3.8e+256) tmp = t_0; elseif (z <= -2.1e+213) tmp = t_1; elseif (z <= -6.6e+47) tmp = t_0; elseif ((z <= -920.0) || ~((z <= 0.0068))) tmp = t_1; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.8e+256], t$95$0, If[LessEqual[z, -2.1e+213], t$95$1, If[LessEqual[z, -6.6e+47], t$95$0, If[Or[LessEqual[z, -920.0], N[Not[LessEqual[z, 0.0068]], $MachinePrecision]], t$95$1, x]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot z\right)\\
t_1 := x \cdot \left(z \cdot -6\right)\\
\mathbf{if}\;z \leq -3.8 \cdot 10^{+256}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -2.1 \cdot 10^{+213}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -6.6 \cdot 10^{+47}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -920 \lor \neg \left(z \leq 0.0068\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.8000000000000002e256 or -2.1000000000000001e213 < z < -6.5999999999999998e47Initial program 99.9%
associate-*r*100.0%
+-commutative100.0%
*-commutative100.0%
associate-*r*99.8%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 73.2%
*-commutative73.2%
Simplified73.2%
if -3.8000000000000002e256 < z < -2.1000000000000001e213 or -6.5999999999999998e47 < z < -920 or 0.00679999999999999962 < z Initial program 99.6%
Taylor expanded in y around 0 60.8%
Taylor expanded in z around inf 59.7%
associate-*r*59.7%
*-commutative59.7%
associate-*r*59.8%
Simplified59.8%
if -920 < z < 0.00679999999999999962Initial program 99.9%
Taylor expanded in z around 0 70.6%
Final simplification67.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (* z -6.0))))
(if (<= z -3.6e+256)
(* 6.0 (* y z))
(if (<= z -1.85e+213)
t_0
(if (<= z -8e+46)
(* y (* z 6.0))
(if (or (<= z -920.0) (not (<= z 0.0068))) t_0 x))))))
double code(double x, double y, double z) {
double t_0 = x * (z * -6.0);
double tmp;
if (z <= -3.6e+256) {
tmp = 6.0 * (y * z);
} else if (z <= -1.85e+213) {
tmp = t_0;
} else if (z <= -8e+46) {
tmp = y * (z * 6.0);
} else if ((z <= -920.0) || !(z <= 0.0068)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = x * (z * (-6.0d0))
if (z <= (-3.6d+256)) then
tmp = 6.0d0 * (y * z)
else if (z <= (-1.85d+213)) then
tmp = t_0
else if (z <= (-8d+46)) then
tmp = y * (z * 6.0d0)
else if ((z <= (-920.0d0)) .or. (.not. (z <= 0.0068d0))) then
tmp = t_0
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (z * -6.0);
double tmp;
if (z <= -3.6e+256) {
tmp = 6.0 * (y * z);
} else if (z <= -1.85e+213) {
tmp = t_0;
} else if (z <= -8e+46) {
tmp = y * (z * 6.0);
} else if ((z <= -920.0) || !(z <= 0.0068)) {
tmp = t_0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): t_0 = x * (z * -6.0) tmp = 0 if z <= -3.6e+256: tmp = 6.0 * (y * z) elif z <= -1.85e+213: tmp = t_0 elif z <= -8e+46: tmp = y * (z * 6.0) elif (z <= -920.0) or not (z <= 0.0068): tmp = t_0 else: tmp = x return tmp
function code(x, y, z) t_0 = Float64(x * Float64(z * -6.0)) tmp = 0.0 if (z <= -3.6e+256) tmp = Float64(6.0 * Float64(y * z)); elseif (z <= -1.85e+213) tmp = t_0; elseif (z <= -8e+46) tmp = Float64(y * Float64(z * 6.0)); elseif ((z <= -920.0) || !(z <= 0.0068)) tmp = t_0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (z * -6.0); tmp = 0.0; if (z <= -3.6e+256) tmp = 6.0 * (y * z); elseif (z <= -1.85e+213) tmp = t_0; elseif (z <= -8e+46) tmp = y * (z * 6.0); elseif ((z <= -920.0) || ~((z <= 0.0068))) tmp = t_0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.6e+256], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.85e+213], t$95$0, If[LessEqual[z, -8e+46], N[(y * N[(z * 6.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -920.0], N[Not[LessEqual[z, 0.0068]], $MachinePrecision]], t$95$0, x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(z \cdot -6\right)\\
\mathbf{if}\;z \leq -3.6 \cdot 10^{+256}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq -1.85 \cdot 10^{+213}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -8 \cdot 10^{+46}:\\
\;\;\;\;y \cdot \left(z \cdot 6\right)\\
\mathbf{elif}\;z \leq -920 \lor \neg \left(z \leq 0.0068\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.59999999999999971e256Initial program 100.0%
associate-*r*100.0%
+-commutative100.0%
*-commutative100.0%
associate-*r*100.0%
fma-def100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 88.9%
*-commutative88.9%
Simplified88.9%
if -3.59999999999999971e256 < z < -1.84999999999999996e213 or -7.9999999999999999e46 < z < -920 or 0.00679999999999999962 < z Initial program 99.6%
Taylor expanded in y around 0 60.8%
Taylor expanded in z around inf 59.7%
associate-*r*59.7%
*-commutative59.7%
associate-*r*59.8%
Simplified59.8%
if -1.84999999999999996e213 < z < -7.9999999999999999e46Initial program 99.9%
associate-*r*99.9%
+-commutative99.9%
*-commutative99.9%
associate-*r*99.7%
fma-def99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 67.4%
*-commutative67.4%
associate-*r*67.5%
Simplified67.5%
if -920 < z < 0.00679999999999999962Initial program 99.9%
Taylor expanded in z around 0 70.6%
Final simplification67.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.08) (not (<= z 1.9e-9))) (* 6.0 (* (- y x) z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.08) || !(z <= 1.9e-9)) {
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 <= (-0.08d0)) .or. (.not. (z <= 1.9d-9))) 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 <= -0.08) || !(z <= 1.9e-9)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.08) or not (z <= 1.9e-9): tmp = 6.0 * ((y - x) * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.08) || !(z <= 1.9e-9)) 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 <= -0.08) || ~((z <= 1.9e-9))) tmp = 6.0 * ((y - x) * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.08], N[Not[LessEqual[z, 1.9e-9]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.08 \lor \neg \left(z \leq 1.9 \cdot 10^{-9}\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.0800000000000000017 or 1.90000000000000006e-9 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.6%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 98.8%
if -0.0800000000000000017 < z < 1.90000000000000006e-9Initial program 99.9%
Taylor expanded in z around 0 71.6%
Final simplification84.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.08) (not (<= z 0.000105))) (* 6.0 (* (- y x) z)) (* x (+ 1.0 (* z -6.0)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.08) || !(z <= 0.000105)) {
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 <= (-0.08d0)) .or. (.not. (z <= 0.000105d0))) 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 <= -0.08) || !(z <= 0.000105)) {
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 <= -0.08) or not (z <= 0.000105): 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 <= -0.08) || !(z <= 0.000105)) 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 <= -0.08) || ~((z <= 0.000105))) 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, -0.08], N[Not[LessEqual[z, 0.000105]], $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 -0.08 \lor \neg \left(z \leq 0.000105\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 < -0.0800000000000000017 or 1.05e-4 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.6%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 98.8%
if -0.0800000000000000017 < z < 1.05e-4Initial program 99.9%
Taylor expanded in x around inf 72.5%
Final simplification84.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.08) (not (<= z 0.00034))) (* 6.0 (* (- y x) z)) (+ x (* -6.0 (* x z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.08) || !(z <= 0.00034)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x + (-6.0 * (x * z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-0.08d0)) .or. (.not. (z <= 0.00034d0))) then
tmp = 6.0d0 * ((y - x) * z)
else
tmp = x + ((-6.0d0) * (x * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.08) || !(z <= 0.00034)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x + (-6.0 * (x * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.08) or not (z <= 0.00034): tmp = 6.0 * ((y - x) * z) else: tmp = x + (-6.0 * (x * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.08) || !(z <= 0.00034)) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); else tmp = Float64(x + Float64(-6.0 * Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.08) || ~((z <= 0.00034))) tmp = 6.0 * ((y - x) * z); else tmp = x + (-6.0 * (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.08], N[Not[LessEqual[z, 0.00034]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.08 \lor \neg \left(z \leq 0.00034\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if z < -0.0800000000000000017 or 3.4e-4 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.6%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 98.8%
if -0.0800000000000000017 < z < 3.4e-4Initial program 99.9%
Taylor expanded in y around 0 72.5%
Final simplification84.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -2700000.0) (not (<= z 0.0068))) (* 6.0 (* (- y x) z)) (+ x (* 6.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2700000.0) || !(z <= 0.0068)) {
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 <= (-2700000.0d0)) .or. (.not. (z <= 0.0068d0))) 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 <= -2700000.0) || !(z <= 0.0068)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2700000.0) or not (z <= 0.0068): 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 <= -2700000.0) || !(z <= 0.0068)) 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 <= -2700000.0) || ~((z <= 0.0068))) 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, -2700000.0], N[Not[LessEqual[z, 0.0068]], $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 -2700000 \lor \neg \left(z \leq 0.0068\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 < -2.7e6 or 0.00679999999999999962 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.6%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 98.8%
if -2.7e6 < z < 0.00679999999999999962Initial program 99.9%
Taylor expanded in y around inf 99.1%
*-commutative99.1%
Simplified99.1%
Final simplification99.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -920.0) (not (<= z 0.0068))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -920.0) || !(z <= 0.0068)) {
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 <= (-920.0d0)) .or. (.not. (z <= 0.0068d0))) 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 <= -920.0) || !(z <= 0.0068)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -920.0) or not (z <= 0.0068): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -920.0) || !(z <= 0.0068)) 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 <= -920.0) || ~((z <= 0.0068))) tmp = -6.0 * (x * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -920.0], N[Not[LessEqual[z, 0.0068]], $MachinePrecision]], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -920 \lor \neg \left(z \leq 0.0068\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -920 or 0.00679999999999999962 < z Initial program 99.7%
Taylor expanded in y around 0 53.5%
Taylor expanded in z around inf 52.7%
if -920 < z < 0.00679999999999999962Initial program 99.9%
Taylor expanded in z around 0 70.6%
Final simplification62.6%
(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 40.3%
Final simplification40.3%
(FPCore (x y z) :precision binary64 (- x (* (* 6.0 z) (- x y))))
double code(double x, double y, double z) {
return x - ((6.0 * z) * (x - y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x - ((6.0d0 * z) * (x - y))
end function
public static double code(double x, double y, double z) {
return x - ((6.0 * z) * (x - y));
}
def code(x, y, z): return x - ((6.0 * z) * (x - y))
function code(x, y, z) return Float64(x - Float64(Float64(6.0 * z) * Float64(x - y))) end
function tmp = code(x, y, z) tmp = x - ((6.0 * z) * (x - y)); end
code[x_, y_, z_] := N[(x - N[(N[(6.0 * z), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(6 \cdot z\right) \cdot \left(x - y\right)
\end{array}
herbie shell --seed 2024026
(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)))