
(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 10 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 (* (- 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%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* x z))) (t_1 (* 6.0 (* y z))))
(if (<= z -2.5e+93)
t_0
(if (<= z -5e+58)
t_1
(if (<= z -2.5e+18)
t_0
(if (<= z -1.05e-86)
t_1
(if (<= z 2.6e-126)
x
(if (or (<= z 14.5) (not (<= z 3.2e+102))) t_1 t_0))))))))
double code(double x, double y, double z) {
double t_0 = -6.0 * (x * z);
double t_1 = 6.0 * (y * z);
double tmp;
if (z <= -2.5e+93) {
tmp = t_0;
} else if (z <= -5e+58) {
tmp = t_1;
} else if (z <= -2.5e+18) {
tmp = t_0;
} else if (z <= -1.05e-86) {
tmp = t_1;
} else if (z <= 2.6e-126) {
tmp = x;
} else if ((z <= 14.5) || !(z <= 3.2e+102)) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (-6.0d0) * (x * z)
t_1 = 6.0d0 * (y * z)
if (z <= (-2.5d+93)) then
tmp = t_0
else if (z <= (-5d+58)) then
tmp = t_1
else if (z <= (-2.5d+18)) then
tmp = t_0
else if (z <= (-1.05d-86)) then
tmp = t_1
else if (z <= 2.6d-126) then
tmp = x
else if ((z <= 14.5d0) .or. (.not. (z <= 3.2d+102))) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -6.0 * (x * z);
double t_1 = 6.0 * (y * z);
double tmp;
if (z <= -2.5e+93) {
tmp = t_0;
} else if (z <= -5e+58) {
tmp = t_1;
} else if (z <= -2.5e+18) {
tmp = t_0;
} else if (z <= -1.05e-86) {
tmp = t_1;
} else if (z <= 2.6e-126) {
tmp = x;
} else if ((z <= 14.5) || !(z <= 3.2e+102)) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * (x * z) t_1 = 6.0 * (y * z) tmp = 0 if z <= -2.5e+93: tmp = t_0 elif z <= -5e+58: tmp = t_1 elif z <= -2.5e+18: tmp = t_0 elif z <= -1.05e-86: tmp = t_1 elif z <= 2.6e-126: tmp = x elif (z <= 14.5) or not (z <= 3.2e+102): tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-6.0 * Float64(x * z)) t_1 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -2.5e+93) tmp = t_0; elseif (z <= -5e+58) tmp = t_1; elseif (z <= -2.5e+18) tmp = t_0; elseif (z <= -1.05e-86) tmp = t_1; elseif (z <= 2.6e-126) tmp = x; elseif ((z <= 14.5) || !(z <= 3.2e+102)) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -6.0 * (x * z); t_1 = 6.0 * (y * z); tmp = 0.0; if (z <= -2.5e+93) tmp = t_0; elseif (z <= -5e+58) tmp = t_1; elseif (z <= -2.5e+18) tmp = t_0; elseif (z <= -1.05e-86) tmp = t_1; elseif (z <= 2.6e-126) tmp = x; elseif ((z <= 14.5) || ~((z <= 3.2e+102))) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.5e+93], t$95$0, If[LessEqual[z, -5e+58], t$95$1, If[LessEqual[z, -2.5e+18], t$95$0, If[LessEqual[z, -1.05e-86], t$95$1, If[LessEqual[z, 2.6e-126], x, If[Or[LessEqual[z, 14.5], N[Not[LessEqual[z, 3.2e+102]], $MachinePrecision]], t$95$1, t$95$0]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -6 \cdot \left(x \cdot z\right)\\
t_1 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -2.5 \cdot 10^{+93}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -5 \cdot 10^{+58}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -2.5 \cdot 10^{+18}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.05 \cdot 10^{-86}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{-126}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 14.5 \lor \neg \left(z \leq 3.2 \cdot 10^{+102}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -2.5000000000000001e93 or -4.99999999999999986e58 < z < -2.5e18 or 14.5 < z < 3.1999999999999999e102Initial program 99.6%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 98.5%
Taylor expanded in y around 0 65.5%
if -2.5000000000000001e93 < z < -4.99999999999999986e58 or -2.5e18 < z < -1.05e-86 or 2.59999999999999999e-126 < z < 14.5 or 3.1999999999999999e102 < z Initial program 99.8%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 81.9%
Taylor expanded in y around inf 67.0%
*-commutative67.0%
Simplified67.0%
if -1.05e-86 < z < 2.59999999999999999e-126Initial program 99.9%
Taylor expanded in z around 0 78.5%
Final simplification69.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* x z))) (t_1 (* 6.0 (* y z))))
(if (<= z -5.8e+92)
(* x (* z -6.0))
(if (<= z -5.5e+55)
t_1
(if (<= z -4e+19)
t_0
(if (<= z -1.3e-83)
t_1
(if (<= z 2.6e-126)
x
(if (or (<= z 14.5) (not (<= z 6.2e+104))) t_1 t_0))))))))
double code(double x, double y, double z) {
double t_0 = -6.0 * (x * z);
double t_1 = 6.0 * (y * z);
double tmp;
if (z <= -5.8e+92) {
tmp = x * (z * -6.0);
} else if (z <= -5.5e+55) {
tmp = t_1;
} else if (z <= -4e+19) {
tmp = t_0;
} else if (z <= -1.3e-83) {
tmp = t_1;
} else if (z <= 2.6e-126) {
tmp = x;
} else if ((z <= 14.5) || !(z <= 6.2e+104)) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (-6.0d0) * (x * z)
t_1 = 6.0d0 * (y * z)
if (z <= (-5.8d+92)) then
tmp = x * (z * (-6.0d0))
else if (z <= (-5.5d+55)) then
tmp = t_1
else if (z <= (-4d+19)) then
tmp = t_0
else if (z <= (-1.3d-83)) then
tmp = t_1
else if (z <= 2.6d-126) then
tmp = x
else if ((z <= 14.5d0) .or. (.not. (z <= 6.2d+104))) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -6.0 * (x * z);
double t_1 = 6.0 * (y * z);
double tmp;
if (z <= -5.8e+92) {
tmp = x * (z * -6.0);
} else if (z <= -5.5e+55) {
tmp = t_1;
} else if (z <= -4e+19) {
tmp = t_0;
} else if (z <= -1.3e-83) {
tmp = t_1;
} else if (z <= 2.6e-126) {
tmp = x;
} else if ((z <= 14.5) || !(z <= 6.2e+104)) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * (x * z) t_1 = 6.0 * (y * z) tmp = 0 if z <= -5.8e+92: tmp = x * (z * -6.0) elif z <= -5.5e+55: tmp = t_1 elif z <= -4e+19: tmp = t_0 elif z <= -1.3e-83: tmp = t_1 elif z <= 2.6e-126: tmp = x elif (z <= 14.5) or not (z <= 6.2e+104): tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-6.0 * Float64(x * z)) t_1 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -5.8e+92) tmp = Float64(x * Float64(z * -6.0)); elseif (z <= -5.5e+55) tmp = t_1; elseif (z <= -4e+19) tmp = t_0; elseif (z <= -1.3e-83) tmp = t_1; elseif (z <= 2.6e-126) tmp = x; elseif ((z <= 14.5) || !(z <= 6.2e+104)) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -6.0 * (x * z); t_1 = 6.0 * (y * z); tmp = 0.0; if (z <= -5.8e+92) tmp = x * (z * -6.0); elseif (z <= -5.5e+55) tmp = t_1; elseif (z <= -4e+19) tmp = t_0; elseif (z <= -1.3e-83) tmp = t_1; elseif (z <= 2.6e-126) tmp = x; elseif ((z <= 14.5) || ~((z <= 6.2e+104))) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.8e+92], N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -5.5e+55], t$95$1, If[LessEqual[z, -4e+19], t$95$0, If[LessEqual[z, -1.3e-83], t$95$1, If[LessEqual[z, 2.6e-126], x, If[Or[LessEqual[z, 14.5], N[Not[LessEqual[z, 6.2e+104]], $MachinePrecision]], t$95$1, t$95$0]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -6 \cdot \left(x \cdot z\right)\\
t_1 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -5.8 \cdot 10^{+92}:\\
\;\;\;\;x \cdot \left(z \cdot -6\right)\\
\mathbf{elif}\;z \leq -5.5 \cdot 10^{+55}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -4 \cdot 10^{+19}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.3 \cdot 10^{-83}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{-126}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 14.5 \lor \neg \left(z \leq 6.2 \cdot 10^{+104}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -5.8000000000000001e92Initial program 99.7%
Taylor expanded in x around inf 64.5%
Taylor expanded in z around inf 64.5%
if -5.8000000000000001e92 < z < -5.5000000000000004e55 or -4e19 < z < -1.30000000000000004e-83 or 2.59999999999999999e-126 < z < 14.5 or 6.20000000000000033e104 < z Initial program 99.8%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 81.9%
Taylor expanded in y around inf 67.0%
*-commutative67.0%
Simplified67.0%
if -5.5000000000000004e55 < z < -4e19 or 14.5 < z < 6.20000000000000033e104Initial program 99.4%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 96.6%
Taylor expanded in y around 0 67.1%
if -1.30000000000000004e-83 < z < 2.59999999999999999e-126Initial program 99.9%
Taylor expanded in z around 0 78.5%
Final simplification69.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* x z))) (t_1 (* 6.0 (* y z))))
(if (<= z -3.3e+93)
(* x (* z -6.0))
(if (<= z -1e+56)
t_1
(if (<= z -3.6e+19)
t_0
(if (<= z -1.02e-85)
t_1
(if (<= z 2.5e-126)
x
(if (or (<= z 14.5) (not (<= z 2.2e+105)))
(* z (* y 6.0))
t_0))))))))
double code(double x, double y, double z) {
double t_0 = -6.0 * (x * z);
double t_1 = 6.0 * (y * z);
double tmp;
if (z <= -3.3e+93) {
tmp = x * (z * -6.0);
} else if (z <= -1e+56) {
tmp = t_1;
} else if (z <= -3.6e+19) {
tmp = t_0;
} else if (z <= -1.02e-85) {
tmp = t_1;
} else if (z <= 2.5e-126) {
tmp = x;
} else if ((z <= 14.5) || !(z <= 2.2e+105)) {
tmp = z * (y * 6.0);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (-6.0d0) * (x * z)
t_1 = 6.0d0 * (y * z)
if (z <= (-3.3d+93)) then
tmp = x * (z * (-6.0d0))
else if (z <= (-1d+56)) then
tmp = t_1
else if (z <= (-3.6d+19)) then
tmp = t_0
else if (z <= (-1.02d-85)) then
tmp = t_1
else if (z <= 2.5d-126) then
tmp = x
else if ((z <= 14.5d0) .or. (.not. (z <= 2.2d+105))) then
tmp = z * (y * 6.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -6.0 * (x * z);
double t_1 = 6.0 * (y * z);
double tmp;
if (z <= -3.3e+93) {
tmp = x * (z * -6.0);
} else if (z <= -1e+56) {
tmp = t_1;
} else if (z <= -3.6e+19) {
tmp = t_0;
} else if (z <= -1.02e-85) {
tmp = t_1;
} else if (z <= 2.5e-126) {
tmp = x;
} else if ((z <= 14.5) || !(z <= 2.2e+105)) {
tmp = z * (y * 6.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * (x * z) t_1 = 6.0 * (y * z) tmp = 0 if z <= -3.3e+93: tmp = x * (z * -6.0) elif z <= -1e+56: tmp = t_1 elif z <= -3.6e+19: tmp = t_0 elif z <= -1.02e-85: tmp = t_1 elif z <= 2.5e-126: tmp = x elif (z <= 14.5) or not (z <= 2.2e+105): tmp = z * (y * 6.0) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-6.0 * Float64(x * z)) t_1 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -3.3e+93) tmp = Float64(x * Float64(z * -6.0)); elseif (z <= -1e+56) tmp = t_1; elseif (z <= -3.6e+19) tmp = t_0; elseif (z <= -1.02e-85) tmp = t_1; elseif (z <= 2.5e-126) tmp = x; elseif ((z <= 14.5) || !(z <= 2.2e+105)) tmp = Float64(z * Float64(y * 6.0)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -6.0 * (x * z); t_1 = 6.0 * (y * z); tmp = 0.0; if (z <= -3.3e+93) tmp = x * (z * -6.0); elseif (z <= -1e+56) tmp = t_1; elseif (z <= -3.6e+19) tmp = t_0; elseif (z <= -1.02e-85) tmp = t_1; elseif (z <= 2.5e-126) tmp = x; elseif ((z <= 14.5) || ~((z <= 2.2e+105))) tmp = z * (y * 6.0); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.3e+93], N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1e+56], t$95$1, If[LessEqual[z, -3.6e+19], t$95$0, If[LessEqual[z, -1.02e-85], t$95$1, If[LessEqual[z, 2.5e-126], x, If[Or[LessEqual[z, 14.5], N[Not[LessEqual[z, 2.2e+105]], $MachinePrecision]], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -6 \cdot \left(x \cdot z\right)\\
t_1 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -3.3 \cdot 10^{+93}:\\
\;\;\;\;x \cdot \left(z \cdot -6\right)\\
\mathbf{elif}\;z \leq -1 \cdot 10^{+56}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -3.6 \cdot 10^{+19}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.02 \cdot 10^{-85}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{-126}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 14.5 \lor \neg \left(z \leq 2.2 \cdot 10^{+105}\right):\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -3.30000000000000009e93Initial program 99.7%
Taylor expanded in x around inf 64.5%
Taylor expanded in z around inf 64.5%
if -3.30000000000000009e93 < z < -1.00000000000000009e56 or -3.6e19 < z < -1.02000000000000001e-85Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 79.3%
Taylor expanded in y around inf 74.2%
*-commutative74.2%
Simplified74.2%
if -1.00000000000000009e56 < z < -3.6e19 or 14.5 < z < 2.20000000000000007e105Initial program 99.4%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 96.6%
Taylor expanded in y around 0 67.1%
if -1.02000000000000001e-85 < z < 2.50000000000000003e-126Initial program 99.9%
Taylor expanded in z around 0 78.5%
if 2.50000000000000003e-126 < z < 14.5 or 2.20000000000000007e105 < z Initial program 99.9%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 83.2%
Taylor expanded in y around inf 63.5%
associate-*r*63.7%
*-commutative63.7%
Simplified63.7%
Final simplification69.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.4e-104) (not (<= z 2.6e-126))) (* 6.0 (* (- y x) z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.4e-104) || !(z <= 2.6e-126)) {
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 <= (-3.4d-104)) .or. (.not. (z <= 2.6d-126))) 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 <= -3.4e-104) || !(z <= 2.6e-126)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.4e-104) or not (z <= 2.6e-126): tmp = 6.0 * ((y - x) * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.4e-104) || !(z <= 2.6e-126)) 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 <= -3.4e-104) || ~((z <= 2.6e-126))) tmp = 6.0 * ((y - x) * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.4e-104], N[Not[LessEqual[z, 2.6e-126]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.4 \cdot 10^{-104} \lor \neg \left(z \leq 2.6 \cdot 10^{-126}\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.40000000000000015e-104 or 2.59999999999999999e-126 < z Initial program 99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 88.6%
if -3.40000000000000015e-104 < z < 2.59999999999999999e-126Initial program 99.9%
Taylor expanded in z around 0 80.1%
Final simplification86.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -115000.0) (not (<= z 2.8e-18))) (* 6.0 (* (- y x) z)) (+ x (* 6.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -115000.0) || !(z <= 2.8e-18)) {
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 <= (-115000.0d0)) .or. (.not. (z <= 2.8d-18))) 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 <= -115000.0) || !(z <= 2.8e-18)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -115000.0) or not (z <= 2.8e-18): 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 <= -115000.0) || !(z <= 2.8e-18)) 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 <= -115000.0) || ~((z <= 2.8e-18))) 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, -115000.0], N[Not[LessEqual[z, 2.8e-18]], $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 -115000 \lor \neg \left(z \leq 2.8 \cdot 10^{-18}\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 < -115000 or 2.80000000000000012e-18 < z Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 98.7%
if -115000 < z < 2.80000000000000012e-18Initial program 99.9%
Taylor expanded in y around inf 99.3%
Final simplification99.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.17) (not (<= z 0.83))) (* 6.0 (* (- y x) z)) (+ x (* z (* y 6.0)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.17) || !(z <= 0.83)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x + (z * (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 <= (-0.17d0)) .or. (.not. (z <= 0.83d0))) then
tmp = 6.0d0 * ((y - x) * z)
else
tmp = x + (z * (y * 6.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.17) || !(z <= 0.83)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x + (z * (y * 6.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.17) or not (z <= 0.83): tmp = 6.0 * ((y - x) * z) else: tmp = x + (z * (y * 6.0)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.17) || !(z <= 0.83)) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); else tmp = Float64(x + Float64(z * Float64(y * 6.0))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.17) || ~((z <= 0.83))) tmp = 6.0 * ((y - x) * z); else tmp = x + (z * (y * 6.0)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.17], N[Not[LessEqual[z, 0.83]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.17 \lor \neg \left(z \leq 0.83\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y \cdot 6\right)\\
\end{array}
\end{array}
if z < -0.170000000000000012 or 0.82999999999999996 < z Initial program 99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 98.8%
if -0.170000000000000012 < z < 0.82999999999999996Initial program 99.9%
Taylor expanded in y around inf 99.3%
associate-*r*99.3%
Simplified99.3%
Final simplification99.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -2300000000000.0) (not (<= z 0.166))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2300000000000.0) || !(z <= 0.166)) {
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 <= (-2300000000000.0d0)) .or. (.not. (z <= 0.166d0))) 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 <= -2300000000000.0) || !(z <= 0.166)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2300000000000.0) or not (z <= 0.166): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2300000000000.0) || !(z <= 0.166)) 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 <= -2300000000000.0) || ~((z <= 0.166))) tmp = -6.0 * (x * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2300000000000.0], N[Not[LessEqual[z, 0.166]], $MachinePrecision]], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2300000000000 \lor \neg \left(z \leq 0.166\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.3e12 or 0.166000000000000009 < z Initial program 99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 98.9%
Taylor expanded in y around 0 55.5%
if -2.3e12 < z < 0.166000000000000009Initial program 99.9%
Taylor expanded in z around 0 59.7%
Final simplification57.6%
(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.1%
Final simplification31.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 2023173
(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)))