
(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 (+ x (/ z (/ (/ 1.0 (- y x)) 6.0))))
double code(double x, double y, double z) {
return x + (z / ((1.0 / (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 / ((1.0d0 / (y - x)) / 6.0d0))
end function
public static double code(double x, double y, double z) {
return x + (z / ((1.0 / (y - x)) / 6.0));
}
def code(x, y, z): return x + (z / ((1.0 / (y - x)) / 6.0))
function code(x, y, z) return Float64(x + Float64(z / Float64(Float64(1.0 / Float64(y - x)) / 6.0))) end
function tmp = code(x, y, z) tmp = x + (z / ((1.0 / (y - x)) / 6.0)); end
code[x_, y_, z_] := N[(x + N[(z / N[(N[(1.0 / N[(y - x), $MachinePrecision]), $MachinePrecision] / 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{z}{\frac{\frac{1}{y - x}}{6}}
\end{array}
Initial program 99.5%
associate-*r*99.4%
*-commutative99.4%
flip--68.5%
associate-*r/63.4%
Applied egg-rr63.4%
associate-/l*68.4%
*-commutative68.4%
associate-/l*68.8%
difference-of-squares70.6%
associate-/r*99.8%
*-inverses99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* x z))) (t_1 (* 6.0 (* z y))))
(if (<= z -4.2e+156)
t_0
(if (<= z -7.3e+78)
t_1
(if (<= z -9.5e+35)
t_0
(if (<= z -1.5e-60)
t_1
(if (<= z 3.6e-50) x (if (<= z 2.4e+235) t_1 t_0))))))))
double code(double x, double y, double z) {
double t_0 = -6.0 * (x * z);
double t_1 = 6.0 * (z * y);
double tmp;
if (z <= -4.2e+156) {
tmp = t_0;
} else if (z <= -7.3e+78) {
tmp = t_1;
} else if (z <= -9.5e+35) {
tmp = t_0;
} else if (z <= -1.5e-60) {
tmp = t_1;
} else if (z <= 3.6e-50) {
tmp = x;
} else if (z <= 2.4e+235) {
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 * (z * y)
if (z <= (-4.2d+156)) then
tmp = t_0
else if (z <= (-7.3d+78)) then
tmp = t_1
else if (z <= (-9.5d+35)) then
tmp = t_0
else if (z <= (-1.5d-60)) then
tmp = t_1
else if (z <= 3.6d-50) then
tmp = x
else if (z <= 2.4d+235) 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 * (z * y);
double tmp;
if (z <= -4.2e+156) {
tmp = t_0;
} else if (z <= -7.3e+78) {
tmp = t_1;
} else if (z <= -9.5e+35) {
tmp = t_0;
} else if (z <= -1.5e-60) {
tmp = t_1;
} else if (z <= 3.6e-50) {
tmp = x;
} else if (z <= 2.4e+235) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * (x * z) t_1 = 6.0 * (z * y) tmp = 0 if z <= -4.2e+156: tmp = t_0 elif z <= -7.3e+78: tmp = t_1 elif z <= -9.5e+35: tmp = t_0 elif z <= -1.5e-60: tmp = t_1 elif z <= 3.6e-50: tmp = x elif z <= 2.4e+235: 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(z * y)) tmp = 0.0 if (z <= -4.2e+156) tmp = t_0; elseif (z <= -7.3e+78) tmp = t_1; elseif (z <= -9.5e+35) tmp = t_0; elseif (z <= -1.5e-60) tmp = t_1; elseif (z <= 3.6e-50) tmp = x; elseif (z <= 2.4e+235) 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 * (z * y); tmp = 0.0; if (z <= -4.2e+156) tmp = t_0; elseif (z <= -7.3e+78) tmp = t_1; elseif (z <= -9.5e+35) tmp = t_0; elseif (z <= -1.5e-60) tmp = t_1; elseif (z <= 3.6e-50) tmp = x; elseif (z <= 2.4e+235) 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[(z * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.2e+156], t$95$0, If[LessEqual[z, -7.3e+78], t$95$1, If[LessEqual[z, -9.5e+35], t$95$0, If[LessEqual[z, -1.5e-60], t$95$1, If[LessEqual[z, 3.6e-50], x, If[LessEqual[z, 2.4e+235], 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(z \cdot y\right)\\
\mathbf{if}\;z \leq -4.2 \cdot 10^{+156}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -7.3 \cdot 10^{+78}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -9.5 \cdot 10^{+35}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.5 \cdot 10^{-60}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{-50}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{+235}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -4.19999999999999963e156 or -7.3e78 < z < -9.50000000000000062e35 or 2.3999999999999999e235 < z Initial program 99.8%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 99.7%
Taylor expanded in y around 0 73.7%
if -4.19999999999999963e156 < z < -7.3e78 or -9.50000000000000062e35 < z < -1.50000000000000009e-60 or 3.59999999999999979e-50 < z < 2.3999999999999999e235Initial program 99.6%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 88.6%
Taylor expanded in y around inf 57.3%
*-commutative57.3%
Simplified57.3%
if -1.50000000000000009e-60 < z < 3.59999999999999979e-50Initial program 99.1%
Taylor expanded in z around 0 77.7%
Final simplification68.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* x z))) (t_1 (* 6.0 (* z y))))
(if (<= z -3.3e+164)
t_0
(if (<= z -4.4e+79)
t_1
(if (<= z -4.8e+32)
t_0
(if (<= z -1.45e-60)
(* z (* y 6.0))
(if (<= z 3.2e-50) x (if (<= z 3.1e+230) t_1 t_0))))))))
double code(double x, double y, double z) {
double t_0 = -6.0 * (x * z);
double t_1 = 6.0 * (z * y);
double tmp;
if (z <= -3.3e+164) {
tmp = t_0;
} else if (z <= -4.4e+79) {
tmp = t_1;
} else if (z <= -4.8e+32) {
tmp = t_0;
} else if (z <= -1.45e-60) {
tmp = z * (y * 6.0);
} else if (z <= 3.2e-50) {
tmp = x;
} else if (z <= 3.1e+230) {
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 * (z * y)
if (z <= (-3.3d+164)) then
tmp = t_0
else if (z <= (-4.4d+79)) then
tmp = t_1
else if (z <= (-4.8d+32)) then
tmp = t_0
else if (z <= (-1.45d-60)) then
tmp = z * (y * 6.0d0)
else if (z <= 3.2d-50) then
tmp = x
else if (z <= 3.1d+230) 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 * (z * y);
double tmp;
if (z <= -3.3e+164) {
tmp = t_0;
} else if (z <= -4.4e+79) {
tmp = t_1;
} else if (z <= -4.8e+32) {
tmp = t_0;
} else if (z <= -1.45e-60) {
tmp = z * (y * 6.0);
} else if (z <= 3.2e-50) {
tmp = x;
} else if (z <= 3.1e+230) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * (x * z) t_1 = 6.0 * (z * y) tmp = 0 if z <= -3.3e+164: tmp = t_0 elif z <= -4.4e+79: tmp = t_1 elif z <= -4.8e+32: tmp = t_0 elif z <= -1.45e-60: tmp = z * (y * 6.0) elif z <= 3.2e-50: tmp = x elif z <= 3.1e+230: 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(z * y)) tmp = 0.0 if (z <= -3.3e+164) tmp = t_0; elseif (z <= -4.4e+79) tmp = t_1; elseif (z <= -4.8e+32) tmp = t_0; elseif (z <= -1.45e-60) tmp = Float64(z * Float64(y * 6.0)); elseif (z <= 3.2e-50) tmp = x; elseif (z <= 3.1e+230) 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 * (z * y); tmp = 0.0; if (z <= -3.3e+164) tmp = t_0; elseif (z <= -4.4e+79) tmp = t_1; elseif (z <= -4.8e+32) tmp = t_0; elseif (z <= -1.45e-60) tmp = z * (y * 6.0); elseif (z <= 3.2e-50) tmp = x; elseif (z <= 3.1e+230) 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[(z * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.3e+164], t$95$0, If[LessEqual[z, -4.4e+79], t$95$1, If[LessEqual[z, -4.8e+32], t$95$0, If[LessEqual[z, -1.45e-60], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.2e-50], x, If[LessEqual[z, 3.1e+230], 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(z \cdot y\right)\\
\mathbf{if}\;z \leq -3.3 \cdot 10^{+164}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -4.4 \cdot 10^{+79}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -4.8 \cdot 10^{+32}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.45 \cdot 10^{-60}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-50}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 3.1 \cdot 10^{+230}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -3.29999999999999995e164 or -4.3999999999999998e79 < z < -4.79999999999999983e32 or 3.09999999999999981e230 < z Initial program 99.8%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 99.7%
Taylor expanded in y around 0 73.7%
if -3.29999999999999995e164 < z < -4.3999999999999998e79 or 3.2e-50 < z < 3.09999999999999981e230Initial program 99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 92.8%
Taylor expanded in y around inf 56.4%
*-commutative56.4%
Simplified56.4%
if -4.79999999999999983e32 < z < -1.45e-60Initial program 99.5%
Taylor expanded in z around 0 99.3%
Taylor expanded in z around inf 73.9%
Taylor expanded in y around inf 60.4%
associate-*r*60.5%
*-commutative60.5%
Simplified60.5%
if -1.45e-60 < z < 3.2e-50Initial program 99.1%
Taylor expanded in z around 0 77.7%
Final simplification68.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.8e-82) (not (<= z 5.2e-50))) (* 6.0 (* z (- y x))) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.8e-82) || !(z <= 5.2e-50)) {
tmp = 6.0 * (z * (y - x));
} 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.8d-82)) .or. (.not. (z <= 5.2d-50))) then
tmp = 6.0d0 * (z * (y - x))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -2.8e-82) || !(z <= 5.2e-50)) {
tmp = 6.0 * (z * (y - x));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.8e-82) or not (z <= 5.2e-50): tmp = 6.0 * (z * (y - x)) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.8e-82) || !(z <= 5.2e-50)) tmp = Float64(6.0 * Float64(z * Float64(y - x))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.8e-82) || ~((z <= 5.2e-50))) tmp = 6.0 * (z * (y - x)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.8e-82], N[Not[LessEqual[z, 5.2e-50]], $MachinePrecision]], N[(6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{-82} \lor \neg \left(z \leq 5.2 \cdot 10^{-50}\right):\\
\;\;\;\;6 \cdot \left(z \cdot \left(y - x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.80000000000000024e-82 or 5.2000000000000003e-50 < z Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 91.5%
if -2.80000000000000024e-82 < z < 5.2000000000000003e-50Initial program 99.1%
Taylor expanded in z around 0 78.2%
Final simplification86.3%
(FPCore (x y z) :precision binary64 (if (<= z -4.2e-79) (* z (* (- y x) 6.0)) (if (<= z 5.4e-53) x (* 6.0 (* z (- y x))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -4.2e-79) {
tmp = z * ((y - x) * 6.0);
} else if (z <= 5.4e-53) {
tmp = x;
} else {
tmp = 6.0 * (z * (y - 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 <= (-4.2d-79)) then
tmp = z * ((y - x) * 6.0d0)
else if (z <= 5.4d-53) then
tmp = x
else
tmp = 6.0d0 * (z * (y - x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -4.2e-79) {
tmp = z * ((y - x) * 6.0);
} else if (z <= 5.4e-53) {
tmp = x;
} else {
tmp = 6.0 * (z * (y - x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4.2e-79: tmp = z * ((y - x) * 6.0) elif z <= 5.4e-53: tmp = x else: tmp = 6.0 * (z * (y - x)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4.2e-79) tmp = Float64(z * Float64(Float64(y - x) * 6.0)); elseif (z <= 5.4e-53) tmp = x; else tmp = Float64(6.0 * Float64(z * Float64(y - x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -4.2e-79) tmp = z * ((y - x) * 6.0); elseif (z <= 5.4e-53) tmp = x; else tmp = 6.0 * (z * (y - x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4.2e-79], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.4e-53], x, N[(6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{-79}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\mathbf{elif}\;z \leq 5.4 \cdot 10^{-53}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(z \cdot \left(y - x\right)\right)\\
\end{array}
\end{array}
if z < -4.1999999999999999e-79Initial program 99.7%
Taylor expanded in z around 0 99.6%
Taylor expanded in z around inf 90.9%
Taylor expanded in y around 0 89.7%
+-commutative89.7%
*-commutative89.7%
metadata-eval89.7%
associate-*r*89.7%
associate-*r*89.7%
neg-mul-189.7%
*-commutative89.7%
distribute-lft-in89.7%
distribute-lft-out90.9%
sub-neg90.9%
*-commutative90.9%
associate-*l*91.0%
Simplified91.0%
if -4.1999999999999999e-79 < z < 5.3999999999999998e-53Initial program 99.1%
Taylor expanded in z around 0 78.2%
if 5.3999999999999998e-53 < z Initial program 99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 92.2%
Final simplification86.4%
(FPCore (x y z) :precision binary64 (if (<= z -1e-82) (* z (* (- y x) 6.0)) (if (<= z 9.6e-52) (+ x (* -6.0 (* x z))) (* 6.0 (* z (- y x))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1e-82) {
tmp = z * ((y - x) * 6.0);
} else if (z <= 9.6e-52) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = 6.0 * (z * (y - 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 <= (-1d-82)) then
tmp = z * ((y - x) * 6.0d0)
else if (z <= 9.6d-52) then
tmp = x + ((-6.0d0) * (x * z))
else
tmp = 6.0d0 * (z * (y - x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1e-82) {
tmp = z * ((y - x) * 6.0);
} else if (z <= 9.6e-52) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = 6.0 * (z * (y - x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1e-82: tmp = z * ((y - x) * 6.0) elif z <= 9.6e-52: tmp = x + (-6.0 * (x * z)) else: tmp = 6.0 * (z * (y - x)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1e-82) tmp = Float64(z * Float64(Float64(y - x) * 6.0)); elseif (z <= 9.6e-52) tmp = Float64(x + Float64(-6.0 * Float64(x * z))); else tmp = Float64(6.0 * Float64(z * Float64(y - x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1e-82) tmp = z * ((y - x) * 6.0); elseif (z <= 9.6e-52) tmp = x + (-6.0 * (x * z)); else tmp = 6.0 * (z * (y - x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1e-82], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.6e-52], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{-82}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\mathbf{elif}\;z \leq 9.6 \cdot 10^{-52}:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(z \cdot \left(y - x\right)\right)\\
\end{array}
\end{array}
if z < -1e-82Initial program 99.7%
Taylor expanded in z around 0 99.6%
Taylor expanded in z around inf 90.9%
Taylor expanded in y around 0 89.7%
+-commutative89.7%
*-commutative89.7%
metadata-eval89.7%
associate-*r*89.7%
associate-*r*89.7%
neg-mul-189.7%
*-commutative89.7%
distribute-lft-in89.7%
distribute-lft-out90.9%
sub-neg90.9%
*-commutative90.9%
associate-*l*91.0%
Simplified91.0%
if -1e-82 < z < 9.6000000000000007e-52Initial program 99.1%
Taylor expanded in y around 0 78.2%
if 9.6000000000000007e-52 < z Initial program 99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 92.2%
Final simplification86.4%
(FPCore (x y z) :precision binary64 (if (<= z -0.17) (* z (* (- y x) 6.0)) (if (<= z 0.00024) (+ x (* 6.0 (* z y))) (* 6.0 (* z (- y x))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.17) {
tmp = z * ((y - x) * 6.0);
} else if (z <= 0.00024) {
tmp = x + (6.0 * (z * y));
} else {
tmp = 6.0 * (z * (y - 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)) then
tmp = z * ((y - x) * 6.0d0)
else if (z <= 0.00024d0) then
tmp = x + (6.0d0 * (z * y))
else
tmp = 6.0d0 * (z * (y - x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.17) {
tmp = z * ((y - x) * 6.0);
} else if (z <= 0.00024) {
tmp = x + (6.0 * (z * y));
} else {
tmp = 6.0 * (z * (y - x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.17: tmp = z * ((y - x) * 6.0) elif z <= 0.00024: tmp = x + (6.0 * (z * y)) else: tmp = 6.0 * (z * (y - x)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.17) tmp = Float64(z * Float64(Float64(y - x) * 6.0)); elseif (z <= 0.00024) tmp = Float64(x + Float64(6.0 * Float64(z * y))); else tmp = Float64(6.0 * Float64(z * Float64(y - x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.17) tmp = z * ((y - x) * 6.0); elseif (z <= 0.00024) tmp = x + (6.0 * (z * y)); else tmp = 6.0 * (z * (y - x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.17], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.00024], N[(x + N[(6.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.17:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\mathbf{elif}\;z \leq 0.00024:\\
\;\;\;\;x + 6 \cdot \left(z \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(z \cdot \left(y - x\right)\right)\\
\end{array}
\end{array}
if z < -0.170000000000000012Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 97.0%
Taylor expanded in y around 0 95.4%
+-commutative95.4%
*-commutative95.4%
metadata-eval95.4%
associate-*r*95.4%
associate-*r*95.4%
neg-mul-195.4%
*-commutative95.4%
distribute-lft-in95.4%
distribute-lft-out97.0%
sub-neg97.0%
*-commutative97.0%
associate-*l*97.0%
Simplified97.0%
if -0.170000000000000012 < z < 2.40000000000000006e-4Initial program 99.3%
Taylor expanded in y around inf 98.1%
*-commutative98.1%
Simplified98.1%
if 2.40000000000000006e-4 < z Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 98.6%
Final simplification98.0%
(FPCore (x y z) :precision binary64 (if (<= z -0.16) (* z (* (- y x) 6.0)) (if (<= z 7.5) (+ x (* z (* y 6.0))) (* 6.0 (* z (- y x))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.16) {
tmp = z * ((y - x) * 6.0);
} else if (z <= 7.5) {
tmp = x + (z * (y * 6.0));
} else {
tmp = 6.0 * (z * (y - 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.16d0)) then
tmp = z * ((y - x) * 6.0d0)
else if (z <= 7.5d0) then
tmp = x + (z * (y * 6.0d0))
else
tmp = 6.0d0 * (z * (y - x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.16) {
tmp = z * ((y - x) * 6.0);
} else if (z <= 7.5) {
tmp = x + (z * (y * 6.0));
} else {
tmp = 6.0 * (z * (y - x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.16: tmp = z * ((y - x) * 6.0) elif z <= 7.5: tmp = x + (z * (y * 6.0)) else: tmp = 6.0 * (z * (y - x)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.16) tmp = Float64(z * Float64(Float64(y - x) * 6.0)); elseif (z <= 7.5) tmp = Float64(x + Float64(z * Float64(y * 6.0))); else tmp = Float64(6.0 * Float64(z * Float64(y - x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.16) tmp = z * ((y - x) * 6.0); elseif (z <= 7.5) tmp = x + (z * (y * 6.0)); else tmp = 6.0 * (z * (y - x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.16], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.5], N[(x + N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.16:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\mathbf{elif}\;z \leq 7.5:\\
\;\;\;\;x + z \cdot \left(y \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(z \cdot \left(y - x\right)\right)\\
\end{array}
\end{array}
if z < -0.160000000000000003Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 97.0%
Taylor expanded in y around 0 95.4%
+-commutative95.4%
*-commutative95.4%
metadata-eval95.4%
associate-*r*95.4%
associate-*r*95.4%
neg-mul-195.4%
*-commutative95.4%
distribute-lft-in95.4%
distribute-lft-out97.0%
sub-neg97.0%
*-commutative97.0%
associate-*l*97.0%
Simplified97.0%
if -0.160000000000000003 < z < 7.5Initial program 99.3%
Taylor expanded in y around inf 98.2%
if 7.5 < z Initial program 99.6%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 98.6%
Final simplification98.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.165) (not (<= z 0.165))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.165) || !(z <= 0.165)) {
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.165d0)) .or. (.not. (z <= 0.165d0))) 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.165) || !(z <= 0.165)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.165) or not (z <= 0.165): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.165) || !(z <= 0.165)) 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.165) || ~((z <= 0.165))) tmp = -6.0 * (x * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.165], N[Not[LessEqual[z, 0.165]], $MachinePrecision]], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.165 \lor \neg \left(z \leq 0.165\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.165000000000000008 or 0.165000000000000008 < z Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 97.8%
Taylor expanded in y around 0 55.9%
if -0.165000000000000008 < z < 0.165000000000000008Initial program 99.3%
Taylor expanded in z around 0 66.9%
Final simplification61.5%
(FPCore (x y z) :precision binary64 (+ x (* 6.0 (* z (- y x)))))
double code(double x, double y, double z) {
return x + (6.0 * (z * (y - 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 + (6.0d0 * (z * (y - x)))
end function
public static double code(double x, double y, double z) {
return x + (6.0 * (z * (y - x)));
}
def code(x, y, z): return x + (6.0 * (z * (y - x)))
function code(x, y, z) return Float64(x + Float64(6.0 * Float64(z * Float64(y - x)))) end
function tmp = code(x, y, z) tmp = x + (6.0 * (z * (y - x))); end
code[x_, y_, z_] := N[(x + N[(6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + 6 \cdot \left(z \cdot \left(y - x\right)\right)
\end{array}
Initial program 99.5%
Taylor expanded in z around 0 99.7%
Final simplification99.7%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.5%
Taylor expanded in z around 0 35.7%
Final simplification35.7%
(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 2023275
(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)))