
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* y z))))
double code(double x, double y, double z) {
return x * (1.0 - (y * 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 * (1.0d0 - (y * z))
end function
public static double code(double x, double y, double z) {
return x * (1.0 - (y * z));
}
def code(x, y, z): return x * (1.0 - (y * z))
function code(x, y, z) return Float64(x * Float64(1.0 - Float64(y * z))) end
function tmp = code(x, y, z) tmp = x * (1.0 - (y * z)); end
code[x_, y_, z_] := N[(x * N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - y \cdot z\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* y z))))
double code(double x, double y, double z) {
return x * (1.0 - (y * 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 * (1.0d0 - (y * z))
end function
public static double code(double x, double y, double z) {
return x * (1.0 - (y * z));
}
def code(x, y, z): return x * (1.0 - (y * z))
function code(x, y, z) return Float64(x * Float64(1.0 - Float64(y * z))) end
function tmp = code(x, y, z) tmp = x * (1.0 - (y * z)); end
code[x_, y_, z_] := N[(x * N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - y \cdot z\right)
\end{array}
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) NOTE: x_m, y, and z should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (<= x_m 3.55e-65) (- x_m (* (* x_m y) z)) (- x_m (* x_m (* y z))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (x_m <= 3.55e-65) {
tmp = x_m - ((x_m * y) * z);
} else {
tmp = x_m - (x_m * (y * z));
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x_m <= 3.55d-65) then
tmp = x_m - ((x_m * y) * z)
else
tmp = x_m - (x_m * (y * z))
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z;
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if (x_m <= 3.55e-65) {
tmp = x_m - ((x_m * y) * z);
} else {
tmp = x_m - (x_m * (y * z));
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z] = sort([x_m, y, z]) def code(x_s, x_m, y, z): tmp = 0 if x_m <= 3.55e-65: tmp = x_m - ((x_m * y) * z) else: tmp = x_m - (x_m * (y * z)) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) tmp = 0.0 if (x_m <= 3.55e-65) tmp = Float64(x_m - Float64(Float64(x_m * y) * z)); else tmp = Float64(x_m - Float64(x_m * Float64(y * z))); end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z = num2cell(sort([x_m, y, z])){:}
function tmp_2 = code(x_s, x_m, y, z)
tmp = 0.0;
if (x_m <= 3.55e-65)
tmp = x_m - ((x_m * y) * z);
else
tmp = x_m - (x_m * (y * z));
end
tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[x$95$m, 3.55e-65], N[(x$95$m - N[(N[(x$95$m * y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x$95$m - N[(x$95$m * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \leq 3.55 \cdot 10^{-65}:\\
\;\;\;\;x\_m - \left(x\_m \cdot y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\_m - x\_m \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if x < 3.55000000000000014e-65Initial program 93.7%
Taylor expanded in y around 0 93.7%
mul-1-neg93.7%
associate-*r*92.2%
Simplified92.2%
if 3.55000000000000014e-65 < x Initial program 99.9%
Taylor expanded in y around 0 99.9%
mul-1-neg99.9%
associate-*r*95.3%
Simplified95.3%
unsub-neg95.3%
associate-*l*99.9%
Applied egg-rr99.9%
Final simplification94.8%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z)
:precision binary64
(let* ((t_0 (- (* (* x_m y) z))))
(*
x_s
(if (<= (* y z) -20000000.0)
t_0
(if (<= (* y z) 0.5)
x_m
(if (<= (* y z) 1e+219) (* x_m (* z (- y))) t_0))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
double t_0 = -((x_m * y) * z);
double tmp;
if ((y * z) <= -20000000.0) {
tmp = t_0;
} else if ((y * z) <= 0.5) {
tmp = x_m;
} else if ((y * z) <= 1e+219) {
tmp = x_m * (z * -y);
} else {
tmp = t_0;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = -((x_m * y) * z)
if ((y * z) <= (-20000000.0d0)) then
tmp = t_0
else if ((y * z) <= 0.5d0) then
tmp = x_m
else if ((y * z) <= 1d+219) then
tmp = x_m * (z * -y)
else
tmp = t_0
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z;
public static double code(double x_s, double x_m, double y, double z) {
double t_0 = -((x_m * y) * z);
double tmp;
if ((y * z) <= -20000000.0) {
tmp = t_0;
} else if ((y * z) <= 0.5) {
tmp = x_m;
} else if ((y * z) <= 1e+219) {
tmp = x_m * (z * -y);
} else {
tmp = t_0;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z] = sort([x_m, y, z]) def code(x_s, x_m, y, z): t_0 = -((x_m * y) * z) tmp = 0 if (y * z) <= -20000000.0: tmp = t_0 elif (y * z) <= 0.5: tmp = x_m elif (y * z) <= 1e+219: tmp = x_m * (z * -y) else: tmp = t_0 return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) t_0 = Float64(-Float64(Float64(x_m * y) * z)) tmp = 0.0 if (Float64(y * z) <= -20000000.0) tmp = t_0; elseif (Float64(y * z) <= 0.5) tmp = x_m; elseif (Float64(y * z) <= 1e+219) tmp = Float64(x_m * Float64(z * Float64(-y))); else tmp = t_0; end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z = num2cell(sort([x_m, y, z])){:}
function tmp_2 = code(x_s, x_m, y, z)
t_0 = -((x_m * y) * z);
tmp = 0.0;
if ((y * z) <= -20000000.0)
tmp = t_0;
elseif ((y * z) <= 0.5)
tmp = x_m;
elseif ((y * z) <= 1e+219)
tmp = x_m * (z * -y);
else
tmp = t_0;
end
tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := Block[{t$95$0 = (-N[(N[(x$95$m * y), $MachinePrecision] * z), $MachinePrecision])}, N[(x$95$s * If[LessEqual[N[(y * z), $MachinePrecision], -20000000.0], t$95$0, If[LessEqual[N[(y * z), $MachinePrecision], 0.5], x$95$m, If[LessEqual[N[(y * z), $MachinePrecision], 1e+219], N[(x$95$m * N[(z * (-y)), $MachinePrecision]), $MachinePrecision], t$95$0]]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
\begin{array}{l}
t_0 := -\left(x\_m \cdot y\right) \cdot z\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \cdot z \leq -20000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \cdot z \leq 0.5:\\
\;\;\;\;x\_m\\
\mathbf{elif}\;y \cdot z \leq 10^{+219}:\\
\;\;\;\;x\_m \cdot \left(z \cdot \left(-y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (*.f64 y z) < -2e7 or 9.99999999999999965e218 < (*.f64 y z) Initial program 89.3%
Taylor expanded in y around inf 88.3%
mul-1-neg88.3%
associate-*r*92.1%
Simplified92.1%
if -2e7 < (*.f64 y z) < 0.5Initial program 100.0%
Taylor expanded in y around 0 97.3%
if 0.5 < (*.f64 y z) < 9.99999999999999965e218Initial program 99.4%
Taylor expanded in y around 0 99.4%
mul-1-neg99.4%
associate-*r*80.5%
Simplified80.5%
Taylor expanded in y around inf 93.3%
neg-mul-193.3%
distribute-rgt-neg-in93.3%
distribute-lft-neg-in93.3%
Simplified93.3%
Final simplification94.9%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (or (<= (* y z) -20000000.0) (not (<= (* y z) 0.5)))
(- (* (* x_m y) z))
x_m)))x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (((y * z) <= -20000000.0) || !((y * z) <= 0.5)) {
tmp = -((x_m * y) * z);
} else {
tmp = x_m;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (((y * z) <= (-20000000.0d0)) .or. (.not. ((y * z) <= 0.5d0))) then
tmp = -((x_m * y) * z)
else
tmp = x_m
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z;
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if (((y * z) <= -20000000.0) || !((y * z) <= 0.5)) {
tmp = -((x_m * y) * z);
} else {
tmp = x_m;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z] = sort([x_m, y, z]) def code(x_s, x_m, y, z): tmp = 0 if ((y * z) <= -20000000.0) or not ((y * z) <= 0.5): tmp = -((x_m * y) * z) else: tmp = x_m return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) tmp = 0.0 if ((Float64(y * z) <= -20000000.0) || !(Float64(y * z) <= 0.5)) tmp = Float64(-Float64(Float64(x_m * y) * z)); else tmp = x_m; end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z = num2cell(sort([x_m, y, z])){:}
function tmp_2 = code(x_s, x_m, y, z)
tmp = 0.0;
if (((y * z) <= -20000000.0) || ~(((y * z) <= 0.5)))
tmp = -((x_m * y) * z);
else
tmp = x_m;
end
tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[Or[LessEqual[N[(y * z), $MachinePrecision], -20000000.0], N[Not[LessEqual[N[(y * z), $MachinePrecision], 0.5]], $MachinePrecision]], (-N[(N[(x$95$m * y), $MachinePrecision] * z), $MachinePrecision]), x$95$m]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \cdot z \leq -20000000 \lor \neg \left(y \cdot z \leq 0.5\right):\\
\;\;\;\;-\left(x\_m \cdot y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\_m\\
\end{array}
\end{array}
if (*.f64 y z) < -2e7 or 0.5 < (*.f64 y z) Initial program 91.6%
Taylor expanded in y around inf 89.5%
mul-1-neg89.5%
associate-*r*88.5%
Simplified88.5%
if -2e7 < (*.f64 y z) < 0.5Initial program 100.0%
Taylor expanded in y around 0 97.3%
Final simplification92.9%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= (* y z) -20000000.0)
(- (* (* x_m y) z))
(if (<= (* y z) 0.5) x_m (* y (* x_m (- z)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((y * z) <= -20000000.0) {
tmp = -((x_m * y) * z);
} else if ((y * z) <= 0.5) {
tmp = x_m;
} else {
tmp = y * (x_m * -z);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y * z) <= (-20000000.0d0)) then
tmp = -((x_m * y) * z)
else if ((y * z) <= 0.5d0) then
tmp = x_m
else
tmp = y * (x_m * -z)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z;
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((y * z) <= -20000000.0) {
tmp = -((x_m * y) * z);
} else if ((y * z) <= 0.5) {
tmp = x_m;
} else {
tmp = y * (x_m * -z);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z] = sort([x_m, y, z]) def code(x_s, x_m, y, z): tmp = 0 if (y * z) <= -20000000.0: tmp = -((x_m * y) * z) elif (y * z) <= 0.5: tmp = x_m else: tmp = y * (x_m * -z) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) tmp = 0.0 if (Float64(y * z) <= -20000000.0) tmp = Float64(-Float64(Float64(x_m * y) * z)); elseif (Float64(y * z) <= 0.5) tmp = x_m; else tmp = Float64(y * Float64(x_m * Float64(-z))); end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z = num2cell(sort([x_m, y, z])){:}
function tmp_2 = code(x_s, x_m, y, z)
tmp = 0.0;
if ((y * z) <= -20000000.0)
tmp = -((x_m * y) * z);
elseif ((y * z) <= 0.5)
tmp = x_m;
else
tmp = y * (x_m * -z);
end
tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[N[(y * z), $MachinePrecision], -20000000.0], (-N[(N[(x$95$m * y), $MachinePrecision] * z), $MachinePrecision]), If[LessEqual[N[(y * z), $MachinePrecision], 0.5], x$95$m, N[(y * N[(x$95$m * (-z)), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \cdot z \leq -20000000:\\
\;\;\;\;-\left(x\_m \cdot y\right) \cdot z\\
\mathbf{elif}\;y \cdot z \leq 0.5:\\
\;\;\;\;x\_m\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x\_m \cdot \left(-z\right)\right)\\
\end{array}
\end{array}
if (*.f64 y z) < -2e7Initial program 96.0%
Taylor expanded in y around inf 94.8%
mul-1-neg94.8%
associate-*r*89.8%
Simplified89.8%
if -2e7 < (*.f64 y z) < 0.5Initial program 100.0%
Taylor expanded in y around 0 97.3%
if 0.5 < (*.f64 y z) Initial program 85.3%
Taylor expanded in y around inf 81.8%
mul-1-neg81.8%
associate-*r*86.4%
distribute-rgt-neg-in86.4%
*-commutative86.4%
associate-*l*91.3%
Simplified91.3%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) NOTE: x_m, y, and z should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (<= (* y z) 1e+179) (- x_m (* x_m (* y z))) (* y (* x_m (- z))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((y * z) <= 1e+179) {
tmp = x_m - (x_m * (y * z));
} else {
tmp = y * (x_m * -z);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y * z) <= 1d+179) then
tmp = x_m - (x_m * (y * z))
else
tmp = y * (x_m * -z)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z;
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((y * z) <= 1e+179) {
tmp = x_m - (x_m * (y * z));
} else {
tmp = y * (x_m * -z);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z] = sort([x_m, y, z]) def code(x_s, x_m, y, z): tmp = 0 if (y * z) <= 1e+179: tmp = x_m - (x_m * (y * z)) else: tmp = y * (x_m * -z) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) tmp = 0.0 if (Float64(y * z) <= 1e+179) tmp = Float64(x_m - Float64(x_m * Float64(y * z))); else tmp = Float64(y * Float64(x_m * Float64(-z))); end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z = num2cell(sort([x_m, y, z])){:}
function tmp_2 = code(x_s, x_m, y, z)
tmp = 0.0;
if ((y * z) <= 1e+179)
tmp = x_m - (x_m * (y * z));
else
tmp = y * (x_m * -z);
end
tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[N[(y * z), $MachinePrecision], 1e+179], N[(x$95$m - N[(x$95$m * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(x$95$m * (-z)), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \cdot z \leq 10^{+179}:\\
\;\;\;\;x\_m - x\_m \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x\_m \cdot \left(-z\right)\right)\\
\end{array}
\end{array}
if (*.f64 y z) < 9.9999999999999998e178Initial program 98.6%
Taylor expanded in y around 0 98.6%
mul-1-neg98.6%
associate-*r*92.9%
Simplified92.9%
unsub-neg92.9%
associate-*l*98.6%
Applied egg-rr98.6%
if 9.9999999999999998e178 < (*.f64 y z) Initial program 73.2%
Taylor expanded in y around inf 73.2%
mul-1-neg73.2%
associate-*r*96.5%
distribute-rgt-neg-in96.5%
*-commutative96.5%
associate-*l*96.3%
Simplified96.3%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) NOTE: x_m, y, and z should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (<= (* y z) 1e+179) (* x_m (- 1.0 (* y z))) (* y (* x_m (- z))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((y * z) <= 1e+179) {
tmp = x_m * (1.0 - (y * z));
} else {
tmp = y * (x_m * -z);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y * z) <= 1d+179) then
tmp = x_m * (1.0d0 - (y * z))
else
tmp = y * (x_m * -z)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z;
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((y * z) <= 1e+179) {
tmp = x_m * (1.0 - (y * z));
} else {
tmp = y * (x_m * -z);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z] = sort([x_m, y, z]) def code(x_s, x_m, y, z): tmp = 0 if (y * z) <= 1e+179: tmp = x_m * (1.0 - (y * z)) else: tmp = y * (x_m * -z) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) tmp = 0.0 if (Float64(y * z) <= 1e+179) tmp = Float64(x_m * Float64(1.0 - Float64(y * z))); else tmp = Float64(y * Float64(x_m * Float64(-z))); end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z = num2cell(sort([x_m, y, z])){:}
function tmp_2 = code(x_s, x_m, y, z)
tmp = 0.0;
if ((y * z) <= 1e+179)
tmp = x_m * (1.0 - (y * z));
else
tmp = y * (x_m * -z);
end
tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[N[(y * z), $MachinePrecision], 1e+179], N[(x$95$m * N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(x$95$m * (-z)), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \cdot z \leq 10^{+179}:\\
\;\;\;\;x\_m \cdot \left(1 - y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x\_m \cdot \left(-z\right)\right)\\
\end{array}
\end{array}
if (*.f64 y z) < 9.9999999999999998e178Initial program 98.6%
if 9.9999999999999998e178 < (*.f64 y z) Initial program 73.2%
Taylor expanded in y around inf 73.2%
mul-1-neg73.2%
associate-*r*96.5%
distribute-rgt-neg-in96.5%
*-commutative96.5%
associate-*l*96.3%
Simplified96.3%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) NOTE: x_m, y, and z should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (<= (* y z) -5e+63) (/ (* x_m y) y) x_m)))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((y * z) <= -5e+63) {
tmp = (x_m * y) / y;
} else {
tmp = x_m;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y * z) <= (-5d+63)) then
tmp = (x_m * y) / y
else
tmp = x_m
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z;
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if ((y * z) <= -5e+63) {
tmp = (x_m * y) / y;
} else {
tmp = x_m;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z] = sort([x_m, y, z]) def code(x_s, x_m, y, z): tmp = 0 if (y * z) <= -5e+63: tmp = (x_m * y) / y else: tmp = x_m return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) tmp = 0.0 if (Float64(y * z) <= -5e+63) tmp = Float64(Float64(x_m * y) / y); else tmp = x_m; end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z = num2cell(sort([x_m, y, z])){:}
function tmp_2 = code(x_s, x_m, y, z)
tmp = 0.0;
if ((y * z) <= -5e+63)
tmp = (x_m * y) / y;
else
tmp = x_m;
end
tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[N[(y * z), $MachinePrecision], -5e+63], N[(N[(x$95$m * y), $MachinePrecision] / y), $MachinePrecision], x$95$m]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \cdot z \leq -5 \cdot 10^{+63}:\\
\;\;\;\;\frac{x\_m \cdot y}{y}\\
\mathbf{else}:\\
\;\;\;\;x\_m\\
\end{array}
\end{array}
if (*.f64 y z) < -5.00000000000000011e63Initial program 95.3%
Taylor expanded in y around 0 95.3%
mul-1-neg95.3%
associate-*r*94.0%
Simplified94.0%
Taylor expanded in y around inf 92.8%
Taylor expanded in y around 0 8.1%
*-commutative8.1%
associate-*l/26.7%
Applied egg-rr26.7%
if -5.00000000000000011e63 < (*.f64 y z) Initial program 96.0%
Taylor expanded in y around 0 66.0%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) NOTE: x_m, y, and z should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z) :precision binary64 (* x_s x_m))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z);
double code(double x_s, double x_m, double y, double z) {
return x_s * x_m;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x_s * x_m
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z;
public static double code(double x_s, double x_m, double y, double z) {
return x_s * x_m;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z] = sort([x_m, y, z]) def code(x_s, x_m, y, z): return x_s * x_m
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z = sort([x_m, y, z]) function code(x_s, x_m, y, z) return Float64(x_s * x_m) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z = num2cell(sort([x_m, y, z])){:}
function tmp = code(x_s, x_m, y, z)
tmp = x_s * x_m;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, and z should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * x$95$m), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z] = \mathsf{sort}([x_m, y, z])\\
\\
x\_s \cdot x\_m
\end{array}
Initial program 95.8%
Taylor expanded in y around 0 50.5%
herbie shell --seed 2024096
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, I"
:precision binary64
(* x (- 1.0 (* y z))))