
(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 14 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
(let* ((t_0 (* y (* 6.0 z))))
(if (<= z -2.2e-7)
t_0
(if (<= z 4.8e-16) x (if (<= z 4.1e+247) t_0 (* x (* z -6.0)))))))
double code(double x, double y, double z) {
double t_0 = y * (6.0 * z);
double tmp;
if (z <= -2.2e-7) {
tmp = t_0;
} else if (z <= 4.8e-16) {
tmp = x;
} else if (z <= 4.1e+247) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = y * (6.0d0 * z)
if (z <= (-2.2d-7)) then
tmp = t_0
else if (z <= 4.8d-16) then
tmp = x
else if (z <= 4.1d+247) then
tmp = t_0
else
tmp = x * (z * (-6.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * (6.0 * z);
double tmp;
if (z <= -2.2e-7) {
tmp = t_0;
} else if (z <= 4.8e-16) {
tmp = x;
} else if (z <= 4.1e+247) {
tmp = t_0;
} else {
tmp = x * (z * -6.0);
}
return tmp;
}
def code(x, y, z): t_0 = y * (6.0 * z) tmp = 0 if z <= -2.2e-7: tmp = t_0 elif z <= 4.8e-16: tmp = x elif z <= 4.1e+247: tmp = t_0 else: tmp = x * (z * -6.0) return tmp
function code(x, y, z) t_0 = Float64(y * Float64(6.0 * z)) tmp = 0.0 if (z <= -2.2e-7) tmp = t_0; elseif (z <= 4.8e-16) tmp = x; elseif (z <= 4.1e+247) tmp = t_0; else tmp = Float64(x * Float64(z * -6.0)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (6.0 * z); tmp = 0.0; if (z <= -2.2e-7) tmp = t_0; elseif (z <= 4.8e-16) tmp = x; elseif (z <= 4.1e+247) tmp = t_0; else tmp = x * (z * -6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.2e-7], t$95$0, If[LessEqual[z, 4.8e-16], x, If[LessEqual[z, 4.1e+247], t$95$0, N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(6 \cdot z\right)\\
\mathbf{if}\;z \leq -2.2 \cdot 10^{-7}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-16}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.1 \cdot 10^{+247}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot -6\right)\\
\end{array}
\end{array}
if z < -2.2000000000000001e-7 or 4.8000000000000001e-16 < z < 4.1000000000000002e247Initial program 99.7%
Taylor expanded in z around inf 99.7%
Taylor expanded in z around inf 97.8%
Taylor expanded in y around 0 94.4%
+-commutative94.4%
metadata-eval94.4%
*-commutative94.4%
associate-*r*94.4%
neg-mul-194.4%
distribute-rgt-neg-in94.4%
distribute-lft-out94.5%
*-commutative94.5%
distribute-rgt-out97.8%
sub-neg97.8%
associate-*l*97.8%
Simplified97.8%
Taylor expanded in y around inf 58.3%
*-commutative58.3%
associate-*r*58.4%
Simplified58.4%
if -2.2000000000000001e-7 < z < 4.8000000000000001e-16Initial program 99.9%
Taylor expanded in z around 0 73.5%
if 4.1000000000000002e247 < z Initial program 99.9%
Taylor expanded in z around inf 99.9%
Taylor expanded in z around inf 99.8%
Taylor expanded in y around 0 72.6%
*-commutative72.6%
associate-*r*72.7%
Simplified72.7%
Final simplification66.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))))
(if (<= z -2.2e-7)
t_0
(if (<= z 5.8e-15) x (if (<= z 1.65e+219) 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.2e-7) {
tmp = t_0;
} else if (z <= 5.8e-15) {
tmp = x;
} else if (z <= 1.65e+219) {
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.2d-7)) then
tmp = t_0
else if (z <= 5.8d-15) then
tmp = x
else if (z <= 1.65d+219) 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.2e-7) {
tmp = t_0;
} else if (z <= 5.8e-15) {
tmp = x;
} else if (z <= 1.65e+219) {
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.2e-7: tmp = t_0 elif z <= 5.8e-15: tmp = x elif z <= 1.65e+219: 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.2e-7) tmp = t_0; elseif (z <= 5.8e-15) tmp = x; elseif (z <= 1.65e+219) 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.2e-7) tmp = t_0; elseif (z <= 5.8e-15) tmp = x; elseif (z <= 1.65e+219) 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.2e-7], t$95$0, If[LessEqual[z, 5.8e-15], x, If[LessEqual[z, 1.65e+219], 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.2 \cdot 10^{-7}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{-15}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{+219}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if z < -2.2000000000000001e-7 or 5.80000000000000037e-15 < z < 1.6500000000000001e219Initial program 99.7%
Taylor expanded in z around inf 99.7%
Taylor expanded in z around inf 97.7%
Taylor expanded in y around inf 58.4%
if -2.2000000000000001e-7 < z < 5.80000000000000037e-15Initial program 99.9%
Taylor expanded in z around 0 73.5%
if 1.6500000000000001e219 < z Initial program 99.9%
Taylor expanded in z around inf 99.9%
Taylor expanded in z around inf 99.7%
Taylor expanded in y around 0 70.2%
Final simplification66.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -82000.0) (not (<= z 1.75e-13))) (* 6.0 (* (- y x) z)) (* x (+ (* z -6.0) 1.0))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -82000.0) || !(z <= 1.75e-13)) {
tmp = 6.0 * ((y - x) * z);
} 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 <= (-82000.0d0)) .or. (.not. (z <= 1.75d-13))) then
tmp = 6.0d0 * ((y - x) * z)
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 <= -82000.0) || !(z <= 1.75e-13)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x * ((z * -6.0) + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -82000.0) or not (z <= 1.75e-13): tmp = 6.0 * ((y - x) * z) else: tmp = x * ((z * -6.0) + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -82000.0) || !(z <= 1.75e-13)) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); 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 <= -82000.0) || ~((z <= 1.75e-13))) tmp = 6.0 * ((y - x) * z); else tmp = x * ((z * -6.0) + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -82000.0], N[Not[LessEqual[z, 1.75e-13]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(z * -6.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -82000 \lor \neg \left(z \leq 1.75 \cdot 10^{-13}\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\
\end{array}
\end{array}
if z < -82000 or 1.7500000000000001e-13 < z Initial program 99.7%
Taylor expanded in z around inf 99.7%
Taylor expanded in z around inf 98.8%
if -82000 < z < 1.7500000000000001e-13Initial program 99.9%
Taylor expanded in x around inf 74.0%
+-commutative74.0%
Simplified74.0%
Final simplification87.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.3e-7) (not (<= z 4.5e-15))) (* 6.0 (* (- y x) z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.3e-7) || !(z <= 4.5e-15)) {
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.3d-7)) .or. (.not. (z <= 4.5d-15))) 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.3e-7) || !(z <= 4.5e-15)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.3e-7) or not (z <= 4.5e-15): tmp = 6.0 * ((y - x) * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.3e-7) || !(z <= 4.5e-15)) 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.3e-7) || ~((z <= 4.5e-15))) tmp = 6.0 * ((y - x) * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.3e-7], N[Not[LessEqual[z, 4.5e-15]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{-7} \lor \neg \left(z \leq 4.5 \cdot 10^{-15}\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.29999999999999995e-7 or 4.4999999999999998e-15 < z Initial program 99.7%
Taylor expanded in z around inf 99.7%
Taylor expanded in z around inf 98.0%
if -2.29999999999999995e-7 < z < 4.4999999999999998e-15Initial program 99.9%
Taylor expanded in z around 0 73.5%
Final simplification86.8%
(FPCore (x y z) :precision binary64 (if (<= z -140.0) (* (- y x) (* 6.0 z)) (if (<= z 1.75e-13) (+ x (* z (* y 6.0))) (* z (* (- y x) 6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -140.0) {
tmp = (y - x) * (6.0 * z);
} else if (z <= 1.75e-13) {
tmp = x + (z * (y * 6.0));
} 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 <= (-140.0d0)) then
tmp = (y - x) * (6.0d0 * z)
else if (z <= 1.75d-13) then
tmp = x + (z * (y * 6.0d0))
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 <= -140.0) {
tmp = (y - x) * (6.0 * z);
} else if (z <= 1.75e-13) {
tmp = x + (z * (y * 6.0));
} else {
tmp = z * ((y - x) * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -140.0: tmp = (y - x) * (6.0 * z) elif z <= 1.75e-13: tmp = x + (z * (y * 6.0)) else: tmp = z * ((y - x) * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -140.0) tmp = Float64(Float64(y - x) * Float64(6.0 * z)); elseif (z <= 1.75e-13) tmp = Float64(x + Float64(z * Float64(y * 6.0))); 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 <= -140.0) tmp = (y - x) * (6.0 * z); elseif (z <= 1.75e-13) tmp = x + (z * (y * 6.0)); else tmp = z * ((y - x) * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -140.0], N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.75e-13], N[(x + N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -140:\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{-13}:\\
\;\;\;\;x + z \cdot \left(y \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\end{array}
\end{array}
if z < -140Initial program 99.7%
Taylor expanded in z around inf 99.7%
Taylor expanded in z around inf 97.0%
Taylor expanded in y around 0 92.0%
+-commutative92.0%
metadata-eval92.0%
*-commutative92.0%
associate-*r*92.0%
neg-mul-192.0%
distribute-rgt-neg-in92.0%
distribute-lft-out92.0%
*-commutative92.0%
distribute-rgt-out97.0%
sub-neg97.0%
associate-*l*97.1%
Simplified97.1%
if -140 < z < 1.7500000000000001e-13Initial program 99.9%
Taylor expanded in y around inf 99.3%
if 1.7500000000000001e-13 < z Initial program 99.8%
Taylor expanded in z around inf 99.8%
Taylor expanded in z around inf 98.8%
Taylor expanded in y around 0 97.3%
+-commutative97.3%
metadata-eval97.3%
*-commutative97.3%
associate-*r*97.3%
neg-mul-197.3%
distribute-rgt-neg-in97.3%
distribute-lft-out97.4%
*-commutative97.4%
distribute-rgt-out98.8%
sub-neg98.8%
associate-*l*98.8%
Simplified98.8%
Taylor expanded in z around 0 98.8%
*-commutative98.8%
associate-*l*98.8%
Simplified98.8%
Final simplification98.6%
(FPCore (x y z) :precision binary64 (if (<= z -140.0) (* (- y x) (* 6.0 z)) (if (<= z 1.75e-13) (+ x (* y (* 6.0 z))) (* z (* (- y x) 6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -140.0) {
tmp = (y - x) * (6.0 * z);
} else if (z <= 1.75e-13) {
tmp = x + (y * (6.0 * 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 <= (-140.0d0)) then
tmp = (y - x) * (6.0d0 * z)
else if (z <= 1.75d-13) then
tmp = x + (y * (6.0d0 * 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 <= -140.0) {
tmp = (y - x) * (6.0 * z);
} else if (z <= 1.75e-13) {
tmp = x + (y * (6.0 * z));
} else {
tmp = z * ((y - x) * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -140.0: tmp = (y - x) * (6.0 * z) elif z <= 1.75e-13: tmp = x + (y * (6.0 * z)) else: tmp = z * ((y - x) * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -140.0) tmp = Float64(Float64(y - x) * Float64(6.0 * z)); elseif (z <= 1.75e-13) tmp = Float64(x + Float64(y * Float64(6.0 * 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 <= -140.0) tmp = (y - x) * (6.0 * z); elseif (z <= 1.75e-13) tmp = x + (y * (6.0 * z)); else tmp = z * ((y - x) * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -140.0], N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.75e-13], N[(x + N[(y * N[(6.0 * 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 -140:\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{-13}:\\
\;\;\;\;x + y \cdot \left(6 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\end{array}
\end{array}
if z < -140Initial program 99.7%
Taylor expanded in z around inf 99.7%
Taylor expanded in z around inf 97.0%
Taylor expanded in y around 0 92.0%
+-commutative92.0%
metadata-eval92.0%
*-commutative92.0%
associate-*r*92.0%
neg-mul-192.0%
distribute-rgt-neg-in92.0%
distribute-lft-out92.0%
*-commutative92.0%
distribute-rgt-out97.0%
sub-neg97.0%
associate-*l*97.1%
Simplified97.1%
if -140 < z < 1.7500000000000001e-13Initial program 99.9%
Taylor expanded in y around inf 99.1%
*-commutative99.1%
associate-*r*99.2%
Simplified99.2%
if 1.7500000000000001e-13 < z Initial program 99.8%
Taylor expanded in z around inf 99.8%
Taylor expanded in z around inf 98.8%
Taylor expanded in y around 0 97.3%
+-commutative97.3%
metadata-eval97.3%
*-commutative97.3%
associate-*r*97.3%
neg-mul-197.3%
distribute-rgt-neg-in97.3%
distribute-lft-out97.4%
*-commutative97.4%
distribute-rgt-out98.8%
sub-neg98.8%
associate-*l*98.8%
Simplified98.8%
Taylor expanded in z around 0 98.8%
*-commutative98.8%
associate-*l*98.8%
Simplified98.8%
Final simplification98.6%
(FPCore (x y z) :precision binary64 (if (<= z -0.195) (* (- y x) (* 6.0 z)) (if (<= z 1.75e-13) (+ x (* 6.0 (* y z))) (* z (* (- y x) 6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.195) {
tmp = (y - x) * (6.0 * z);
} else if (z <= 1.75e-13) {
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.195d0)) then
tmp = (y - x) * (6.0d0 * z)
else if (z <= 1.75d-13) 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.195) {
tmp = (y - x) * (6.0 * z);
} else if (z <= 1.75e-13) {
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.195: tmp = (y - x) * (6.0 * z) elif z <= 1.75e-13: 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.195) tmp = Float64(Float64(y - x) * Float64(6.0 * z)); elseif (z <= 1.75e-13) 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.195) tmp = (y - x) * (6.0 * z); elseif (z <= 1.75e-13) 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.195], N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.75e-13], 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.195:\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{-13}:\\
\;\;\;\;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.19500000000000001Initial program 99.7%
Taylor expanded in z around inf 99.7%
Taylor expanded in z around inf 97.0%
Taylor expanded in y around 0 92.1%
+-commutative92.1%
metadata-eval92.1%
*-commutative92.1%
associate-*r*92.1%
neg-mul-192.1%
distribute-rgt-neg-in92.1%
distribute-lft-out92.1%
*-commutative92.1%
distribute-rgt-out97.0%
sub-neg97.0%
associate-*l*97.2%
Simplified97.2%
if -0.19500000000000001 < z < 1.7500000000000001e-13Initial program 99.9%
Taylor expanded in y around inf 99.1%
*-commutative99.1%
Simplified99.1%
if 1.7500000000000001e-13 < z Initial program 99.8%
Taylor expanded in z around inf 99.8%
Taylor expanded in z around inf 98.8%
Taylor expanded in y around 0 97.3%
+-commutative97.3%
metadata-eval97.3%
*-commutative97.3%
associate-*r*97.3%
neg-mul-197.3%
distribute-rgt-neg-in97.3%
distribute-lft-out97.4%
*-commutative97.4%
distribute-rgt-out98.8%
sub-neg98.8%
associate-*l*98.8%
Simplified98.8%
Taylor expanded in z around 0 98.8%
*-commutative98.8%
associate-*l*98.8%
Simplified98.8%
Final simplification98.6%
(FPCore (x y z) :precision binary64 (if (<= z -82000.0) (* (- y x) (* 6.0 z)) (if (<= z 1.1e-15) (* x (+ (* z -6.0) 1.0)) (* z (* (- y x) 6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -82000.0) {
tmp = (y - x) * (6.0 * z);
} else if (z <= 1.1e-15) {
tmp = x * ((z * -6.0) + 1.0);
} 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 <= (-82000.0d0)) then
tmp = (y - x) * (6.0d0 * z)
else if (z <= 1.1d-15) then
tmp = x * ((z * (-6.0d0)) + 1.0d0)
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 <= -82000.0) {
tmp = (y - x) * (6.0 * z);
} else if (z <= 1.1e-15) {
tmp = x * ((z * -6.0) + 1.0);
} else {
tmp = z * ((y - x) * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -82000.0: tmp = (y - x) * (6.0 * z) elif z <= 1.1e-15: tmp = x * ((z * -6.0) + 1.0) else: tmp = z * ((y - x) * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -82000.0) tmp = Float64(Float64(y - x) * Float64(6.0 * z)); elseif (z <= 1.1e-15) tmp = Float64(x * Float64(Float64(z * -6.0) + 1.0)); 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 <= -82000.0) tmp = (y - x) * (6.0 * z); elseif (z <= 1.1e-15) tmp = x * ((z * -6.0) + 1.0); else tmp = z * ((y - x) * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -82000.0], N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.1e-15], N[(x * N[(N[(z * -6.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -82000:\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-15}:\\
\;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\end{array}
\end{array}
if z < -82000Initial program 99.7%
Taylor expanded in z around inf 99.7%
Taylor expanded in z around inf 98.8%
Taylor expanded in y around 0 93.7%
+-commutative93.7%
metadata-eval93.7%
*-commutative93.7%
associate-*r*93.7%
neg-mul-193.7%
distribute-rgt-neg-in93.7%
distribute-lft-out93.7%
*-commutative93.7%
distribute-rgt-out98.8%
sub-neg98.8%
associate-*l*98.9%
Simplified98.9%
if -82000 < z < 1.09999999999999993e-15Initial program 99.9%
Taylor expanded in x around inf 74.0%
+-commutative74.0%
Simplified74.0%
if 1.09999999999999993e-15 < z Initial program 99.8%
Taylor expanded in z around inf 99.8%
Taylor expanded in z around inf 98.8%
Taylor expanded in y around 0 97.3%
+-commutative97.3%
metadata-eval97.3%
*-commutative97.3%
associate-*r*97.3%
neg-mul-197.3%
distribute-rgt-neg-in97.3%
distribute-lft-out97.4%
*-commutative97.4%
distribute-rgt-out98.8%
sub-neg98.8%
associate-*l*98.8%
Simplified98.8%
Taylor expanded in z around 0 98.8%
*-commutative98.8%
associate-*l*98.8%
Simplified98.8%
Final simplification87.2%
(FPCore (x y z) :precision binary64 (if (<= z -82000.0) (* 6.0 (* (- y x) z)) (if (<= z 1.75e-13) (* x (+ (* z -6.0) 1.0)) (* z (* (- y x) 6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -82000.0) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 1.75e-13) {
tmp = x * ((z * -6.0) + 1.0);
} 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 <= (-82000.0d0)) then
tmp = 6.0d0 * ((y - x) * z)
else if (z <= 1.75d-13) then
tmp = x * ((z * (-6.0d0)) + 1.0d0)
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 <= -82000.0) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 1.75e-13) {
tmp = x * ((z * -6.0) + 1.0);
} else {
tmp = z * ((y - x) * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -82000.0: tmp = 6.0 * ((y - x) * z) elif z <= 1.75e-13: tmp = x * ((z * -6.0) + 1.0) else: tmp = z * ((y - x) * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -82000.0) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); elseif (z <= 1.75e-13) tmp = Float64(x * Float64(Float64(z * -6.0) + 1.0)); 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 <= -82000.0) tmp = 6.0 * ((y - x) * z); elseif (z <= 1.75e-13) tmp = x * ((z * -6.0) + 1.0); else tmp = z * ((y - x) * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -82000.0], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.75e-13], N[(x * N[(N[(z * -6.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -82000:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{-13}:\\
\;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\end{array}
\end{array}
if z < -82000Initial program 99.7%
Taylor expanded in z around inf 99.7%
Taylor expanded in z around inf 98.8%
if -82000 < z < 1.7500000000000001e-13Initial program 99.9%
Taylor expanded in x around inf 74.0%
+-commutative74.0%
Simplified74.0%
if 1.7500000000000001e-13 < z Initial program 99.8%
Taylor expanded in z around inf 99.8%
Taylor expanded in z around inf 98.8%
Taylor expanded in y around 0 97.3%
+-commutative97.3%
metadata-eval97.3%
*-commutative97.3%
associate-*r*97.3%
neg-mul-197.3%
distribute-rgt-neg-in97.3%
distribute-lft-out97.4%
*-commutative97.4%
distribute-rgt-out98.8%
sub-neg98.8%
associate-*l*98.8%
Simplified98.8%
Taylor expanded in z around 0 98.8%
*-commutative98.8%
associate-*l*98.8%
Simplified98.8%
Final simplification87.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.17) (not (<= z 1.75e-13))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.17) || !(z <= 1.75e-13)) {
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 <= 1.75d-13))) 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 <= 1.75e-13)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.17) or not (z <= 1.75e-13): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.17) || !(z <= 1.75e-13)) 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 <= 1.75e-13))) 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, 1.75e-13]], $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 1.75 \cdot 10^{-13}\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.170000000000000012 or 1.7500000000000001e-13 < z Initial program 99.7%
Taylor expanded in z around inf 99.7%
Taylor expanded in z around inf 98.0%
Taylor expanded in y around 0 45.2%
if -0.170000000000000012 < z < 1.7500000000000001e-13Initial program 99.9%
Taylor expanded in z around 0 73.5%
Final simplification58.1%
(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 35.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 2024191
(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)))