
(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) (* 6.0 z) x))
double code(double x, double y, double z) {
return fma((y - x), (6.0 * z), x);
}
function code(x, y, z) return fma(Float64(y - x), Float64(6.0 * z), x) end
code[x_, y_, z_] := N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - x, 6 \cdot z, x\right)
\end{array}
Initial program 99.8%
+-commutative99.8%
associate-*l*99.8%
fma-define99.8%
Simplified99.8%
(FPCore (x y z) :precision binary64 (if (<= z -13500000.0) (* z (* (- y x) 6.0)) (if (<= z 0.108) (+ x (* y (* 6.0 z))) (* z (+ (* x -6.0) (* y 6.0))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -13500000.0) {
tmp = z * ((y - x) * 6.0);
} else if (z <= 0.108) {
tmp = x + (y * (6.0 * z));
} else {
tmp = z * ((x * -6.0) + (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 <= (-13500000.0d0)) then
tmp = z * ((y - x) * 6.0d0)
else if (z <= 0.108d0) then
tmp = x + (y * (6.0d0 * z))
else
tmp = z * ((x * (-6.0d0)) + (y * 6.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -13500000.0) {
tmp = z * ((y - x) * 6.0);
} else if (z <= 0.108) {
tmp = x + (y * (6.0 * z));
} else {
tmp = z * ((x * -6.0) + (y * 6.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -13500000.0: tmp = z * ((y - x) * 6.0) elif z <= 0.108: tmp = x + (y * (6.0 * z)) else: tmp = z * ((x * -6.0) + (y * 6.0)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -13500000.0) tmp = Float64(z * Float64(Float64(y - x) * 6.0)); elseif (z <= 0.108) tmp = Float64(x + Float64(y * Float64(6.0 * z))); else tmp = Float64(z * Float64(Float64(x * -6.0) + Float64(y * 6.0))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -13500000.0) tmp = z * ((y - x) * 6.0); elseif (z <= 0.108) tmp = x + (y * (6.0 * z)); else tmp = z * ((x * -6.0) + (y * 6.0)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -13500000.0], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.108], N[(x + N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(x * -6.0), $MachinePrecision] + N[(y * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -13500000:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\mathbf{elif}\;z \leq 0.108:\\
\;\;\;\;x + y \cdot \left(6 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(x \cdot -6 + y \cdot 6\right)\\
\end{array}
\end{array}
if z < -1.35e7Initial program 99.5%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 99.3%
associate-*r*99.3%
*-commutative99.3%
associate-*r*99.1%
Simplified99.1%
if -1.35e7 < z < 0.107999999999999999Initial program 99.9%
Taylor expanded in y around inf 98.7%
*-commutative98.7%
associate-*r*98.8%
Simplified98.8%
if 0.107999999999999999 < z Initial program 99.8%
Taylor expanded in x around 0 97.3%
fma-define97.3%
*-commutative97.3%
+-commutative97.3%
Simplified97.3%
Taylor expanded in z around inf 98.5%
Final simplification98.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -13500000.0) (not (<= z 0.108))) (* z (* (- y x) 6.0)) (+ x (* y (* 6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -13500000.0) || !(z <= 0.108)) {
tmp = z * ((y - x) * 6.0);
} else {
tmp = x + (y * (6.0 * 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 <= (-13500000.0d0)) .or. (.not. (z <= 0.108d0))) then
tmp = z * ((y - x) * 6.0d0)
else
tmp = x + (y * (6.0d0 * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -13500000.0) || !(z <= 0.108)) {
tmp = z * ((y - x) * 6.0);
} else {
tmp = x + (y * (6.0 * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -13500000.0) or not (z <= 0.108): tmp = z * ((y - x) * 6.0) else: tmp = x + (y * (6.0 * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -13500000.0) || !(z <= 0.108)) tmp = Float64(z * Float64(Float64(y - x) * 6.0)); else tmp = Float64(x + Float64(y * Float64(6.0 * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -13500000.0) || ~((z <= 0.108))) tmp = z * ((y - x) * 6.0); else tmp = x + (y * (6.0 * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -13500000.0], N[Not[LessEqual[z, 0.108]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -13500000 \lor \neg \left(z \leq 0.108\right):\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if z < -1.35e7 or 0.107999999999999999 < z Initial program 99.7%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 98.7%
associate-*r*98.8%
*-commutative98.8%
associate-*r*98.7%
Simplified98.7%
if -1.35e7 < z < 0.107999999999999999Initial program 99.9%
Taylor expanded in y around inf 98.7%
*-commutative98.7%
associate-*r*98.8%
Simplified98.8%
Final simplification98.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -13500000.0) (not (<= z 0.108))) (* z (* (- y x) 6.0)) (+ x (* 6.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -13500000.0) || !(z <= 0.108)) {
tmp = z * ((y - x) * 6.0);
} 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 <= (-13500000.0d0)) .or. (.not. (z <= 0.108d0))) then
tmp = z * ((y - x) * 6.0d0)
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 <= -13500000.0) || !(z <= 0.108)) {
tmp = z * ((y - x) * 6.0);
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -13500000.0) or not (z <= 0.108): tmp = z * ((y - x) * 6.0) else: tmp = x + (6.0 * (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -13500000.0) || !(z <= 0.108)) tmp = Float64(z * Float64(Float64(y - x) * 6.0)); 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 <= -13500000.0) || ~((z <= 0.108))) tmp = z * ((y - x) * 6.0); else tmp = x + (6.0 * (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -13500000.0], N[Not[LessEqual[z, 0.108]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -13500000 \lor \neg \left(z \leq 0.108\right):\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if z < -1.35e7 or 0.107999999999999999 < z Initial program 99.7%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 98.7%
associate-*r*98.8%
*-commutative98.8%
associate-*r*98.7%
Simplified98.7%
if -1.35e7 < z < 0.107999999999999999Initial program 99.9%
Taylor expanded in y around inf 98.7%
*-commutative98.7%
Simplified98.7%
Final simplification98.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -7.8e-153) (not (<= z 0.00175))) (* z (* (- y x) 6.0)) (* x (+ (* z -6.0) 1.0))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -7.8e-153) || !(z <= 0.00175)) {
tmp = z * ((y - x) * 6.0);
} else {
tmp = x * ((z * -6.0) + 1.0);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-7.8d-153)) .or. (.not. (z <= 0.00175d0))) then
tmp = z * ((y - x) * 6.0d0)
else
tmp = x * ((z * (-6.0d0)) + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -7.8e-153) || !(z <= 0.00175)) {
tmp = z * ((y - x) * 6.0);
} else {
tmp = x * ((z * -6.0) + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -7.8e-153) or not (z <= 0.00175): tmp = z * ((y - x) * 6.0) else: tmp = x * ((z * -6.0) + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -7.8e-153) || !(z <= 0.00175)) tmp = Float64(z * Float64(Float64(y - x) * 6.0)); else tmp = Float64(x * Float64(Float64(z * -6.0) + 1.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -7.8e-153) || ~((z <= 0.00175))) tmp = z * ((y - x) * 6.0); else tmp = x * ((z * -6.0) + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -7.8e-153], N[Not[LessEqual[z, 0.00175]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(z * -6.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.8 \cdot 10^{-153} \lor \neg \left(z \leq 0.00175\right):\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\
\end{array}
\end{array}
if z < -7.8000000000000004e-153 or 0.00175000000000000004 < z Initial program 99.7%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 94.2%
associate-*r*94.3%
*-commutative94.3%
associate-*r*94.2%
Simplified94.2%
if -7.8000000000000004e-153 < z < 0.00175000000000000004Initial program 99.9%
Taylor expanded in x around inf 75.8%
+-commutative75.8%
Simplified75.8%
Final simplification87.5%
(FPCore (x y z) :precision binary64 (if (<= y -1.35e+91) (* z (* y 6.0)) (if (<= y 5.8e+36) (* x (+ (* z -6.0) 1.0)) (* y (* 6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.35e+91) {
tmp = z * (y * 6.0);
} else if (y <= 5.8e+36) {
tmp = x * ((z * -6.0) + 1.0);
} else {
tmp = y * (6.0 * 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 (y <= (-1.35d+91)) then
tmp = z * (y * 6.0d0)
else if (y <= 5.8d+36) then
tmp = x * ((z * (-6.0d0)) + 1.0d0)
else
tmp = y * (6.0d0 * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.35e+91) {
tmp = z * (y * 6.0);
} else if (y <= 5.8e+36) {
tmp = x * ((z * -6.0) + 1.0);
} else {
tmp = y * (6.0 * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.35e+91: tmp = z * (y * 6.0) elif y <= 5.8e+36: tmp = x * ((z * -6.0) + 1.0) else: tmp = y * (6.0 * z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.35e+91) tmp = Float64(z * Float64(y * 6.0)); elseif (y <= 5.8e+36) tmp = Float64(x * Float64(Float64(z * -6.0) + 1.0)); else tmp = Float64(y * Float64(6.0 * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.35e+91) tmp = z * (y * 6.0); elseif (y <= 5.8e+36) tmp = x * ((z * -6.0) + 1.0); else tmp = y * (6.0 * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.35e+91], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.8e+36], N[(x * N[(N[(z * -6.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.35 \cdot 10^{+91}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{+36}:\\
\;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if y < -1.35e91Initial program 99.9%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.6%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 79.7%
*-commutative79.7%
associate-*r*79.8%
*-commutative79.8%
associate-*r*79.9%
Simplified79.9%
if -1.35e91 < y < 5.8e36Initial program 99.7%
Taylor expanded in x around inf 82.6%
+-commutative82.6%
Simplified82.6%
if 5.8e36 < y Initial program 99.8%
Taylor expanded in x around 0 98.1%
fma-define98.1%
*-commutative98.1%
+-commutative98.1%
Simplified98.1%
Taylor expanded in y around inf 73.9%
*-commutative73.9%
associate-*r*74.0%
Simplified74.0%
Final simplification80.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -13500000.0) (not (<= z 3350.0))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -13500000.0) || !(z <= 3350.0)) {
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 <= (-13500000.0d0)) .or. (.not. (z <= 3350.0d0))) 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 <= -13500000.0) || !(z <= 3350.0)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -13500000.0) or not (z <= 3350.0): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -13500000.0) || !(z <= 3350.0)) 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 <= -13500000.0) || ~((z <= 3350.0))) tmp = -6.0 * (x * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -13500000.0], N[Not[LessEqual[z, 3350.0]], $MachinePrecision]], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -13500000 \lor \neg \left(z \leq 3350\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.35e7 or 3350 < z Initial program 99.7%
Taylor expanded in y around 0 56.3%
Taylor expanded in z around inf 55.4%
if -1.35e7 < z < 3350Initial program 99.9%
Taylor expanded in z around 0 66.5%
Final simplification60.4%
(FPCore (x y z) :precision binary64 (if (<= z -7.8e-153) (* y (* 6.0 z)) (if (<= z 3350.0) x (* x (* z -6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -7.8e-153) {
tmp = y * (6.0 * z);
} else if (z <= 3350.0) {
tmp = x;
} else {
tmp = x * (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 <= (-7.8d-153)) then
tmp = y * (6.0d0 * z)
else if (z <= 3350.0d0) then
tmp = x
else
tmp = x * (z * (-6.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -7.8e-153) {
tmp = y * (6.0 * z);
} else if (z <= 3350.0) {
tmp = x;
} else {
tmp = x * (z * -6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -7.8e-153: tmp = y * (6.0 * z) elif z <= 3350.0: tmp = x else: tmp = x * (z * -6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -7.8e-153) tmp = Float64(y * Float64(6.0 * z)); elseif (z <= 3350.0) tmp = x; else tmp = Float64(x * Float64(z * -6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -7.8e-153) tmp = y * (6.0 * z); elseif (z <= 3350.0) tmp = x; else tmp = x * (z * -6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -7.8e-153], N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3350.0], x, N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.8 \cdot 10^{-153}:\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq 3350:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot -6\right)\\
\end{array}
\end{array}
if z < -7.8000000000000004e-153Initial program 99.6%
Taylor expanded in x around 0 98.5%
fma-define98.5%
*-commutative98.5%
+-commutative98.5%
Simplified98.5%
Taylor expanded in y around inf 54.7%
*-commutative54.7%
associate-*r*54.8%
Simplified54.8%
if -7.8000000000000004e-153 < z < 3350Initial program 99.9%
Taylor expanded in z around 0 71.5%
if 3350 < z Initial program 99.8%
Taylor expanded in y around 0 62.4%
Taylor expanded in z around inf 61.0%
*-commutative61.0%
associate-*r*61.1%
*-commutative61.1%
Simplified61.1%
Final simplification63.0%
(FPCore (x y z) :precision binary64 (if (<= z -7.2e-153) (* 6.0 (* y z)) (if (<= z 3350.0) x (* x (* z -6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -7.2e-153) {
tmp = 6.0 * (y * z);
} else if (z <= 3350.0) {
tmp = x;
} else {
tmp = x * (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 <= (-7.2d-153)) then
tmp = 6.0d0 * (y * z)
else if (z <= 3350.0d0) then
tmp = x
else
tmp = x * (z * (-6.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -7.2e-153) {
tmp = 6.0 * (y * z);
} else if (z <= 3350.0) {
tmp = x;
} else {
tmp = x * (z * -6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -7.2e-153: tmp = 6.0 * (y * z) elif z <= 3350.0: tmp = x else: tmp = x * (z * -6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -7.2e-153) tmp = Float64(6.0 * Float64(y * z)); elseif (z <= 3350.0) tmp = x; else tmp = Float64(x * Float64(z * -6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -7.2e-153) tmp = 6.0 * (y * z); elseif (z <= 3350.0) tmp = x; else tmp = x * (z * -6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -7.2e-153], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3350.0], x, N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{-153}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq 3350:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot -6\right)\\
\end{array}
\end{array}
if z < -7.1999999999999995e-153Initial program 99.6%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 54.7%
*-commutative54.7%
Simplified54.7%
if -7.1999999999999995e-153 < z < 3350Initial program 99.9%
Taylor expanded in z around 0 71.5%
if 3350 < z Initial program 99.8%
Taylor expanded in y around 0 62.4%
Taylor expanded in z around inf 61.0%
*-commutative61.0%
associate-*r*61.1%
*-commutative61.1%
Simplified61.1%
Final simplification63.0%
(FPCore (x y z) :precision binary64 (if (<= z -7.8e-153) (* 6.0 (* y z)) (if (<= z 3350.0) x (* -6.0 (* x z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -7.8e-153) {
tmp = 6.0 * (y * z);
} else if (z <= 3350.0) {
tmp = x;
} 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) :: tmp
if (z <= (-7.8d-153)) then
tmp = 6.0d0 * (y * z)
else if (z <= 3350.0d0) then
tmp = x
else
tmp = (-6.0d0) * (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -7.8e-153) {
tmp = 6.0 * (y * z);
} else if (z <= 3350.0) {
tmp = x;
} else {
tmp = -6.0 * (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -7.8e-153: tmp = 6.0 * (y * z) elif z <= 3350.0: tmp = x else: tmp = -6.0 * (x * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -7.8e-153) tmp = Float64(6.0 * Float64(y * z)); elseif (z <= 3350.0) tmp = x; else tmp = Float64(-6.0 * Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -7.8e-153) tmp = 6.0 * (y * z); elseif (z <= 3350.0) tmp = x; else tmp = -6.0 * (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -7.8e-153], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3350.0], x, N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.8 \cdot 10^{-153}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq 3350:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if z < -7.8000000000000004e-153Initial program 99.6%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 54.7%
*-commutative54.7%
Simplified54.7%
if -7.8000000000000004e-153 < z < 3350Initial program 99.9%
Taylor expanded in z around 0 71.5%
if 3350 < z Initial program 99.8%
Taylor expanded in y around 0 62.4%
Taylor expanded in z around inf 61.0%
Final simplification63.0%
(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.8%
associate-*l*99.8%
Simplified99.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.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 31.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 2024163
(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)))