
(FPCore (x y z t a) :precision binary64 (/ (* (* x y) z) (sqrt (- (* z z) (* t a)))))
double code(double x, double y, double z, double t, double a) {
return ((x * y) * z) / sqrt(((z * z) - (t * a)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((x * y) * z) / sqrt(((z * z) - (t * a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) * z) / Math.sqrt(((z * z) - (t * a)));
}
def code(x, y, z, t, a): return ((x * y) * z) / math.sqrt(((z * z) - (t * a)))
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) * z) / sqrt(Float64(Float64(z * z) - Float64(t * a)))) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) * z) / sqrt(((z * z) - (t * a))); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision] / N[Sqrt[N[(N[(z * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (/ (* (* x y) z) (sqrt (- (* z z) (* t a)))))
double code(double x, double y, double z, double t, double a) {
return ((x * y) * z) / sqrt(((z * z) - (t * a)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((x * y) * z) / sqrt(((z * z) - (t * a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) * z) / Math.sqrt(((z * z) - (t * a)));
}
def code(x, y, z, t, a): return ((x * y) * z) / math.sqrt(((z * z) - (t * a)))
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) * z) / sqrt(Float64(Float64(z * z) - Float64(t * a)))) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) * z) / sqrt(((z * z) - (t * a))); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision] / N[Sqrt[N[(N[(z * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}
\end{array}
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
(FPCore (z_s y_s x_s x_m y_m z_m t a)
:precision binary64
(*
z_s
(*
y_s
(*
x_s
(if (<= z_m 1.85e+56)
(/ (* x_m (* z_m y_m)) (sqrt (- (* z_m z_m) (* t a))))
(/ (* x_m y_m) (/ (fma -0.5 (* a (/ t z_m)) z_m) z_m)))))))x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
z_m = fabs(z);
z_s = copysign(1.0, z);
assert(x_m < y_m && y_m < z_m && z_m < t && t < a);
double code(double z_s, double y_s, double x_s, double x_m, double y_m, double z_m, double t, double a) {
double tmp;
if (z_m <= 1.85e+56) {
tmp = (x_m * (z_m * y_m)) / sqrt(((z_m * z_m) - (t * a)));
} else {
tmp = (x_m * y_m) / (fma(-0.5, (a * (t / z_m)), z_m) / z_m);
}
return z_s * (y_s * (x_s * tmp));
}
x_m = abs(x) x_s = copysign(1.0, x) y_m = abs(y) y_s = copysign(1.0, y) z_m = abs(z) z_s = copysign(1.0, z) x_m, y_m, z_m, t, a = sort([x_m, y_m, z_m, t, a]) function code(z_s, y_s, x_s, x_m, y_m, z_m, t, a) tmp = 0.0 if (z_m <= 1.85e+56) tmp = Float64(Float64(x_m * Float64(z_m * y_m)) / sqrt(Float64(Float64(z_m * z_m) - Float64(t * a)))); else tmp = Float64(Float64(x_m * y_m) / Float64(fma(-0.5, Float64(a * Float64(t / z_m)), z_m) / z_m)); end return Float64(z_s * Float64(y_s * Float64(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]
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
z_m = N[Abs[z], $MachinePrecision]
z_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
code[z$95$s_, y$95$s_, x$95$s_, x$95$m_, y$95$m_, z$95$m_, t_, a_] := N[(z$95$s * N[(y$95$s * N[(x$95$s * If[LessEqual[z$95$m, 1.85e+56], N[(N[(x$95$m * N[(z$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(N[(z$95$m * z$95$m), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * y$95$m), $MachinePrecision] / N[(N[(-0.5 * N[(a * N[(t / z$95$m), $MachinePrecision]), $MachinePrecision] + z$95$m), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
[x_m, y_m, z_m, t, a] = \mathsf{sort}([x_m, y_m, z_m, t, a])\\
\\
z_s \cdot \left(y_s \cdot \left(x_s \cdot \begin{array}{l}
\mathbf{if}\;z_m \leq 1.85 \cdot 10^{+56}:\\
\;\;\;\;\frac{x_m \cdot \left(z_m \cdot y_m\right)}{\sqrt{z_m \cdot z_m - t \cdot a}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x_m \cdot y_m}{\frac{\mathsf{fma}\left(-0.5, a \cdot \frac{t}{z_m}, z_m\right)}{z_m}}\\
\end{array}\right)\right)
\end{array}
if z < 1.84999999999999998e56Initial program 71.6%
associate-*l*70.2%
Simplified70.2%
if 1.84999999999999998e56 < z Initial program 34.2%
Taylor expanded in z around inf 74.6%
associate-/l*91.0%
div-inv91.0%
+-commutative91.0%
fma-def91.0%
associate-/l*98.6%
div-inv98.6%
clear-num98.6%
Applied egg-rr98.6%
associate-*r/98.6%
*-rgt-identity98.6%
Simplified98.6%
Final simplification77.3%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
(FPCore (z_s y_s x_s x_m y_m z_m t a)
:precision binary64
(let* ((t_1 (* y_m (/ x_m (/ (sqrt (* t (- a))) z_m)))))
(*
z_s
(*
y_s
(*
x_s
(if (<= z_m 3.7e-114)
t_1
(if (<= z_m 5.4e-79)
(* x_m (/ (* z_m y_m) (+ z_m (* -0.5 (/ (* t a) z_m)))))
(if (<= z_m 3.2e-62) t_1 (* x_m y_m)))))))))x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
z_m = fabs(z);
z_s = copysign(1.0, z);
assert(x_m < y_m && y_m < z_m && z_m < t && t < a);
double code(double z_s, double y_s, double x_s, double x_m, double y_m, double z_m, double t, double a) {
double t_1 = y_m * (x_m / (sqrt((t * -a)) / z_m));
double tmp;
if (z_m <= 3.7e-114) {
tmp = t_1;
} else if (z_m <= 5.4e-79) {
tmp = x_m * ((z_m * y_m) / (z_m + (-0.5 * ((t * a) / z_m))));
} else if (z_m <= 3.2e-62) {
tmp = t_1;
} else {
tmp = x_m * y_m;
}
return z_s * (y_s * (x_s * tmp));
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
y_m = abs(y)
y_s = copysign(1.0d0, y)
z_m = abs(z)
z_s = copysign(1.0d0, z)
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
real(8) function code(z_s, y_s, x_s, x_m, y_m, z_m, t, a)
real(8), intent (in) :: z_s
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = y_m * (x_m / (sqrt((t * -a)) / z_m))
if (z_m <= 3.7d-114) then
tmp = t_1
else if (z_m <= 5.4d-79) then
tmp = x_m * ((z_m * y_m) / (z_m + ((-0.5d0) * ((t * a) / z_m))))
else if (z_m <= 3.2d-62) then
tmp = t_1
else
tmp = x_m * y_m
end if
code = z_s * (y_s * (x_s * tmp))
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
assert x_m < y_m && y_m < z_m && z_m < t && t < a;
public static double code(double z_s, double y_s, double x_s, double x_m, double y_m, double z_m, double t, double a) {
double t_1 = y_m * (x_m / (Math.sqrt((t * -a)) / z_m));
double tmp;
if (z_m <= 3.7e-114) {
tmp = t_1;
} else if (z_m <= 5.4e-79) {
tmp = x_m * ((z_m * y_m) / (z_m + (-0.5 * ((t * a) / z_m))));
} else if (z_m <= 3.2e-62) {
tmp = t_1;
} else {
tmp = x_m * y_m;
}
return z_s * (y_s * (x_s * tmp));
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) y_m = math.fabs(y) y_s = math.copysign(1.0, y) z_m = math.fabs(z) z_s = math.copysign(1.0, z) [x_m, y_m, z_m, t, a] = sort([x_m, y_m, z_m, t, a]) def code(z_s, y_s, x_s, x_m, y_m, z_m, t, a): t_1 = y_m * (x_m / (math.sqrt((t * -a)) / z_m)) tmp = 0 if z_m <= 3.7e-114: tmp = t_1 elif z_m <= 5.4e-79: tmp = x_m * ((z_m * y_m) / (z_m + (-0.5 * ((t * a) / z_m)))) elif z_m <= 3.2e-62: tmp = t_1 else: tmp = x_m * y_m return z_s * (y_s * (x_s * tmp))
x_m = abs(x) x_s = copysign(1.0, x) y_m = abs(y) y_s = copysign(1.0, y) z_m = abs(z) z_s = copysign(1.0, z) x_m, y_m, z_m, t, a = sort([x_m, y_m, z_m, t, a]) function code(z_s, y_s, x_s, x_m, y_m, z_m, t, a) t_1 = Float64(y_m * Float64(x_m / Float64(sqrt(Float64(t * Float64(-a))) / z_m))) tmp = 0.0 if (z_m <= 3.7e-114) tmp = t_1; elseif (z_m <= 5.4e-79) tmp = Float64(x_m * Float64(Float64(z_m * y_m) / Float64(z_m + Float64(-0.5 * Float64(Float64(t * a) / z_m))))); elseif (z_m <= 3.2e-62) tmp = t_1; else tmp = Float64(x_m * y_m); end return Float64(z_s * Float64(y_s * Float64(x_s * tmp))) end
x_m = abs(x);
x_s = sign(x) * abs(1.0);
y_m = abs(y);
y_s = sign(y) * abs(1.0);
z_m = abs(z);
z_s = sign(z) * abs(1.0);
x_m, y_m, z_m, t, a = num2cell(sort([x_m, y_m, z_m, t, a])){:}
function tmp_2 = code(z_s, y_s, x_s, x_m, y_m, z_m, t, a)
t_1 = y_m * (x_m / (sqrt((t * -a)) / z_m));
tmp = 0.0;
if (z_m <= 3.7e-114)
tmp = t_1;
elseif (z_m <= 5.4e-79)
tmp = x_m * ((z_m * y_m) / (z_m + (-0.5 * ((t * a) / z_m))));
elseif (z_m <= 3.2e-62)
tmp = t_1;
else
tmp = x_m * y_m;
end
tmp_2 = z_s * (y_s * (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]
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
z_m = N[Abs[z], $MachinePrecision]
z_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
code[z$95$s_, y$95$s_, x$95$s_, x$95$m_, y$95$m_, z$95$m_, t_, a_] := Block[{t$95$1 = N[(y$95$m * N[(x$95$m / N[(N[Sqrt[N[(t * (-a)), $MachinePrecision]], $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(z$95$s * N[(y$95$s * N[(x$95$s * If[LessEqual[z$95$m, 3.7e-114], t$95$1, If[LessEqual[z$95$m, 5.4e-79], N[(x$95$m * N[(N[(z$95$m * y$95$m), $MachinePrecision] / N[(z$95$m + N[(-0.5 * N[(N[(t * a), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z$95$m, 3.2e-62], t$95$1, N[(x$95$m * y$95$m), $MachinePrecision]]]]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
[x_m, y_m, z_m, t, a] = \mathsf{sort}([x_m, y_m, z_m, t, a])\\
\\
\begin{array}{l}
t_1 := y_m \cdot \frac{x_m}{\frac{\sqrt{t \cdot \left(-a\right)}}{z_m}}\\
z_s \cdot \left(y_s \cdot \left(x_s \cdot \begin{array}{l}
\mathbf{if}\;z_m \leq 3.7 \cdot 10^{-114}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z_m \leq 5.4 \cdot 10^{-79}:\\
\;\;\;\;x_m \cdot \frac{z_m \cdot y_m}{z_m + -0.5 \cdot \frac{t \cdot a}{z_m}}\\
\mathbf{elif}\;z_m \leq 3.2 \cdot 10^{-62}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x_m \cdot y_m\\
\end{array}\right)\right)
\end{array}
\end{array}
if z < 3.69999999999999965e-114 or 5.4000000000000004e-79 < z < 3.20000000000000021e-62Initial program 68.5%
associate-/l*68.1%
associate-*l/66.7%
*-commutative66.7%
associate-/l*67.6%
Simplified67.6%
associate-/l*66.7%
div-inv66.7%
pow266.7%
Applied egg-rr66.7%
associate-*r/66.7%
*-rgt-identity66.7%
*-commutative66.7%
Simplified66.7%
Taylor expanded in z around 0 38.1%
mul-1-neg38.1%
distribute-rgt-neg-out38.1%
Simplified38.1%
if 3.69999999999999965e-114 < z < 5.4000000000000004e-79Initial program 76.5%
Taylor expanded in z around inf 52.9%
associate-/l*76.4%
div-inv76.4%
+-commutative76.4%
fma-def76.4%
associate-/l*76.4%
div-inv76.4%
clear-num76.4%
Applied egg-rr76.4%
associate-*r/76.4%
*-rgt-identity76.4%
Simplified76.4%
Taylor expanded in x around 0 52.9%
associate-*r*52.9%
+-commutative52.9%
associate-*r/52.9%
*-commutative52.9%
fma-udef52.9%
associate-*l/76.4%
associate-*r/76.1%
associate-*l*76.1%
*-commutative76.1%
fma-udef76.1%
*-commutative76.1%
fma-def76.1%
Simplified76.1%
Taylor expanded in y around 0 76.4%
if 3.20000000000000021e-62 < z Initial program 50.0%
associate-/l*51.3%
associate-*l/50.4%
*-commutative50.4%
associate-/l*48.7%
Simplified48.7%
Taylor expanded in z around inf 90.4%
Final simplification56.7%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
(FPCore (z_s y_s x_s x_m y_m z_m t a)
:precision binary64
(let* ((t_1 (sqrt (* t (- a)))))
(*
z_s
(*
y_s
(*
x_s
(if (<= z_m 3.6e-113)
(/ y_m (/ t_1 (* z_m x_m)))
(if (<= z_m 1e-79)
(* x_m (/ (* z_m y_m) (+ z_m (* -0.5 (/ (* t a) z_m)))))
(if (<= z_m 1.7e-68) (* y_m (/ x_m (/ t_1 z_m))) (* x_m y_m)))))))))x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
z_m = fabs(z);
z_s = copysign(1.0, z);
assert(x_m < y_m && y_m < z_m && z_m < t && t < a);
double code(double z_s, double y_s, double x_s, double x_m, double y_m, double z_m, double t, double a) {
double t_1 = sqrt((t * -a));
double tmp;
if (z_m <= 3.6e-113) {
tmp = y_m / (t_1 / (z_m * x_m));
} else if (z_m <= 1e-79) {
tmp = x_m * ((z_m * y_m) / (z_m + (-0.5 * ((t * a) / z_m))));
} else if (z_m <= 1.7e-68) {
tmp = y_m * (x_m / (t_1 / z_m));
} else {
tmp = x_m * y_m;
}
return z_s * (y_s * (x_s * tmp));
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
y_m = abs(y)
y_s = copysign(1.0d0, y)
z_m = abs(z)
z_s = copysign(1.0d0, z)
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
real(8) function code(z_s, y_s, x_s, x_m, y_m, z_m, t, a)
real(8), intent (in) :: z_s
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((t * -a))
if (z_m <= 3.6d-113) then
tmp = y_m / (t_1 / (z_m * x_m))
else if (z_m <= 1d-79) then
tmp = x_m * ((z_m * y_m) / (z_m + ((-0.5d0) * ((t * a) / z_m))))
else if (z_m <= 1.7d-68) then
tmp = y_m * (x_m / (t_1 / z_m))
else
tmp = x_m * y_m
end if
code = z_s * (y_s * (x_s * tmp))
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
assert x_m < y_m && y_m < z_m && z_m < t && t < a;
public static double code(double z_s, double y_s, double x_s, double x_m, double y_m, double z_m, double t, double a) {
double t_1 = Math.sqrt((t * -a));
double tmp;
if (z_m <= 3.6e-113) {
tmp = y_m / (t_1 / (z_m * x_m));
} else if (z_m <= 1e-79) {
tmp = x_m * ((z_m * y_m) / (z_m + (-0.5 * ((t * a) / z_m))));
} else if (z_m <= 1.7e-68) {
tmp = y_m * (x_m / (t_1 / z_m));
} else {
tmp = x_m * y_m;
}
return z_s * (y_s * (x_s * tmp));
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) y_m = math.fabs(y) y_s = math.copysign(1.0, y) z_m = math.fabs(z) z_s = math.copysign(1.0, z) [x_m, y_m, z_m, t, a] = sort([x_m, y_m, z_m, t, a]) def code(z_s, y_s, x_s, x_m, y_m, z_m, t, a): t_1 = math.sqrt((t * -a)) tmp = 0 if z_m <= 3.6e-113: tmp = y_m / (t_1 / (z_m * x_m)) elif z_m <= 1e-79: tmp = x_m * ((z_m * y_m) / (z_m + (-0.5 * ((t * a) / z_m)))) elif z_m <= 1.7e-68: tmp = y_m * (x_m / (t_1 / z_m)) else: tmp = x_m * y_m return z_s * (y_s * (x_s * tmp))
x_m = abs(x) x_s = copysign(1.0, x) y_m = abs(y) y_s = copysign(1.0, y) z_m = abs(z) z_s = copysign(1.0, z) x_m, y_m, z_m, t, a = sort([x_m, y_m, z_m, t, a]) function code(z_s, y_s, x_s, x_m, y_m, z_m, t, a) t_1 = sqrt(Float64(t * Float64(-a))) tmp = 0.0 if (z_m <= 3.6e-113) tmp = Float64(y_m / Float64(t_1 / Float64(z_m * x_m))); elseif (z_m <= 1e-79) tmp = Float64(x_m * Float64(Float64(z_m * y_m) / Float64(z_m + Float64(-0.5 * Float64(Float64(t * a) / z_m))))); elseif (z_m <= 1.7e-68) tmp = Float64(y_m * Float64(x_m / Float64(t_1 / z_m))); else tmp = Float64(x_m * y_m); end return Float64(z_s * Float64(y_s * Float64(x_s * tmp))) end
x_m = abs(x);
x_s = sign(x) * abs(1.0);
y_m = abs(y);
y_s = sign(y) * abs(1.0);
z_m = abs(z);
z_s = sign(z) * abs(1.0);
x_m, y_m, z_m, t, a = num2cell(sort([x_m, y_m, z_m, t, a])){:}
function tmp_2 = code(z_s, y_s, x_s, x_m, y_m, z_m, t, a)
t_1 = sqrt((t * -a));
tmp = 0.0;
if (z_m <= 3.6e-113)
tmp = y_m / (t_1 / (z_m * x_m));
elseif (z_m <= 1e-79)
tmp = x_m * ((z_m * y_m) / (z_m + (-0.5 * ((t * a) / z_m))));
elseif (z_m <= 1.7e-68)
tmp = y_m * (x_m / (t_1 / z_m));
else
tmp = x_m * y_m;
end
tmp_2 = z_s * (y_s * (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]
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
z_m = N[Abs[z], $MachinePrecision]
z_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
code[z$95$s_, y$95$s_, x$95$s_, x$95$m_, y$95$m_, z$95$m_, t_, a_] := Block[{t$95$1 = N[Sqrt[N[(t * (-a)), $MachinePrecision]], $MachinePrecision]}, N[(z$95$s * N[(y$95$s * N[(x$95$s * If[LessEqual[z$95$m, 3.6e-113], N[(y$95$m / N[(t$95$1 / N[(z$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z$95$m, 1e-79], N[(x$95$m * N[(N[(z$95$m * y$95$m), $MachinePrecision] / N[(z$95$m + N[(-0.5 * N[(N[(t * a), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z$95$m, 1.7e-68], N[(y$95$m * N[(x$95$m / N[(t$95$1 / z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m * y$95$m), $MachinePrecision]]]]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
[x_m, y_m, z_m, t, a] = \mathsf{sort}([x_m, y_m, z_m, t, a])\\
\\
\begin{array}{l}
t_1 := \sqrt{t \cdot \left(-a\right)}\\
z_s \cdot \left(y_s \cdot \left(x_s \cdot \begin{array}{l}
\mathbf{if}\;z_m \leq 3.6 \cdot 10^{-113}:\\
\;\;\;\;\frac{y_m}{\frac{t_1}{z_m \cdot x_m}}\\
\mathbf{elif}\;z_m \leq 10^{-79}:\\
\;\;\;\;x_m \cdot \frac{z_m \cdot y_m}{z_m + -0.5 \cdot \frac{t \cdot a}{z_m}}\\
\mathbf{elif}\;z_m \leq 1.7 \cdot 10^{-68}:\\
\;\;\;\;y_m \cdot \frac{x_m}{\frac{t_1}{z_m}}\\
\mathbf{else}:\\
\;\;\;\;x_m \cdot y_m\\
\end{array}\right)\right)
\end{array}
\end{array}
if z < 3.59999999999999975e-113Initial program 68.1%
associate-*l*66.4%
*-commutative66.4%
associate-*l*65.4%
*-commutative65.4%
associate-/l*66.8%
Simplified66.8%
Taylor expanded in z around 0 38.1%
mul-1-neg38.1%
*-commutative38.1%
distribute-rgt-neg-in38.1%
Simplified38.1%
if 3.59999999999999975e-113 < z < 1e-79Initial program 76.5%
Taylor expanded in z around inf 52.9%
associate-/l*76.4%
div-inv76.4%
+-commutative76.4%
fma-def76.4%
associate-/l*76.4%
div-inv76.4%
clear-num76.4%
Applied egg-rr76.4%
associate-*r/76.4%
*-rgt-identity76.4%
Simplified76.4%
Taylor expanded in x around 0 52.9%
associate-*r*52.9%
+-commutative52.9%
associate-*r/52.9%
*-commutative52.9%
fma-udef52.9%
associate-*l/76.4%
associate-*r/76.1%
associate-*l*76.1%
*-commutative76.1%
fma-udef76.1%
*-commutative76.1%
fma-def76.1%
Simplified76.1%
Taylor expanded in y around 0 76.4%
if 1e-79 < z < 1.70000000000000009e-68Initial program 99.2%
associate-/l*99.2%
associate-*l/99.2%
*-commutative99.2%
associate-/l*100.0%
Simplified100.0%
associate-/l*99.2%
div-inv100.0%
pow2100.0%
Applied egg-rr100.0%
associate-*r/99.2%
*-rgt-identity99.2%
*-commutative99.2%
Simplified99.2%
Taylor expanded in z around 0 99.2%
mul-1-neg99.2%
distribute-rgt-neg-out99.2%
Simplified99.2%
if 1.70000000000000009e-68 < z Initial program 50.0%
associate-/l*51.3%
associate-*l/50.4%
*-commutative50.4%
associate-/l*48.7%
Simplified48.7%
Taylor expanded in z around inf 90.4%
Final simplification57.1%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
(FPCore (z_s y_s x_s x_m y_m z_m t a)
:precision binary64
(let* ((t_1 (/ (* x_m (* z_m y_m)) (sqrt (* t (- a))))))
(*
z_s
(*
y_s
(*
x_s
(if (<= z_m 1.2e-112)
t_1
(if (<= z_m 2.1e-81)
(* x_m (/ (* z_m y_m) (+ z_m (* -0.5 (/ (* t a) z_m)))))
(if (<= z_m 6.2e-65) t_1 (* x_m y_m)))))))))x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
z_m = fabs(z);
z_s = copysign(1.0, z);
assert(x_m < y_m && y_m < z_m && z_m < t && t < a);
double code(double z_s, double y_s, double x_s, double x_m, double y_m, double z_m, double t, double a) {
double t_1 = (x_m * (z_m * y_m)) / sqrt((t * -a));
double tmp;
if (z_m <= 1.2e-112) {
tmp = t_1;
} else if (z_m <= 2.1e-81) {
tmp = x_m * ((z_m * y_m) / (z_m + (-0.5 * ((t * a) / z_m))));
} else if (z_m <= 6.2e-65) {
tmp = t_1;
} else {
tmp = x_m * y_m;
}
return z_s * (y_s * (x_s * tmp));
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
y_m = abs(y)
y_s = copysign(1.0d0, y)
z_m = abs(z)
z_s = copysign(1.0d0, z)
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
real(8) function code(z_s, y_s, x_s, x_m, y_m, z_m, t, a)
real(8), intent (in) :: z_s
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (x_m * (z_m * y_m)) / sqrt((t * -a))
if (z_m <= 1.2d-112) then
tmp = t_1
else if (z_m <= 2.1d-81) then
tmp = x_m * ((z_m * y_m) / (z_m + ((-0.5d0) * ((t * a) / z_m))))
else if (z_m <= 6.2d-65) then
tmp = t_1
else
tmp = x_m * y_m
end if
code = z_s * (y_s * (x_s * tmp))
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
assert x_m < y_m && y_m < z_m && z_m < t && t < a;
public static double code(double z_s, double y_s, double x_s, double x_m, double y_m, double z_m, double t, double a) {
double t_1 = (x_m * (z_m * y_m)) / Math.sqrt((t * -a));
double tmp;
if (z_m <= 1.2e-112) {
tmp = t_1;
} else if (z_m <= 2.1e-81) {
tmp = x_m * ((z_m * y_m) / (z_m + (-0.5 * ((t * a) / z_m))));
} else if (z_m <= 6.2e-65) {
tmp = t_1;
} else {
tmp = x_m * y_m;
}
return z_s * (y_s * (x_s * tmp));
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) y_m = math.fabs(y) y_s = math.copysign(1.0, y) z_m = math.fabs(z) z_s = math.copysign(1.0, z) [x_m, y_m, z_m, t, a] = sort([x_m, y_m, z_m, t, a]) def code(z_s, y_s, x_s, x_m, y_m, z_m, t, a): t_1 = (x_m * (z_m * y_m)) / math.sqrt((t * -a)) tmp = 0 if z_m <= 1.2e-112: tmp = t_1 elif z_m <= 2.1e-81: tmp = x_m * ((z_m * y_m) / (z_m + (-0.5 * ((t * a) / z_m)))) elif z_m <= 6.2e-65: tmp = t_1 else: tmp = x_m * y_m return z_s * (y_s * (x_s * tmp))
x_m = abs(x) x_s = copysign(1.0, x) y_m = abs(y) y_s = copysign(1.0, y) z_m = abs(z) z_s = copysign(1.0, z) x_m, y_m, z_m, t, a = sort([x_m, y_m, z_m, t, a]) function code(z_s, y_s, x_s, x_m, y_m, z_m, t, a) t_1 = Float64(Float64(x_m * Float64(z_m * y_m)) / sqrt(Float64(t * Float64(-a)))) tmp = 0.0 if (z_m <= 1.2e-112) tmp = t_1; elseif (z_m <= 2.1e-81) tmp = Float64(x_m * Float64(Float64(z_m * y_m) / Float64(z_m + Float64(-0.5 * Float64(Float64(t * a) / z_m))))); elseif (z_m <= 6.2e-65) tmp = t_1; else tmp = Float64(x_m * y_m); end return Float64(z_s * Float64(y_s * Float64(x_s * tmp))) end
x_m = abs(x);
x_s = sign(x) * abs(1.0);
y_m = abs(y);
y_s = sign(y) * abs(1.0);
z_m = abs(z);
z_s = sign(z) * abs(1.0);
x_m, y_m, z_m, t, a = num2cell(sort([x_m, y_m, z_m, t, a])){:}
function tmp_2 = code(z_s, y_s, x_s, x_m, y_m, z_m, t, a)
t_1 = (x_m * (z_m * y_m)) / sqrt((t * -a));
tmp = 0.0;
if (z_m <= 1.2e-112)
tmp = t_1;
elseif (z_m <= 2.1e-81)
tmp = x_m * ((z_m * y_m) / (z_m + (-0.5 * ((t * a) / z_m))));
elseif (z_m <= 6.2e-65)
tmp = t_1;
else
tmp = x_m * y_m;
end
tmp_2 = z_s * (y_s * (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]
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
z_m = N[Abs[z], $MachinePrecision]
z_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
code[z$95$s_, y$95$s_, x$95$s_, x$95$m_, y$95$m_, z$95$m_, t_, a_] := Block[{t$95$1 = N[(N[(x$95$m * N[(z$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(t * (-a)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(z$95$s * N[(y$95$s * N[(x$95$s * If[LessEqual[z$95$m, 1.2e-112], t$95$1, If[LessEqual[z$95$m, 2.1e-81], N[(x$95$m * N[(N[(z$95$m * y$95$m), $MachinePrecision] / N[(z$95$m + N[(-0.5 * N[(N[(t * a), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z$95$m, 6.2e-65], t$95$1, N[(x$95$m * y$95$m), $MachinePrecision]]]]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
[x_m, y_m, z_m, t, a] = \mathsf{sort}([x_m, y_m, z_m, t, a])\\
\\
\begin{array}{l}
t_1 := \frac{x_m \cdot \left(z_m \cdot y_m\right)}{\sqrt{t \cdot \left(-a\right)}}\\
z_s \cdot \left(y_s \cdot \left(x_s \cdot \begin{array}{l}
\mathbf{if}\;z_m \leq 1.2 \cdot 10^{-112}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z_m \leq 2.1 \cdot 10^{-81}:\\
\;\;\;\;x_m \cdot \frac{z_m \cdot y_m}{z_m + -0.5 \cdot \frac{t \cdot a}{z_m}}\\
\mathbf{elif}\;z_m \leq 6.2 \cdot 10^{-65}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x_m \cdot y_m\\
\end{array}\right)\right)
\end{array}
\end{array}
if z < 1.2e-112 or 2.0999999999999999e-81 < z < 6.20000000000000032e-65Initial program 68.5%
associate-*l*66.8%
Simplified66.8%
Taylor expanded in z around 0 42.0%
mul-1-neg38.8%
*-commutative38.8%
distribute-rgt-neg-in38.8%
Simplified42.0%
if 1.2e-112 < z < 2.0999999999999999e-81Initial program 76.5%
Taylor expanded in z around inf 52.9%
associate-/l*76.4%
div-inv76.4%
+-commutative76.4%
fma-def76.4%
associate-/l*76.4%
div-inv76.4%
clear-num76.4%
Applied egg-rr76.4%
associate-*r/76.4%
*-rgt-identity76.4%
Simplified76.4%
Taylor expanded in x around 0 52.9%
associate-*r*52.9%
+-commutative52.9%
associate-*r/52.9%
*-commutative52.9%
fma-udef52.9%
associate-*l/76.4%
associate-*r/76.1%
associate-*l*76.1%
*-commutative76.1%
fma-udef76.1%
*-commutative76.1%
fma-def76.1%
Simplified76.1%
Taylor expanded in y around 0 76.4%
if 6.20000000000000032e-65 < z Initial program 50.0%
associate-/l*51.3%
associate-*l/50.4%
*-commutative50.4%
associate-/l*48.7%
Simplified48.7%
Taylor expanded in z around inf 90.4%
Final simplification59.2%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
(FPCore (z_s y_s x_s x_m y_m z_m t a)
:precision binary64
(*
z_s
(*
y_s
(*
x_s
(if (<= z_m 2.1e-130)
(/ (* x_m (* z_m y_m)) (sqrt (* t (- a))))
(if (<= z_m 2e+95)
(* y_m (/ (* z_m x_m) (sqrt (- (* z_m z_m) (* t a)))))
(* x_m y_m)))))))x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
z_m = fabs(z);
z_s = copysign(1.0, z);
assert(x_m < y_m && y_m < z_m && z_m < t && t < a);
double code(double z_s, double y_s, double x_s, double x_m, double y_m, double z_m, double t, double a) {
double tmp;
if (z_m <= 2.1e-130) {
tmp = (x_m * (z_m * y_m)) / sqrt((t * -a));
} else if (z_m <= 2e+95) {
tmp = y_m * ((z_m * x_m) / sqrt(((z_m * z_m) - (t * a))));
} else {
tmp = x_m * y_m;
}
return z_s * (y_s * (x_s * tmp));
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
y_m = abs(y)
y_s = copysign(1.0d0, y)
z_m = abs(z)
z_s = copysign(1.0d0, z)
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
real(8) function code(z_s, y_s, x_s, x_m, y_m, z_m, t, a)
real(8), intent (in) :: z_s
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z_m <= 2.1d-130) then
tmp = (x_m * (z_m * y_m)) / sqrt((t * -a))
else if (z_m <= 2d+95) then
tmp = y_m * ((z_m * x_m) / sqrt(((z_m * z_m) - (t * a))))
else
tmp = x_m * y_m
end if
code = z_s * (y_s * (x_s * tmp))
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
assert x_m < y_m && y_m < z_m && z_m < t && t < a;
public static double code(double z_s, double y_s, double x_s, double x_m, double y_m, double z_m, double t, double a) {
double tmp;
if (z_m <= 2.1e-130) {
tmp = (x_m * (z_m * y_m)) / Math.sqrt((t * -a));
} else if (z_m <= 2e+95) {
tmp = y_m * ((z_m * x_m) / Math.sqrt(((z_m * z_m) - (t * a))));
} else {
tmp = x_m * y_m;
}
return z_s * (y_s * (x_s * tmp));
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) y_m = math.fabs(y) y_s = math.copysign(1.0, y) z_m = math.fabs(z) z_s = math.copysign(1.0, z) [x_m, y_m, z_m, t, a] = sort([x_m, y_m, z_m, t, a]) def code(z_s, y_s, x_s, x_m, y_m, z_m, t, a): tmp = 0 if z_m <= 2.1e-130: tmp = (x_m * (z_m * y_m)) / math.sqrt((t * -a)) elif z_m <= 2e+95: tmp = y_m * ((z_m * x_m) / math.sqrt(((z_m * z_m) - (t * a)))) else: tmp = x_m * y_m return z_s * (y_s * (x_s * tmp))
x_m = abs(x) x_s = copysign(1.0, x) y_m = abs(y) y_s = copysign(1.0, y) z_m = abs(z) z_s = copysign(1.0, z) x_m, y_m, z_m, t, a = sort([x_m, y_m, z_m, t, a]) function code(z_s, y_s, x_s, x_m, y_m, z_m, t, a) tmp = 0.0 if (z_m <= 2.1e-130) tmp = Float64(Float64(x_m * Float64(z_m * y_m)) / sqrt(Float64(t * Float64(-a)))); elseif (z_m <= 2e+95) tmp = Float64(y_m * Float64(Float64(z_m * x_m) / sqrt(Float64(Float64(z_m * z_m) - Float64(t * a))))); else tmp = Float64(x_m * y_m); end return Float64(z_s * Float64(y_s * Float64(x_s * tmp))) end
x_m = abs(x);
x_s = sign(x) * abs(1.0);
y_m = abs(y);
y_s = sign(y) * abs(1.0);
z_m = abs(z);
z_s = sign(z) * abs(1.0);
x_m, y_m, z_m, t, a = num2cell(sort([x_m, y_m, z_m, t, a])){:}
function tmp_2 = code(z_s, y_s, x_s, x_m, y_m, z_m, t, a)
tmp = 0.0;
if (z_m <= 2.1e-130)
tmp = (x_m * (z_m * y_m)) / sqrt((t * -a));
elseif (z_m <= 2e+95)
tmp = y_m * ((z_m * x_m) / sqrt(((z_m * z_m) - (t * a))));
else
tmp = x_m * y_m;
end
tmp_2 = z_s * (y_s * (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]
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
z_m = N[Abs[z], $MachinePrecision]
z_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
code[z$95$s_, y$95$s_, x$95$s_, x$95$m_, y$95$m_, z$95$m_, t_, a_] := N[(z$95$s * N[(y$95$s * N[(x$95$s * If[LessEqual[z$95$m, 2.1e-130], N[(N[(x$95$m * N[(z$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(t * (-a)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[z$95$m, 2e+95], N[(y$95$m * N[(N[(z$95$m * x$95$m), $MachinePrecision] / N[Sqrt[N[(N[(z$95$m * z$95$m), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m * y$95$m), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
[x_m, y_m, z_m, t, a] = \mathsf{sort}([x_m, y_m, z_m, t, a])\\
\\
z_s \cdot \left(y_s \cdot \left(x_s \cdot \begin{array}{l}
\mathbf{if}\;z_m \leq 2.1 \cdot 10^{-130}:\\
\;\;\;\;\frac{x_m \cdot \left(z_m \cdot y_m\right)}{\sqrt{t \cdot \left(-a\right)}}\\
\mathbf{elif}\;z_m \leq 2 \cdot 10^{+95}:\\
\;\;\;\;y_m \cdot \frac{z_m \cdot x_m}{\sqrt{z_m \cdot z_m - t \cdot a}}\\
\mathbf{else}:\\
\;\;\;\;x_m \cdot y_m\\
\end{array}\right)\right)
\end{array}
if z < 2.10000000000000002e-130Initial program 67.5%
associate-*l*65.8%
Simplified65.8%
Taylor expanded in z around 0 40.2%
mul-1-neg36.9%
*-commutative36.9%
distribute-rgt-neg-in36.9%
Simplified40.2%
if 2.10000000000000002e-130 < z < 2.00000000000000004e95Initial program 92.7%
associate-/l*95.2%
associate-*l/92.8%
*-commutative92.8%
associate-/l*92.8%
Simplified92.8%
if 2.00000000000000004e95 < z Initial program 26.2%
associate-/l*28.2%
associate-*l/28.5%
*-commutative28.5%
associate-/l*25.9%
Simplified25.9%
Taylor expanded in z around inf 98.4%
Final simplification61.4%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
(FPCore (z_s y_s x_s x_m y_m z_m t a)
:precision binary64
(*
z_s
(*
y_s
(*
x_s
(if (<= z_m 1.26e-129)
(/ (* x_m (* z_m y_m)) (sqrt (* t (- a))))
(if (<= z_m 4e+95)
(* y_m (/ (* z_m x_m) (sqrt (- (* z_m z_m) (* t a)))))
(/ (* x_m y_m) (/ (fma -0.5 (* a (/ t z_m)) z_m) z_m))))))))x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
z_m = fabs(z);
z_s = copysign(1.0, z);
assert(x_m < y_m && y_m < z_m && z_m < t && t < a);
double code(double z_s, double y_s, double x_s, double x_m, double y_m, double z_m, double t, double a) {
double tmp;
if (z_m <= 1.26e-129) {
tmp = (x_m * (z_m * y_m)) / sqrt((t * -a));
} else if (z_m <= 4e+95) {
tmp = y_m * ((z_m * x_m) / sqrt(((z_m * z_m) - (t * a))));
} else {
tmp = (x_m * y_m) / (fma(-0.5, (a * (t / z_m)), z_m) / z_m);
}
return z_s * (y_s * (x_s * tmp));
}
x_m = abs(x) x_s = copysign(1.0, x) y_m = abs(y) y_s = copysign(1.0, y) z_m = abs(z) z_s = copysign(1.0, z) x_m, y_m, z_m, t, a = sort([x_m, y_m, z_m, t, a]) function code(z_s, y_s, x_s, x_m, y_m, z_m, t, a) tmp = 0.0 if (z_m <= 1.26e-129) tmp = Float64(Float64(x_m * Float64(z_m * y_m)) / sqrt(Float64(t * Float64(-a)))); elseif (z_m <= 4e+95) tmp = Float64(y_m * Float64(Float64(z_m * x_m) / sqrt(Float64(Float64(z_m * z_m) - Float64(t * a))))); else tmp = Float64(Float64(x_m * y_m) / Float64(fma(-0.5, Float64(a * Float64(t / z_m)), z_m) / z_m)); end return Float64(z_s * Float64(y_s * Float64(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]
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
z_m = N[Abs[z], $MachinePrecision]
z_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
code[z$95$s_, y$95$s_, x$95$s_, x$95$m_, y$95$m_, z$95$m_, t_, a_] := N[(z$95$s * N[(y$95$s * N[(x$95$s * If[LessEqual[z$95$m, 1.26e-129], N[(N[(x$95$m * N[(z$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(t * (-a)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[z$95$m, 4e+95], N[(y$95$m * N[(N[(z$95$m * x$95$m), $MachinePrecision] / N[Sqrt[N[(N[(z$95$m * z$95$m), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * y$95$m), $MachinePrecision] / N[(N[(-0.5 * N[(a * N[(t / z$95$m), $MachinePrecision]), $MachinePrecision] + z$95$m), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
[x_m, y_m, z_m, t, a] = \mathsf{sort}([x_m, y_m, z_m, t, a])\\
\\
z_s \cdot \left(y_s \cdot \left(x_s \cdot \begin{array}{l}
\mathbf{if}\;z_m \leq 1.26 \cdot 10^{-129}:\\
\;\;\;\;\frac{x_m \cdot \left(z_m \cdot y_m\right)}{\sqrt{t \cdot \left(-a\right)}}\\
\mathbf{elif}\;z_m \leq 4 \cdot 10^{+95}:\\
\;\;\;\;y_m \cdot \frac{z_m \cdot x_m}{\sqrt{z_m \cdot z_m - t \cdot a}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x_m \cdot y_m}{\frac{\mathsf{fma}\left(-0.5, a \cdot \frac{t}{z_m}, z_m\right)}{z_m}}\\
\end{array}\right)\right)
\end{array}
if z < 1.2599999999999999e-129Initial program 67.5%
associate-*l*65.8%
Simplified65.8%
Taylor expanded in z around 0 40.2%
mul-1-neg36.9%
*-commutative36.9%
distribute-rgt-neg-in36.9%
Simplified40.2%
if 1.2599999999999999e-129 < z < 4.00000000000000008e95Initial program 92.7%
associate-/l*95.2%
associate-*l/92.8%
*-commutative92.8%
associate-/l*92.8%
Simplified92.8%
if 4.00000000000000008e95 < z Initial program 26.2%
Taylor expanded in z around inf 71.5%
associate-/l*89.9%
div-inv89.9%
+-commutative89.9%
fma-def89.9%
associate-/l*98.4%
div-inv98.4%
clear-num98.4%
Applied egg-rr98.4%
associate-*r/98.4%
*-rgt-identity98.4%
Simplified98.4%
Final simplification61.4%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
(FPCore (z_s y_s x_s x_m y_m z_m t a)
:precision binary64
(*
z_s
(*
y_s
(*
x_s
(if (<= (* x_m y_m) 4e+49)
(/ y_m (/ (+ z_m (* -0.5 (/ a (/ z_m t)))) (* z_m x_m)))
(* x_m y_m))))))x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
z_m = fabs(z);
z_s = copysign(1.0, z);
assert(x_m < y_m && y_m < z_m && z_m < t && t < a);
double code(double z_s, double y_s, double x_s, double x_m, double y_m, double z_m, double t, double a) {
double tmp;
if ((x_m * y_m) <= 4e+49) {
tmp = y_m / ((z_m + (-0.5 * (a / (z_m / t)))) / (z_m * x_m));
} else {
tmp = x_m * y_m;
}
return z_s * (y_s * (x_s * tmp));
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
y_m = abs(y)
y_s = copysign(1.0d0, y)
z_m = abs(z)
z_s = copysign(1.0d0, z)
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
real(8) function code(z_s, y_s, x_s, x_m, y_m, z_m, t, a)
real(8), intent (in) :: z_s
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((x_m * y_m) <= 4d+49) then
tmp = y_m / ((z_m + ((-0.5d0) * (a / (z_m / t)))) / (z_m * x_m))
else
tmp = x_m * y_m
end if
code = z_s * (y_s * (x_s * tmp))
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
assert x_m < y_m && y_m < z_m && z_m < t && t < a;
public static double code(double z_s, double y_s, double x_s, double x_m, double y_m, double z_m, double t, double a) {
double tmp;
if ((x_m * y_m) <= 4e+49) {
tmp = y_m / ((z_m + (-0.5 * (a / (z_m / t)))) / (z_m * x_m));
} else {
tmp = x_m * y_m;
}
return z_s * (y_s * (x_s * tmp));
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) y_m = math.fabs(y) y_s = math.copysign(1.0, y) z_m = math.fabs(z) z_s = math.copysign(1.0, z) [x_m, y_m, z_m, t, a] = sort([x_m, y_m, z_m, t, a]) def code(z_s, y_s, x_s, x_m, y_m, z_m, t, a): tmp = 0 if (x_m * y_m) <= 4e+49: tmp = y_m / ((z_m + (-0.5 * (a / (z_m / t)))) / (z_m * x_m)) else: tmp = x_m * y_m return z_s * (y_s * (x_s * tmp))
x_m = abs(x) x_s = copysign(1.0, x) y_m = abs(y) y_s = copysign(1.0, y) z_m = abs(z) z_s = copysign(1.0, z) x_m, y_m, z_m, t, a = sort([x_m, y_m, z_m, t, a]) function code(z_s, y_s, x_s, x_m, y_m, z_m, t, a) tmp = 0.0 if (Float64(x_m * y_m) <= 4e+49) tmp = Float64(y_m / Float64(Float64(z_m + Float64(-0.5 * Float64(a / Float64(z_m / t)))) / Float64(z_m * x_m))); else tmp = Float64(x_m * y_m); end return Float64(z_s * Float64(y_s * Float64(x_s * tmp))) end
x_m = abs(x);
x_s = sign(x) * abs(1.0);
y_m = abs(y);
y_s = sign(y) * abs(1.0);
z_m = abs(z);
z_s = sign(z) * abs(1.0);
x_m, y_m, z_m, t, a = num2cell(sort([x_m, y_m, z_m, t, a])){:}
function tmp_2 = code(z_s, y_s, x_s, x_m, y_m, z_m, t, a)
tmp = 0.0;
if ((x_m * y_m) <= 4e+49)
tmp = y_m / ((z_m + (-0.5 * (a / (z_m / t)))) / (z_m * x_m));
else
tmp = x_m * y_m;
end
tmp_2 = z_s * (y_s * (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]
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
z_m = N[Abs[z], $MachinePrecision]
z_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
code[z$95$s_, y$95$s_, x$95$s_, x$95$m_, y$95$m_, z$95$m_, t_, a_] := N[(z$95$s * N[(y$95$s * N[(x$95$s * If[LessEqual[N[(x$95$m * y$95$m), $MachinePrecision], 4e+49], N[(y$95$m / N[(N[(z$95$m + N[(-0.5 * N[(a / N[(z$95$m / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m * y$95$m), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
[x_m, y_m, z_m, t, a] = \mathsf{sort}([x_m, y_m, z_m, t, a])\\
\\
z_s \cdot \left(y_s \cdot \left(x_s \cdot \begin{array}{l}
\mathbf{if}\;x_m \cdot y_m \leq 4 \cdot 10^{+49}:\\
\;\;\;\;\frac{y_m}{\frac{z_m + -0.5 \cdot \frac{a}{\frac{z_m}{t}}}{z_m \cdot x_m}}\\
\mathbf{else}:\\
\;\;\;\;x_m \cdot y_m\\
\end{array}\right)\right)
\end{array}
if (*.f64 x y) < 3.99999999999999979e49Initial program 66.9%
associate-*l*65.0%
*-commutative65.0%
associate-*l*64.7%
*-commutative64.7%
associate-/l*66.0%
Simplified66.0%
Taylor expanded in z around inf 46.3%
associate-/l*48.2%
Simplified48.2%
if 3.99999999999999979e49 < (*.f64 x y) Initial program 42.2%
associate-/l*44.8%
associate-*l/43.0%
*-commutative43.0%
associate-/l*40.5%
Simplified40.5%
Taylor expanded in z around inf 38.3%
Final simplification46.4%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
(FPCore (z_s y_s x_s x_m y_m z_m t a)
:precision binary64
(*
z_s
(*
y_s
(*
x_s
(if (<= z_m 1.5e+56)
(* x_m (/ (* z_m y_m) (+ z_m (* -0.5 (/ (* t a) z_m)))))
(* x_m y_m))))))x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
z_m = fabs(z);
z_s = copysign(1.0, z);
assert(x_m < y_m && y_m < z_m && z_m < t && t < a);
double code(double z_s, double y_s, double x_s, double x_m, double y_m, double z_m, double t, double a) {
double tmp;
if (z_m <= 1.5e+56) {
tmp = x_m * ((z_m * y_m) / (z_m + (-0.5 * ((t * a) / z_m))));
} else {
tmp = x_m * y_m;
}
return z_s * (y_s * (x_s * tmp));
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
y_m = abs(y)
y_s = copysign(1.0d0, y)
z_m = abs(z)
z_s = copysign(1.0d0, z)
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
real(8) function code(z_s, y_s, x_s, x_m, y_m, z_m, t, a)
real(8), intent (in) :: z_s
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z_m <= 1.5d+56) then
tmp = x_m * ((z_m * y_m) / (z_m + ((-0.5d0) * ((t * a) / z_m))))
else
tmp = x_m * y_m
end if
code = z_s * (y_s * (x_s * tmp))
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
assert x_m < y_m && y_m < z_m && z_m < t && t < a;
public static double code(double z_s, double y_s, double x_s, double x_m, double y_m, double z_m, double t, double a) {
double tmp;
if (z_m <= 1.5e+56) {
tmp = x_m * ((z_m * y_m) / (z_m + (-0.5 * ((t * a) / z_m))));
} else {
tmp = x_m * y_m;
}
return z_s * (y_s * (x_s * tmp));
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) y_m = math.fabs(y) y_s = math.copysign(1.0, y) z_m = math.fabs(z) z_s = math.copysign(1.0, z) [x_m, y_m, z_m, t, a] = sort([x_m, y_m, z_m, t, a]) def code(z_s, y_s, x_s, x_m, y_m, z_m, t, a): tmp = 0 if z_m <= 1.5e+56: tmp = x_m * ((z_m * y_m) / (z_m + (-0.5 * ((t * a) / z_m)))) else: tmp = x_m * y_m return z_s * (y_s * (x_s * tmp))
x_m = abs(x) x_s = copysign(1.0, x) y_m = abs(y) y_s = copysign(1.0, y) z_m = abs(z) z_s = copysign(1.0, z) x_m, y_m, z_m, t, a = sort([x_m, y_m, z_m, t, a]) function code(z_s, y_s, x_s, x_m, y_m, z_m, t, a) tmp = 0.0 if (z_m <= 1.5e+56) tmp = Float64(x_m * Float64(Float64(z_m * y_m) / Float64(z_m + Float64(-0.5 * Float64(Float64(t * a) / z_m))))); else tmp = Float64(x_m * y_m); end return Float64(z_s * Float64(y_s * Float64(x_s * tmp))) end
x_m = abs(x);
x_s = sign(x) * abs(1.0);
y_m = abs(y);
y_s = sign(y) * abs(1.0);
z_m = abs(z);
z_s = sign(z) * abs(1.0);
x_m, y_m, z_m, t, a = num2cell(sort([x_m, y_m, z_m, t, a])){:}
function tmp_2 = code(z_s, y_s, x_s, x_m, y_m, z_m, t, a)
tmp = 0.0;
if (z_m <= 1.5e+56)
tmp = x_m * ((z_m * y_m) / (z_m + (-0.5 * ((t * a) / z_m))));
else
tmp = x_m * y_m;
end
tmp_2 = z_s * (y_s * (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]
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
z_m = N[Abs[z], $MachinePrecision]
z_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
code[z$95$s_, y$95$s_, x$95$s_, x$95$m_, y$95$m_, z$95$m_, t_, a_] := N[(z$95$s * N[(y$95$s * N[(x$95$s * If[LessEqual[z$95$m, 1.5e+56], N[(x$95$m * N[(N[(z$95$m * y$95$m), $MachinePrecision] / N[(z$95$m + N[(-0.5 * N[(N[(t * a), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m * y$95$m), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
[x_m, y_m, z_m, t, a] = \mathsf{sort}([x_m, y_m, z_m, t, a])\\
\\
z_s \cdot \left(y_s \cdot \left(x_s \cdot \begin{array}{l}
\mathbf{if}\;z_m \leq 1.5 \cdot 10^{+56}:\\
\;\;\;\;x_m \cdot \frac{z_m \cdot y_m}{z_m + -0.5 \cdot \frac{t \cdot a}{z_m}}\\
\mathbf{else}:\\
\;\;\;\;x_m \cdot y_m\\
\end{array}\right)\right)
\end{array}
if z < 1.50000000000000003e56Initial program 71.6%
Taylor expanded in z around inf 34.6%
associate-/l*35.2%
div-inv35.2%
+-commutative35.2%
fma-def35.2%
associate-/l*35.2%
div-inv35.2%
clear-num35.2%
Applied egg-rr35.2%
associate-*r/35.2%
*-rgt-identity35.2%
Simplified35.2%
Taylor expanded in x around 0 33.6%
associate-*r*34.6%
+-commutative34.6%
associate-*r/34.6%
*-commutative34.6%
fma-udef34.6%
associate-*l/34.8%
associate-*r/34.8%
associate-*l*34.8%
*-commutative34.8%
fma-udef34.8%
*-commutative34.8%
fma-def34.8%
Simplified34.8%
Taylor expanded in y around 0 34.1%
if 1.50000000000000003e56 < z Initial program 34.2%
associate-/l*36.0%
associate-*l/36.3%
*-commutative36.3%
associate-/l*34.0%
Simplified34.0%
Taylor expanded in z around inf 98.5%
Final simplification50.2%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
(FPCore (z_s y_s x_s x_m y_m z_m t a)
:precision binary64
(*
z_s
(*
y_s
(*
x_s
(if (<= z_m 2.45e-92) (/ y_m (* z_m (/ 1.0 (* z_m x_m)))) (* x_m y_m))))))x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
z_m = fabs(z);
z_s = copysign(1.0, z);
assert(x_m < y_m && y_m < z_m && z_m < t && t < a);
double code(double z_s, double y_s, double x_s, double x_m, double y_m, double z_m, double t, double a) {
double tmp;
if (z_m <= 2.45e-92) {
tmp = y_m / (z_m * (1.0 / (z_m * x_m)));
} else {
tmp = x_m * y_m;
}
return z_s * (y_s * (x_s * tmp));
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
y_m = abs(y)
y_s = copysign(1.0d0, y)
z_m = abs(z)
z_s = copysign(1.0d0, z)
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
real(8) function code(z_s, y_s, x_s, x_m, y_m, z_m, t, a)
real(8), intent (in) :: z_s
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z_m <= 2.45d-92) then
tmp = y_m / (z_m * (1.0d0 / (z_m * x_m)))
else
tmp = x_m * y_m
end if
code = z_s * (y_s * (x_s * tmp))
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
assert x_m < y_m && y_m < z_m && z_m < t && t < a;
public static double code(double z_s, double y_s, double x_s, double x_m, double y_m, double z_m, double t, double a) {
double tmp;
if (z_m <= 2.45e-92) {
tmp = y_m / (z_m * (1.0 / (z_m * x_m)));
} else {
tmp = x_m * y_m;
}
return z_s * (y_s * (x_s * tmp));
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) y_m = math.fabs(y) y_s = math.copysign(1.0, y) z_m = math.fabs(z) z_s = math.copysign(1.0, z) [x_m, y_m, z_m, t, a] = sort([x_m, y_m, z_m, t, a]) def code(z_s, y_s, x_s, x_m, y_m, z_m, t, a): tmp = 0 if z_m <= 2.45e-92: tmp = y_m / (z_m * (1.0 / (z_m * x_m))) else: tmp = x_m * y_m return z_s * (y_s * (x_s * tmp))
x_m = abs(x) x_s = copysign(1.0, x) y_m = abs(y) y_s = copysign(1.0, y) z_m = abs(z) z_s = copysign(1.0, z) x_m, y_m, z_m, t, a = sort([x_m, y_m, z_m, t, a]) function code(z_s, y_s, x_s, x_m, y_m, z_m, t, a) tmp = 0.0 if (z_m <= 2.45e-92) tmp = Float64(y_m / Float64(z_m * Float64(1.0 / Float64(z_m * x_m)))); else tmp = Float64(x_m * y_m); end return Float64(z_s * Float64(y_s * Float64(x_s * tmp))) end
x_m = abs(x);
x_s = sign(x) * abs(1.0);
y_m = abs(y);
y_s = sign(y) * abs(1.0);
z_m = abs(z);
z_s = sign(z) * abs(1.0);
x_m, y_m, z_m, t, a = num2cell(sort([x_m, y_m, z_m, t, a])){:}
function tmp_2 = code(z_s, y_s, x_s, x_m, y_m, z_m, t, a)
tmp = 0.0;
if (z_m <= 2.45e-92)
tmp = y_m / (z_m * (1.0 / (z_m * x_m)));
else
tmp = x_m * y_m;
end
tmp_2 = z_s * (y_s * (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]
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
z_m = N[Abs[z], $MachinePrecision]
z_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
code[z$95$s_, y$95$s_, x$95$s_, x$95$m_, y$95$m_, z$95$m_, t_, a_] := N[(z$95$s * N[(y$95$s * N[(x$95$s * If[LessEqual[z$95$m, 2.45e-92], N[(y$95$m / N[(z$95$m * N[(1.0 / N[(z$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m * y$95$m), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
[x_m, y_m, z_m, t, a] = \mathsf{sort}([x_m, y_m, z_m, t, a])\\
\\
z_s \cdot \left(y_s \cdot \left(x_s \cdot \begin{array}{l}
\mathbf{if}\;z_m \leq 2.45 \cdot 10^{-92}:\\
\;\;\;\;\frac{y_m}{z_m \cdot \frac{1}{z_m \cdot x_m}}\\
\mathbf{else}:\\
\;\;\;\;x_m \cdot y_m\\
\end{array}\right)\right)
\end{array}
if z < 2.45e-92Initial program 68.3%
associate-*l*66.7%
*-commutative66.7%
associate-*l*65.7%
*-commutative65.7%
associate-/l*67.6%
Simplified67.6%
Taylor expanded in z around inf 24.9%
div-inv24.9%
*-commutative24.9%
Applied egg-rr24.9%
if 2.45e-92 < z Initial program 51.1%
associate-/l*52.4%
associate-*l/51.5%
*-commutative51.5%
associate-/l*49.9%
Simplified49.9%
Taylor expanded in z around inf 88.5%
Final simplification47.2%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) z_m = (fabs.f64 z) z_s = (copysign.f64 1 z) NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function. (FPCore (z_s y_s x_s x_m y_m z_m t a) :precision binary64 (* z_s (* y_s (* x_s (if (<= z_m 2e-97) (* y_m (/ (* z_m x_m) z_m)) (* x_m y_m))))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
z_m = fabs(z);
z_s = copysign(1.0, z);
assert(x_m < y_m && y_m < z_m && z_m < t && t < a);
double code(double z_s, double y_s, double x_s, double x_m, double y_m, double z_m, double t, double a) {
double tmp;
if (z_m <= 2e-97) {
tmp = y_m * ((z_m * x_m) / z_m);
} else {
tmp = x_m * y_m;
}
return z_s * (y_s * (x_s * tmp));
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
y_m = abs(y)
y_s = copysign(1.0d0, y)
z_m = abs(z)
z_s = copysign(1.0d0, z)
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
real(8) function code(z_s, y_s, x_s, x_m, y_m, z_m, t, a)
real(8), intent (in) :: z_s
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z_m <= 2d-97) then
tmp = y_m * ((z_m * x_m) / z_m)
else
tmp = x_m * y_m
end if
code = z_s * (y_s * (x_s * tmp))
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
assert x_m < y_m && y_m < z_m && z_m < t && t < a;
public static double code(double z_s, double y_s, double x_s, double x_m, double y_m, double z_m, double t, double a) {
double tmp;
if (z_m <= 2e-97) {
tmp = y_m * ((z_m * x_m) / z_m);
} else {
tmp = x_m * y_m;
}
return z_s * (y_s * (x_s * tmp));
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) y_m = math.fabs(y) y_s = math.copysign(1.0, y) z_m = math.fabs(z) z_s = math.copysign(1.0, z) [x_m, y_m, z_m, t, a] = sort([x_m, y_m, z_m, t, a]) def code(z_s, y_s, x_s, x_m, y_m, z_m, t, a): tmp = 0 if z_m <= 2e-97: tmp = y_m * ((z_m * x_m) / z_m) else: tmp = x_m * y_m return z_s * (y_s * (x_s * tmp))
x_m = abs(x) x_s = copysign(1.0, x) y_m = abs(y) y_s = copysign(1.0, y) z_m = abs(z) z_s = copysign(1.0, z) x_m, y_m, z_m, t, a = sort([x_m, y_m, z_m, t, a]) function code(z_s, y_s, x_s, x_m, y_m, z_m, t, a) tmp = 0.0 if (z_m <= 2e-97) tmp = Float64(y_m * Float64(Float64(z_m * x_m) / z_m)); else tmp = Float64(x_m * y_m); end return Float64(z_s * Float64(y_s * Float64(x_s * tmp))) end
x_m = abs(x);
x_s = sign(x) * abs(1.0);
y_m = abs(y);
y_s = sign(y) * abs(1.0);
z_m = abs(z);
z_s = sign(z) * abs(1.0);
x_m, y_m, z_m, t, a = num2cell(sort([x_m, y_m, z_m, t, a])){:}
function tmp_2 = code(z_s, y_s, x_s, x_m, y_m, z_m, t, a)
tmp = 0.0;
if (z_m <= 2e-97)
tmp = y_m * ((z_m * x_m) / z_m);
else
tmp = x_m * y_m;
end
tmp_2 = z_s * (y_s * (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]
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
z_m = N[Abs[z], $MachinePrecision]
z_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
code[z$95$s_, y$95$s_, x$95$s_, x$95$m_, y$95$m_, z$95$m_, t_, a_] := N[(z$95$s * N[(y$95$s * N[(x$95$s * If[LessEqual[z$95$m, 2e-97], N[(y$95$m * N[(N[(z$95$m * x$95$m), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision], N[(x$95$m * y$95$m), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
[x_m, y_m, z_m, t, a] = \mathsf{sort}([x_m, y_m, z_m, t, a])\\
\\
z_s \cdot \left(y_s \cdot \left(x_s \cdot \begin{array}{l}
\mathbf{if}\;z_m \leq 2 \cdot 10^{-97}:\\
\;\;\;\;y_m \cdot \frac{z_m \cdot x_m}{z_m}\\
\mathbf{else}:\\
\;\;\;\;x_m \cdot y_m\\
\end{array}\right)\right)
\end{array}
if z < 2.00000000000000007e-97Initial program 68.1%
associate-/l*68.3%
associate-*l/66.9%
*-commutative66.9%
associate-/l*67.8%
Simplified67.8%
Taylor expanded in z around inf 25.0%
if 2.00000000000000007e-97 < z Initial program 51.6%
associate-/l*52.9%
associate-*l/52.0%
*-commutative52.0%
associate-/l*50.4%
Simplified50.4%
Taylor expanded in z around inf 87.6%
Final simplification47.2%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) z_m = (fabs.f64 z) z_s = (copysign.f64 1 z) NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function. (FPCore (z_s y_s x_s x_m y_m z_m t a) :precision binary64 (* z_s (* y_s (* x_s (* x_m y_m)))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
z_m = fabs(z);
z_s = copysign(1.0, z);
assert(x_m < y_m && y_m < z_m && z_m < t && t < a);
double code(double z_s, double y_s, double x_s, double x_m, double y_m, double z_m, double t, double a) {
return z_s * (y_s * (x_s * (x_m * y_m)));
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
y_m = abs(y)
y_s = copysign(1.0d0, y)
z_m = abs(z)
z_s = copysign(1.0d0, z)
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
real(8) function code(z_s, y_s, x_s, x_m, y_m, z_m, t, a)
real(8), intent (in) :: z_s
real(8), intent (in) :: y_s
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8), intent (in) :: a
code = z_s * (y_s * (x_s * (x_m * y_m)))
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
z_m = Math.abs(z);
z_s = Math.copySign(1.0, z);
assert x_m < y_m && y_m < z_m && z_m < t && t < a;
public static double code(double z_s, double y_s, double x_s, double x_m, double y_m, double z_m, double t, double a) {
return z_s * (y_s * (x_s * (x_m * y_m)));
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) y_m = math.fabs(y) y_s = math.copysign(1.0, y) z_m = math.fabs(z) z_s = math.copysign(1.0, z) [x_m, y_m, z_m, t, a] = sort([x_m, y_m, z_m, t, a]) def code(z_s, y_s, x_s, x_m, y_m, z_m, t, a): return z_s * (y_s * (x_s * (x_m * y_m)))
x_m = abs(x) x_s = copysign(1.0, x) y_m = abs(y) y_s = copysign(1.0, y) z_m = abs(z) z_s = copysign(1.0, z) x_m, y_m, z_m, t, a = sort([x_m, y_m, z_m, t, a]) function code(z_s, y_s, x_s, x_m, y_m, z_m, t, a) return Float64(z_s * Float64(y_s * Float64(x_s * Float64(x_m * y_m)))) end
x_m = abs(x);
x_s = sign(x) * abs(1.0);
y_m = abs(y);
y_s = sign(y) * abs(1.0);
z_m = abs(z);
z_s = sign(z) * abs(1.0);
x_m, y_m, z_m, t, a = num2cell(sort([x_m, y_m, z_m, t, a])){:}
function tmp = code(z_s, y_s, x_s, x_m, y_m, z_m, t, a)
tmp = z_s * (y_s * (x_s * (x_m * y_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]
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
z_m = N[Abs[z], $MachinePrecision]
z_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y_m, z_m, t, and a should be sorted in increasing order before calling this function.
code[z$95$s_, y$95$s_, x$95$s_, x$95$m_, y$95$m_, z$95$m_, t_, a_] := N[(z$95$s * N[(y$95$s * N[(x$95$s * N[(x$95$m * y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)
\\
[x_m, y_m, z_m, t, a] = \mathsf{sort}([x_m, y_m, z_m, t, a])\\
\\
z_s \cdot \left(y_s \cdot \left(x_s \cdot \left(x_m \cdot y_m\right)\right)\right)
\end{array}
Initial program 62.2%
associate-/l*62.8%
associate-*l/61.6%
*-commutative61.6%
associate-/l*61.6%
Simplified61.6%
Taylor expanded in z around inf 41.4%
Final simplification41.4%
(FPCore (x y z t a)
:precision binary64
(if (< z -3.1921305903852764e+46)
(- (* y x))
(if (< z 5.976268120920894e+90)
(/ (* x z) (/ (sqrt (- (* z z) (* a t))) y))
(* y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z < -3.1921305903852764e+46) {
tmp = -(y * x);
} else if (z < 5.976268120920894e+90) {
tmp = (x * z) / (sqrt(((z * z) - (a * t))) / y);
} else {
tmp = y * x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z < (-3.1921305903852764d+46)) then
tmp = -(y * x)
else if (z < 5.976268120920894d+90) then
tmp = (x * z) / (sqrt(((z * z) - (a * t))) / y)
else
tmp = y * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z < -3.1921305903852764e+46) {
tmp = -(y * x);
} else if (z < 5.976268120920894e+90) {
tmp = (x * z) / (Math.sqrt(((z * z) - (a * t))) / y);
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z < -3.1921305903852764e+46: tmp = -(y * x) elif z < 5.976268120920894e+90: tmp = (x * z) / (math.sqrt(((z * z) - (a * t))) / y) else: tmp = y * x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z < -3.1921305903852764e+46) tmp = Float64(-Float64(y * x)); elseif (z < 5.976268120920894e+90) tmp = Float64(Float64(x * z) / Float64(sqrt(Float64(Float64(z * z) - Float64(a * t))) / y)); else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z < -3.1921305903852764e+46) tmp = -(y * x); elseif (z < 5.976268120920894e+90) tmp = (x * z) / (sqrt(((z * z) - (a * t))) / y); else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Less[z, -3.1921305903852764e+46], (-N[(y * x), $MachinePrecision]), If[Less[z, 5.976268120920894e+90], N[(N[(x * z), $MachinePrecision] / N[(N[Sqrt[N[(N[(z * z), $MachinePrecision] - N[(a * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(y * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z < -3.1921305903852764 \cdot 10^{+46}:\\
\;\;\;\;-y \cdot x\\
\mathbf{elif}\;z < 5.976268120920894 \cdot 10^{+90}:\\
\;\;\;\;\frac{x \cdot z}{\frac{\sqrt{z \cdot z - a \cdot t}}{y}}\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
herbie shell --seed 2024020
(FPCore (x y z t a)
:name "Statistics.Math.RootFinding:ridders from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(if (< z -3.1921305903852764e+46) (- (* y x)) (if (< z 5.976268120920894e+90) (/ (* x z) (/ (sqrt (- (* z z) (* a t))) y)) (* y x)))
(/ (* (* x y) z) (sqrt (- (* z z) (* t a)))))