
(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 7 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
(let* ((t_0 (* x_m (- 1.0 (* y z)))))
(*
x_s
(if (or (<= t_0 -2e+233) (not (<= t_0 1e+308))) (* z (* x_m (- 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 * (1.0 - (y * z));
double tmp;
if ((t_0 <= -2e+233) || !(t_0 <= 1e+308)) {
tmp = z * (x_m * -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 * (1.0d0 - (y * z))
if ((t_0 <= (-2d+233)) .or. (.not. (t_0 <= 1d+308))) then
tmp = z * (x_m * -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 * (1.0 - (y * z));
double tmp;
if ((t_0 <= -2e+233) || !(t_0 <= 1e+308)) {
tmp = z * (x_m * -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 * (1.0 - (y * z)) tmp = 0 if (t_0 <= -2e+233) or not (t_0 <= 1e+308): tmp = z * (x_m * -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(x_m * Float64(1.0 - Float64(y * z))) tmp = 0.0 if ((t_0 <= -2e+233) || !(t_0 <= 1e+308)) tmp = Float64(z * Float64(x_m * 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 * (1.0 - (y * z));
tmp = 0.0;
if ((t_0 <= -2e+233) || ~((t_0 <= 1e+308)))
tmp = z * (x_m * -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[(x$95$m * N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[Or[LessEqual[t$95$0, -2e+233], N[Not[LessEqual[t$95$0, 1e+308]], $MachinePrecision]], N[(z * N[(x$95$m * (-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 := x\_m \cdot \left(1 - y \cdot z\right)\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{+233} \lor \neg \left(t\_0 \leq 10^{+308}\right):\\
\;\;\;\;z \cdot \left(x\_m \cdot \left(-y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (*.f64 x (-.f64 #s(literal 1 binary64) (*.f64 y z))) < -1.99999999999999995e233 or 1e308 < (*.f64 x (-.f64 #s(literal 1 binary64) (*.f64 y z))) Initial program 83.5%
Taylor expanded in z around inf 86.8%
Taylor expanded in y around inf 86.6%
neg-mul-186.6%
distribute-rgt-neg-in86.6%
Simplified86.6%
if -1.99999999999999995e233 < (*.f64 x (-.f64 #s(literal 1 binary64) (*.f64 y z))) < 1e308Initial program 99.9%
Final simplification95.4%
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 (<= z -2.6e-76) (not (<= z 3.5e+95))) (* z (* x_m (- 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 ((z <= -2.6e-76) || !(z <= 3.5e+95)) {
tmp = z * (x_m * -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 ((z <= (-2.6d-76)) .or. (.not. (z <= 3.5d+95))) then
tmp = z * (x_m * -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 ((z <= -2.6e-76) || !(z <= 3.5e+95)) {
tmp = z * (x_m * -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 (z <= -2.6e-76) or not (z <= 3.5e+95): tmp = z * (x_m * -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 ((z <= -2.6e-76) || !(z <= 3.5e+95)) tmp = Float64(z * Float64(x_m * Float64(-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 ((z <= -2.6e-76) || ~((z <= 3.5e+95)))
tmp = z * (x_m * -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[Or[LessEqual[z, -2.6e-76], N[Not[LessEqual[z, 3.5e+95]], $MachinePrecision]], N[(z * N[(x$95$m * (-y)), $MachinePrecision]), $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}\;z \leq -2.6 \cdot 10^{-76} \lor \neg \left(z \leq 3.5 \cdot 10^{+95}\right):\\
\;\;\;\;z \cdot \left(x\_m \cdot \left(-y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x\_m\\
\end{array}
\end{array}
if z < -2.6e-76 or 3.5e95 < z Initial program 89.5%
Taylor expanded in z around inf 92.2%
Taylor expanded in y around inf 79.8%
neg-mul-179.8%
distribute-rgt-neg-in79.8%
Simplified79.8%
if -2.6e-76 < z < 3.5e95Initial program 99.1%
Taylor expanded in y around 0 72.2%
Final simplification75.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 (<= z -1.65e-63) (not (<= z 3.4e+98))) (* 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 ((z <= -1.65e-63) || !(z <= 3.4e+98)) {
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 ((z <= (-1.65d-63)) .or. (.not. (z <= 3.4d+98))) 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 ((z <= -1.65e-63) || !(z <= 3.4e+98)) {
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 (z <= -1.65e-63) or not (z <= 3.4e+98): 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 ((z <= -1.65e-63) || !(z <= 3.4e+98)) tmp = Float64(x_m * Float64(y * Float64(-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 ((z <= -1.65e-63) || ~((z <= 3.4e+98)))
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[z, -1.65e-63], N[Not[LessEqual[z, 3.4e+98]], $MachinePrecision]], N[(x$95$m * N[(y * (-z)), $MachinePrecision]), $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}\;z \leq -1.65 \cdot 10^{-63} \lor \neg \left(z \leq 3.4 \cdot 10^{+98}\right):\\
\;\;\;\;x\_m \cdot \left(y \cdot \left(-z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x\_m\\
\end{array}
\end{array}
if z < -1.64999999999999997e-63 or 3.39999999999999972e98 < z Initial program 88.9%
Taylor expanded in y around inf 73.8%
mul-1-neg73.8%
distribute-rgt-neg-out73.8%
Simplified73.8%
if -1.64999999999999997e-63 < z < 3.39999999999999972e98Initial program 99.2%
Taylor expanded in y around 0 70.8%
Final simplification72.2%
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 -5.5e-6)
(* y (* z (- x_m)))
(if (<= y 9.2e-168) x_m (* z (* x_m (- y)))))))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 <= -5.5e-6) {
tmp = y * (z * -x_m);
} else if (y <= 9.2e-168) {
tmp = x_m;
} else {
tmp = z * (x_m * -y);
}
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 <= (-5.5d-6)) then
tmp = y * (z * -x_m)
else if (y <= 9.2d-168) then
tmp = x_m
else
tmp = z * (x_m * -y)
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 <= -5.5e-6) {
tmp = y * (z * -x_m);
} else if (y <= 9.2e-168) {
tmp = x_m;
} else {
tmp = z * (x_m * -y);
}
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 <= -5.5e-6: tmp = y * (z * -x_m) elif y <= 9.2e-168: tmp = x_m else: tmp = z * (x_m * -y) 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 (y <= -5.5e-6) tmp = Float64(y * Float64(z * Float64(-x_m))); elseif (y <= 9.2e-168) tmp = x_m; else tmp = Float64(z * Float64(x_m * Float64(-y))); 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 <= -5.5e-6)
tmp = y * (z * -x_m);
elseif (y <= 9.2e-168)
tmp = x_m;
else
tmp = z * (x_m * -y);
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[y, -5.5e-6], N[(y * N[(z * (-x$95$m)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.2e-168], x$95$m, N[(z * N[(x$95$m * (-y)), $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 \leq -5.5 \cdot 10^{-6}:\\
\;\;\;\;y \cdot \left(z \cdot \left(-x\_m\right)\right)\\
\mathbf{elif}\;y \leq 9.2 \cdot 10^{-168}:\\
\;\;\;\;x\_m\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(x\_m \cdot \left(-y\right)\right)\\
\end{array}
\end{array}
if y < -5.4999999999999999e-6Initial program 83.6%
Taylor expanded in y around inf 69.2%
mul-1-neg69.2%
*-commutative69.2%
associate-*r*84.9%
distribute-rgt-neg-in84.9%
Simplified84.9%
if -5.4999999999999999e-6 < y < 9.19999999999999942e-168Initial program 99.9%
Taylor expanded in y around 0 81.1%
if 9.19999999999999942e-168 < y Initial program 96.3%
Taylor expanded in z around inf 88.5%
Taylor expanded in y around inf 61.7%
neg-mul-161.7%
distribute-rgt-neg-in61.7%
Simplified61.7%
Final simplification74.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 (if (<= y -1.85e+84) (- x_m (* y (* x_m z))) (* x_m (- 1.0 (* 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 (y <= -1.85e+84) {
tmp = x_m - (y * (x_m * z));
} else {
tmp = x_m * (1.0 - (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 (y <= (-1.85d+84)) then
tmp = x_m - (y * (x_m * z))
else
tmp = x_m * (1.0d0 - (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 (y <= -1.85e+84) {
tmp = x_m - (y * (x_m * z));
} else {
tmp = x_m * (1.0 - (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 y <= -1.85e+84: tmp = x_m - (y * (x_m * z)) else: tmp = x_m * (1.0 - (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 (y <= -1.85e+84) tmp = Float64(x_m - Float64(y * Float64(x_m * z))); else tmp = Float64(x_m * Float64(1.0 - 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 (y <= -1.85e+84)
tmp = x_m - (y * (x_m * z));
else
tmp = x_m * (1.0 - (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[y, -1.85e+84], N[(x$95$m - N[(y * N[(x$95$m * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(1.0 - 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}\;y \leq -1.85 \cdot 10^{+84}:\\
\;\;\;\;x\_m - y \cdot \left(x\_m \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \left(1 - y \cdot z\right)\\
\end{array}
\end{array}
if y < -1.85e84Initial program 79.4%
sub-neg79.4%
distribute-rgt-in79.4%
*-un-lft-identity79.4%
distribute-rgt-neg-in79.4%
Applied egg-rr79.4%
associate-*l*98.2%
add-sqr-sqrt0.0%
sqrt-unprod7.3%
sqr-neg7.3%
sqrt-unprod11.1%
add-sqr-sqrt11.1%
cancel-sign-sub-inv11.1%
*-commutative11.1%
distribute-lft-neg-out11.1%
*-commutative11.1%
distribute-lft-neg-in11.1%
distribute-rgt-neg-out11.1%
add-sqr-sqrt11.1%
sqrt-unprod7.3%
sqr-neg7.3%
sqrt-unprod0.0%
add-sqr-sqrt98.2%
associate-*l*79.4%
*-commutative79.4%
Applied egg-rr79.4%
add-cube-cbrt78.8%
pow378.8%
Applied egg-rr78.8%
rem-cube-cbrt79.4%
associate-*r*88.8%
*-commutative88.8%
associate-*r*98.2%
Simplified98.2%
if -1.85e84 < y Initial program 98.1%
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 (<= z 2.55e+120) x_m (/ (* x_m z) 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 (z <= 2.55e+120) {
tmp = x_m;
} else {
tmp = (x_m * z) / 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 (z <= 2.55d+120) then
tmp = x_m
else
tmp = (x_m * z) / 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 (z <= 2.55e+120) {
tmp = x_m;
} else {
tmp = (x_m * z) / 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 z <= 2.55e+120: tmp = x_m else: tmp = (x_m * z) / 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 (z <= 2.55e+120) tmp = x_m; else tmp = Float64(Float64(x_m * z) / 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 (z <= 2.55e+120)
tmp = x_m;
else
tmp = (x_m * z) / 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[z, 2.55e+120], x$95$m, N[(N[(x$95$m * z), $MachinePrecision] / z), $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}\;z \leq 2.55 \cdot 10^{+120}:\\
\;\;\;\;x\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m \cdot z}{z}\\
\end{array}
\end{array}
if z < 2.55000000000000014e120Initial program 96.4%
Taylor expanded in y around 0 52.3%
if 2.55000000000000014e120 < z Initial program 82.9%
Taylor expanded in z around inf 88.7%
Taylor expanded in y around 0 8.0%
associate-*r/22.5%
*-commutative22.5%
Applied egg-rr22.5%
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 94.4%
Taylor expanded in y around 0 46.3%
herbie shell --seed 2024179
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, I"
:precision binary64
(* x (- 1.0 (* y z))))