
(FPCore (x y z) :precision binary64 (/ (* x y) (* (* z z) (+ z 1.0))))
double code(double x, double y, double z) {
return (x * y) / ((z * z) * (z + 1.0));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * y) / ((z * z) * (z + 1.0d0))
end function
public static double code(double x, double y, double z) {
return (x * y) / ((z * z) * (z + 1.0));
}
def code(x, y, z): return (x * y) / ((z * z) * (z + 1.0))
function code(x, y, z) return Float64(Float64(x * y) / Float64(Float64(z * z) * Float64(z + 1.0))) end
function tmp = code(x, y, z) tmp = (x * y) / ((z * z) * (z + 1.0)); end
code[x_, y_, z_] := N[(N[(x * y), $MachinePrecision] / N[(N[(z * z), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* x y) (* (* z z) (+ z 1.0))))
double code(double x, double y, double z) {
return (x * y) / ((z * z) * (z + 1.0));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * y) / ((z * z) * (z + 1.0d0))
end function
public static double code(double x, double y, double z) {
return (x * y) / ((z * z) * (z + 1.0));
}
def code(x, y, z): return (x * y) / ((z * z) * (z + 1.0))
function code(x, y, z) return Float64(Float64(x * y) / Float64(Float64(z * z) * Float64(z + 1.0))) end
function tmp = code(x, y, z) tmp = (x * y) / ((z * z) * (z + 1.0)); end
code[x_, y_, z_] := N[(N[(x * y), $MachinePrecision] / N[(N[(z * z), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}
\end{array}
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (or (<= z -2.9e-40) (not (<= z 2e-107)))
(/ (/ x_m (+ z 1.0)) (* z (/ z y_m)))
(/ (/ y_m (/ z x_m)) z)))))x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z <= -2.9e-40) || !(z <= 2e-107)) {
tmp = (x_m / (z + 1.0)) / (z * (z / y_m));
} else {
tmp = (y_m / (z / x_m)) / z;
}
return 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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
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
real(8) :: tmp
if ((z <= (-2.9d-40)) .or. (.not. (z <= 2d-107))) then
tmp = (x_m / (z + 1.0d0)) / (z * (z / y_m))
else
tmp = (y_m / (z / x_m)) / z
end if
code = 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);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z <= -2.9e-40) || !(z <= 2e-107)) {
tmp = (x_m / (z + 1.0)) / (z * (z / y_m));
} else {
tmp = (y_m / (z / x_m)) / z;
}
return 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) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if (z <= -2.9e-40) or not (z <= 2e-107): tmp = (x_m / (z + 1.0)) / (z * (z / y_m)) else: tmp = (y_m / (z / x_m)) / z return 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) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if ((z <= -2.9e-40) || !(z <= 2e-107)) tmp = Float64(Float64(x_m / Float64(z + 1.0)) / Float64(z * Float64(z / y_m))); else tmp = Float64(Float64(y_m / Float64(z / x_m)) / z); end return 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);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
tmp = 0.0;
if ((z <= -2.9e-40) || ~((z <= 2e-107)))
tmp = (x_m / (z + 1.0)) / (z * (z / y_m));
else
tmp = (y_m / (z / x_m)) / z;
end
tmp_2 = 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]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[Or[LessEqual[z, -2.9e-40], N[Not[LessEqual[z, 2e-107]], $MachinePrecision]], N[(N[(x$95$m / N[(z + 1.0), $MachinePrecision]), $MachinePrecision] / N[(z * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y$95$m / N[(z / x$95$m), $MachinePrecision]), $MachinePrecision] / z), $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)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{-40} \lor \neg \left(z \leq 2 \cdot 10^{-107}\right):\\
\;\;\;\;\frac{\frac{x\_m}{z + 1}}{z \cdot \frac{z}{y\_m}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y\_m}{\frac{z}{x\_m}}}{z}\\
\end{array}\right)
\end{array}
if z < -2.8999999999999999e-40 or 2e-107 < z Initial program 84.4%
*-commutative84.4%
frac-times92.7%
associate-*l/92.5%
times-frac98.4%
Applied egg-rr98.4%
clear-num98.4%
frac-times97.1%
*-un-lft-identity97.1%
Applied egg-rr97.1%
if -2.8999999999999999e-40 < z < 2e-107Initial program 79.0%
associate-*l/73.5%
sqr-neg73.5%
*-commutative73.5%
distribute-rgt1-in73.5%
sqr-neg73.5%
sqr-neg73.5%
cube-unmult73.5%
Simplified73.5%
associate-*l/79.0%
*-commutative79.0%
cube-mult79.0%
distribute-rgt1-in79.0%
*-commutative79.0%
frac-times73.7%
associate-*l/79.0%
associate-/r*91.4%
Applied egg-rr91.4%
associate-/l*97.9%
div-inv97.8%
associate-/r/97.8%
Applied egg-rr97.8%
associate-*r/97.9%
*-rgt-identity97.9%
*-commutative97.9%
+-commutative97.9%
Simplified97.9%
Taylor expanded in z around 0 97.9%
Final simplification97.4%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= (/ (* x_m y_m) (* (* z z) (+ z 1.0))) 0.002)
(/ (/ x_m (+ z 1.0)) (* z (/ z y_m)))
(/ (/ y_m (* (+ z 1.0) (/ z x_m))) z)))))x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (((x_m * y_m) / ((z * z) * (z + 1.0))) <= 0.002) {
tmp = (x_m / (z + 1.0)) / (z * (z / y_m));
} else {
tmp = (y_m / ((z + 1.0) * (z / x_m))) / z;
}
return 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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
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
real(8) :: tmp
if (((x_m * y_m) / ((z * z) * (z + 1.0d0))) <= 0.002d0) then
tmp = (x_m / (z + 1.0d0)) / (z * (z / y_m))
else
tmp = (y_m / ((z + 1.0d0) * (z / x_m))) / z
end if
code = 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);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (((x_m * y_m) / ((z * z) * (z + 1.0))) <= 0.002) {
tmp = (x_m / (z + 1.0)) / (z * (z / y_m));
} else {
tmp = (y_m / ((z + 1.0) * (z / x_m))) / z;
}
return 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) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if ((x_m * y_m) / ((z * z) * (z + 1.0))) <= 0.002: tmp = (x_m / (z + 1.0)) / (z * (z / y_m)) else: tmp = (y_m / ((z + 1.0) * (z / x_m))) / z return 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) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (Float64(Float64(x_m * y_m) / Float64(Float64(z * z) * Float64(z + 1.0))) <= 0.002) tmp = Float64(Float64(x_m / Float64(z + 1.0)) / Float64(z * Float64(z / y_m))); else tmp = Float64(Float64(y_m / Float64(Float64(z + 1.0) * Float64(z / x_m))) / z); end return 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);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
tmp = 0.0;
if (((x_m * y_m) / ((z * z) * (z + 1.0))) <= 0.002)
tmp = (x_m / (z + 1.0)) / (z * (z / y_m));
else
tmp = (y_m / ((z + 1.0) * (z / x_m))) / z;
end
tmp_2 = 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]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[N[(N[(x$95$m * y$95$m), $MachinePrecision] / N[(N[(z * z), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.002], N[(N[(x$95$m / N[(z + 1.0), $MachinePrecision]), $MachinePrecision] / N[(z * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y$95$m / N[(N[(z + 1.0), $MachinePrecision] * N[(z / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $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)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{x\_m \cdot y\_m}{\left(z \cdot z\right) \cdot \left(z + 1\right)} \leq 0.002:\\
\;\;\;\;\frac{\frac{x\_m}{z + 1}}{z \cdot \frac{z}{y\_m}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y\_m}{\left(z + 1\right) \cdot \frac{z}{x\_m}}}{z}\\
\end{array}\right)
\end{array}
if (/.f64 (*.f64 x y) (*.f64 (*.f64 z z) (+.f64 z 1))) < 2e-3Initial program 90.5%
*-commutative90.5%
frac-times92.5%
associate-*l/93.4%
times-frac97.9%
Applied egg-rr97.9%
clear-num97.9%
frac-times93.9%
*-un-lft-identity93.9%
Applied egg-rr93.9%
if 2e-3 < (/.f64 (*.f64 x y) (*.f64 (*.f64 z z) (+.f64 z 1))) Initial program 65.1%
associate-*l/68.5%
sqr-neg68.5%
*-commutative68.5%
distribute-rgt1-in65.8%
sqr-neg65.8%
sqr-neg65.8%
cube-unmult65.9%
Simplified65.9%
associate-*l/65.1%
*-commutative65.1%
cube-mult65.1%
distribute-rgt1-in65.1%
*-commutative65.1%
frac-times70.9%
associate-*l/74.9%
associate-/r*87.9%
Applied egg-rr87.9%
associate-/l*96.1%
div-inv95.9%
associate-/r/95.9%
Applied egg-rr95.9%
associate-*r/96.1%
*-rgt-identity96.1%
*-commutative96.1%
+-commutative96.1%
Simplified96.1%
Final simplification94.6%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(let* ((t_0 (/ y_m (/ z x_m))))
(*
y_s
(*
x_s
(if (<= z -1.0)
t_0
(if (<= z -4e-310)
(* x_m (/ (- y_m) z))
(if (<= z 2e-35) (/ x_m (/ z y_m)) t_0)))))))x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double t_0 = y_m / (z / x_m);
double tmp;
if (z <= -1.0) {
tmp = t_0;
} else if (z <= -4e-310) {
tmp = x_m * (-y_m / z);
} else if (z <= 2e-35) {
tmp = x_m / (z / y_m);
} else {
tmp = t_0;
}
return 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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
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
real(8) :: t_0
real(8) :: tmp
t_0 = y_m / (z / x_m)
if (z <= (-1.0d0)) then
tmp = t_0
else if (z <= (-4d-310)) then
tmp = x_m * (-y_m / z)
else if (z <= 2d-35) then
tmp = x_m / (z / y_m)
else
tmp = t_0
end if
code = 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);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double t_0 = y_m / (z / x_m);
double tmp;
if (z <= -1.0) {
tmp = t_0;
} else if (z <= -4e-310) {
tmp = x_m * (-y_m / z);
} else if (z <= 2e-35) {
tmp = x_m / (z / y_m);
} else {
tmp = t_0;
}
return 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) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): t_0 = y_m / (z / x_m) tmp = 0 if z <= -1.0: tmp = t_0 elif z <= -4e-310: tmp = x_m * (-y_m / z) elif z <= 2e-35: tmp = x_m / (z / y_m) else: tmp = t_0 return 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) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) t_0 = Float64(y_m / Float64(z / x_m)) tmp = 0.0 if (z <= -1.0) tmp = t_0; elseif (z <= -4e-310) tmp = Float64(x_m * Float64(Float64(-y_m) / z)); elseif (z <= 2e-35) tmp = Float64(x_m / Float64(z / y_m)); else tmp = t_0; end return 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);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
t_0 = y_m / (z / x_m);
tmp = 0.0;
if (z <= -1.0)
tmp = t_0;
elseif (z <= -4e-310)
tmp = x_m * (-y_m / z);
elseif (z <= 2e-35)
tmp = x_m / (z / y_m);
else
tmp = t_0;
end
tmp_2 = 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]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := Block[{t$95$0 = N[(y$95$m / N[(z / x$95$m), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * N[(x$95$s * If[LessEqual[z, -1.0], t$95$0, If[LessEqual[z, -4e-310], N[(x$95$m * N[((-y$95$m) / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2e-35], N[(x$95$m / N[(z / y$95$m), $MachinePrecision]), $MachinePrecision], t$95$0]]]), $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)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
\begin{array}{l}
t_0 := \frac{y\_m}{\frac{z}{x\_m}}\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -4 \cdot 10^{-310}:\\
\;\;\;\;x\_m \cdot \frac{-y\_m}{z}\\
\mathbf{elif}\;z \leq 2 \cdot 10^{-35}:\\
\;\;\;\;\frac{x\_m}{\frac{z}{y\_m}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}\right)
\end{array}
\end{array}
if z < -1 or 2.00000000000000002e-35 < z Initial program 82.1%
*-commutative82.1%
frac-times91.4%
associate-*l/91.9%
times-frac98.2%
Applied egg-rr98.2%
Taylor expanded in z around 0 38.2%
neg-mul-138.2%
+-commutative38.2%
unsub-neg38.2%
Simplified38.2%
Taylor expanded in z around inf 28.4%
associate-*r/28.4%
mul-1-neg28.4%
distribute-rgt-neg-out28.4%
associate-*l/33.2%
Simplified33.2%
clear-num33.2%
associate-*l/33.2%
*-un-lft-identity33.2%
add-sqr-sqrt15.5%
sqrt-unprod33.6%
sqr-neg33.6%
sqrt-unprod19.3%
add-sqr-sqrt36.3%
Applied egg-rr36.3%
if -1 < z < -3.999999999999988e-310Initial program 87.1%
*-commutative87.1%
frac-times78.5%
associate-*l/87.1%
times-frac93.8%
Applied egg-rr93.8%
Taylor expanded in z around 0 92.9%
neg-mul-192.9%
+-commutative92.9%
unsub-neg92.9%
Simplified92.9%
Taylor expanded in z around inf 40.3%
neg-mul-140.3%
Simplified40.3%
if -3.999999999999988e-310 < z < 2.00000000000000002e-35Initial program 78.1%
*-commutative78.1%
frac-times79.8%
associate-*l/78.1%
times-frac96.7%
Applied egg-rr96.7%
Taylor expanded in z around 0 96.7%
neg-mul-196.7%
+-commutative96.7%
unsub-neg96.7%
Simplified96.7%
Taylor expanded in z around inf 0.8%
associate-*r/0.8%
mul-1-neg0.8%
distribute-rgt-neg-out0.8%
associate-*l/0.8%
Simplified0.8%
associate-*l/0.8%
associate-/l*0.8%
add-sqr-sqrt0.5%
sqrt-unprod19.8%
sqr-neg19.8%
sqrt-unprod19.2%
add-sqr-sqrt45.7%
Applied egg-rr45.7%
Final simplification39.5%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (or (<= z -1.0) (not (<= z 1.0)))
(* (/ y_m z) (/ (/ x_m z) z))
(/ (/ y_m (/ z x_m)) z)))))x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = (y_m / z) * ((x_m / z) / z);
} else {
tmp = (y_m / (z / x_m)) / z;
}
return 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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
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
real(8) :: tmp
if ((z <= (-1.0d0)) .or. (.not. (z <= 1.0d0))) then
tmp = (y_m / z) * ((x_m / z) / z)
else
tmp = (y_m / (z / x_m)) / z
end if
code = 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);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = (y_m / z) * ((x_m / z) / z);
} else {
tmp = (y_m / (z / x_m)) / z;
}
return 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) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if (z <= -1.0) or not (z <= 1.0): tmp = (y_m / z) * ((x_m / z) / z) else: tmp = (y_m / (z / x_m)) / z return 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) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if ((z <= -1.0) || !(z <= 1.0)) tmp = Float64(Float64(y_m / z) * Float64(Float64(x_m / z) / z)); else tmp = Float64(Float64(y_m / Float64(z / x_m)) / z); end return 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);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
tmp = 0.0;
if ((z <= -1.0) || ~((z <= 1.0)))
tmp = (y_m / z) * ((x_m / z) / z);
else
tmp = (y_m / (z / x_m)) / z;
end
tmp_2 = 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]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(N[(y$95$m / z), $MachinePrecision] * N[(N[(x$95$m / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(y$95$m / N[(z / x$95$m), $MachinePrecision]), $MachinePrecision] / z), $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)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{y\_m}{z} \cdot \frac{\frac{x\_m}{z}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y\_m}{\frac{z}{x\_m}}}{z}\\
\end{array}\right)
\end{array}
if z < -1 or 1 < z Initial program 81.0%
*-commutative81.0%
frac-times91.6%
associate-*l/91.4%
times-frac98.2%
Applied egg-rr98.2%
Taylor expanded in z around inf 96.4%
if -1 < z < 1Initial program 83.7%
associate-*l/79.6%
sqr-neg79.6%
*-commutative79.6%
distribute-rgt1-in79.6%
sqr-neg79.6%
sqr-neg79.6%
cube-unmult79.6%
Simplified79.6%
associate-*l/83.6%
*-commutative83.6%
cube-mult83.6%
distribute-rgt1-in83.7%
*-commutative83.7%
frac-times79.7%
associate-*l/83.7%
associate-/r*92.7%
Applied egg-rr92.7%
associate-/l*97.6%
div-inv97.5%
associate-/r/97.5%
Applied egg-rr97.5%
associate-*r/97.6%
*-rgt-identity97.6%
*-commutative97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in z around 0 95.1%
Final simplification95.8%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (or (<= z -1.0) (not (<= z 1.0)))
(/ (/ (* y_m (/ x_m z)) z) z)
(/ (/ y_m (/ z x_m)) z)))))x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = ((y_m * (x_m / z)) / z) / z;
} else {
tmp = (y_m / (z / x_m)) / z;
}
return 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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
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
real(8) :: tmp
if ((z <= (-1.0d0)) .or. (.not. (z <= 1.0d0))) then
tmp = ((y_m * (x_m / z)) / z) / z
else
tmp = (y_m / (z / x_m)) / z
end if
code = 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);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = ((y_m * (x_m / z)) / z) / z;
} else {
tmp = (y_m / (z / x_m)) / z;
}
return 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) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if (z <= -1.0) or not (z <= 1.0): tmp = ((y_m * (x_m / z)) / z) / z else: tmp = (y_m / (z / x_m)) / z return 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) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if ((z <= -1.0) || !(z <= 1.0)) tmp = Float64(Float64(Float64(y_m * Float64(x_m / z)) / z) / z); else tmp = Float64(Float64(y_m / Float64(z / x_m)) / z); end return 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);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
tmp = 0.0;
if ((z <= -1.0) || ~((z <= 1.0)))
tmp = ((y_m * (x_m / z)) / z) / z;
else
tmp = (y_m / (z / x_m)) / z;
end
tmp_2 = 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]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(N[(N[(y$95$m * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] / z), $MachinePrecision], N[(N[(y$95$m / N[(z / x$95$m), $MachinePrecision]), $MachinePrecision] / z), $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)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{\frac{y\_m \cdot \frac{x\_m}{z}}{z}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y\_m}{\frac{z}{x\_m}}}{z}\\
\end{array}\right)
\end{array}
if z < -1 or 1 < z Initial program 81.0%
associate-*l/87.0%
sqr-neg87.0%
*-commutative87.0%
distribute-rgt1-in67.8%
sqr-neg67.8%
sqr-neg67.8%
cube-unmult67.8%
Simplified67.8%
associate-*l/63.5%
*-commutative63.5%
cube-mult63.5%
distribute-rgt1-in81.0%
*-commutative81.0%
frac-times91.6%
associate-*l/91.4%
associate-/r*96.8%
Applied egg-rr96.8%
Taylor expanded in z around inf 84.2%
*-commutative84.2%
associate-*r/95.1%
Simplified95.1%
if -1 < z < 1Initial program 83.7%
associate-*l/79.6%
sqr-neg79.6%
*-commutative79.6%
distribute-rgt1-in79.6%
sqr-neg79.6%
sqr-neg79.6%
cube-unmult79.6%
Simplified79.6%
associate-*l/83.6%
*-commutative83.6%
cube-mult83.6%
distribute-rgt1-in83.7%
*-commutative83.7%
frac-times79.7%
associate-*l/83.7%
associate-/r*92.7%
Applied egg-rr92.7%
associate-/l*97.6%
div-inv97.5%
associate-/r/97.5%
Applied egg-rr97.5%
associate-*r/97.6%
*-rgt-identity97.6%
*-commutative97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in z around 0 95.1%
Final simplification95.1%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (or (<= z -4e-310) (not (<= z 1e-37)))
(/ y_m (/ z x_m))
(/ x_m (/ z y_m))))))x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z <= -4e-310) || !(z <= 1e-37)) {
tmp = y_m / (z / x_m);
} else {
tmp = x_m / (z / y_m);
}
return 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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
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
real(8) :: tmp
if ((z <= (-4d-310)) .or. (.not. (z <= 1d-37))) then
tmp = y_m / (z / x_m)
else
tmp = x_m / (z / y_m)
end if
code = 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);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if ((z <= -4e-310) || !(z <= 1e-37)) {
tmp = y_m / (z / x_m);
} else {
tmp = x_m / (z / y_m);
}
return 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) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if (z <= -4e-310) or not (z <= 1e-37): tmp = y_m / (z / x_m) else: tmp = x_m / (z / y_m) return 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) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if ((z <= -4e-310) || !(z <= 1e-37)) tmp = Float64(y_m / Float64(z / x_m)); else tmp = Float64(x_m / Float64(z / y_m)); end return 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);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
tmp = 0.0;
if ((z <= -4e-310) || ~((z <= 1e-37)))
tmp = y_m / (z / x_m);
else
tmp = x_m / (z / y_m);
end
tmp_2 = 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]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[Or[LessEqual[z, -4e-310], N[Not[LessEqual[z, 1e-37]], $MachinePrecision]], N[(y$95$m / N[(z / x$95$m), $MachinePrecision]), $MachinePrecision], N[(x$95$m / N[(z / 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)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{-310} \lor \neg \left(z \leq 10^{-37}\right):\\
\;\;\;\;\frac{y\_m}{\frac{z}{x\_m}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{\frac{z}{y\_m}}\\
\end{array}\right)
\end{array}
if z < -3.999999999999988e-310 or 1.00000000000000007e-37 < z Initial program 83.7%
*-commutative83.7%
frac-times87.4%
associate-*l/90.4%
times-frac96.9%
Applied egg-rr96.9%
Taylor expanded in z around 0 55.5%
neg-mul-155.5%
+-commutative55.5%
unsub-neg55.5%
Simplified55.5%
Taylor expanded in z around inf 29.0%
associate-*r/29.0%
mul-1-neg29.0%
distribute-rgt-neg-out29.0%
associate-*l/35.2%
Simplified35.2%
clear-num35.2%
associate-*l/35.2%
*-un-lft-identity35.2%
add-sqr-sqrt15.7%
sqrt-unprod28.1%
sqr-neg28.1%
sqrt-unprod13.3%
add-sqr-sqrt25.5%
Applied egg-rr25.5%
if -3.999999999999988e-310 < z < 1.00000000000000007e-37Initial program 77.8%
*-commutative77.8%
frac-times79.5%
associate-*l/77.8%
times-frac96.7%
Applied egg-rr96.7%
Taylor expanded in z around 0 96.7%
neg-mul-196.7%
+-commutative96.7%
unsub-neg96.7%
Simplified96.7%
Taylor expanded in z around inf 0.8%
associate-*r/0.8%
mul-1-neg0.8%
distribute-rgt-neg-out0.8%
associate-*l/0.7%
Simplified0.7%
associate-*l/0.8%
associate-/l*0.7%
add-sqr-sqrt0.5%
sqrt-unprod20.1%
sqr-neg20.1%
sqrt-unprod19.6%
add-sqr-sqrt46.3%
Applied egg-rr46.3%
Final simplification30.4%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
(FPCore (y_s x_s x_m y_m z)
:precision binary64
(*
y_s
(*
x_s
(if (<= z -4e-310)
(* y_m (/ (- x_m) z))
(if (<= z 2e-35) (/ x_m (/ z y_m)) (/ y_m (/ z x_m)))))))x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (z <= -4e-310) {
tmp = y_m * (-x_m / z);
} else if (z <= 2e-35) {
tmp = x_m / (z / y_m);
} else {
tmp = y_m / (z / x_m);
}
return 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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
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
real(8) :: tmp
if (z <= (-4d-310)) then
tmp = y_m * (-x_m / z)
else if (z <= 2d-35) then
tmp = x_m / (z / y_m)
else
tmp = y_m / (z / x_m)
end if
code = 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);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (z <= -4e-310) {
tmp = y_m * (-x_m / z);
} else if (z <= 2e-35) {
tmp = x_m / (z / y_m);
} else {
tmp = y_m / (z / x_m);
}
return 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) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if z <= -4e-310: tmp = y_m * (-x_m / z) elif z <= 2e-35: tmp = x_m / (z / y_m) else: tmp = y_m / (z / x_m) return 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) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (z <= -4e-310) tmp = Float64(y_m * Float64(Float64(-x_m) / z)); elseif (z <= 2e-35) tmp = Float64(x_m / Float64(z / y_m)); else tmp = Float64(y_m / Float64(z / x_m)); end return 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);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
tmp = 0.0;
if (z <= -4e-310)
tmp = y_m * (-x_m / z);
elseif (z <= 2e-35)
tmp = x_m / (z / y_m);
else
tmp = y_m / (z / x_m);
end
tmp_2 = 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]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[z, -4e-310], N[(y$95$m * N[((-x$95$m) / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2e-35], N[(x$95$m / N[(z / y$95$m), $MachinePrecision]), $MachinePrecision], N[(y$95$m / N[(z / x$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)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{-310}:\\
\;\;\;\;y\_m \cdot \frac{-x\_m}{z}\\
\mathbf{elif}\;z \leq 2 \cdot 10^{-35}:\\
\;\;\;\;\frac{x\_m}{\frac{z}{y\_m}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m}{\frac{z}{x\_m}}\\
\end{array}\right)
\end{array}
if z < -3.999999999999988e-310Initial program 85.2%
*-commutative85.2%
frac-times85.3%
associate-*l/89.0%
times-frac95.2%
Applied egg-rr95.2%
Taylor expanded in z around 0 66.2%
neg-mul-166.2%
+-commutative66.2%
unsub-neg66.2%
Simplified66.2%
Taylor expanded in z around inf 30.0%
associate-*r/30.0%
mul-1-neg30.0%
distribute-rgt-neg-out30.0%
associate-*l/35.8%
Simplified35.8%
if -3.999999999999988e-310 < z < 2.00000000000000002e-35Initial program 78.1%
*-commutative78.1%
frac-times79.8%
associate-*l/78.1%
times-frac96.7%
Applied egg-rr96.7%
Taylor expanded in z around 0 96.7%
neg-mul-196.7%
+-commutative96.7%
unsub-neg96.7%
Simplified96.7%
Taylor expanded in z around inf 0.8%
associate-*r/0.8%
mul-1-neg0.8%
distribute-rgt-neg-out0.8%
associate-*l/0.8%
Simplified0.8%
associate-*l/0.8%
associate-/l*0.8%
add-sqr-sqrt0.5%
sqrt-unprod19.8%
sqr-neg19.8%
sqrt-unprod19.2%
add-sqr-sqrt45.7%
Applied egg-rr45.7%
if 2.00000000000000002e-35 < z Initial program 81.5%
*-commutative81.5%
frac-times90.3%
associate-*l/92.3%
times-frac99.2%
Applied egg-rr99.2%
Taylor expanded in z around 0 39.6%
neg-mul-139.6%
+-commutative39.6%
unsub-neg39.6%
Simplified39.6%
Taylor expanded in z around inf 27.8%
associate-*r/27.8%
mul-1-neg27.8%
distribute-rgt-neg-out27.8%
associate-*l/34.8%
Simplified34.8%
clear-num34.8%
associate-*l/34.8%
*-un-lft-identity34.8%
add-sqr-sqrt15.3%
sqrt-unprod31.8%
sqr-neg31.8%
sqrt-unprod21.6%
add-sqr-sqrt37.9%
Applied egg-rr37.9%
Final simplification38.8%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (if (<= x_m 7.5e-82) (* (/ y_m z) (/ x_m z)) (* x_m (/ y_m (* z z)))))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (x_m <= 7.5e-82) {
tmp = (y_m / z) * (x_m / z);
} else {
tmp = x_m * (y_m / (z * z));
}
return 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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
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
real(8) :: tmp
if (x_m <= 7.5d-82) then
tmp = (y_m / z) * (x_m / z)
else
tmp = x_m * (y_m / (z * z))
end if
code = 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);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (x_m <= 7.5e-82) {
tmp = (y_m / z) * (x_m / z);
} else {
tmp = x_m * (y_m / (z * z));
}
return 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) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if x_m <= 7.5e-82: tmp = (y_m / z) * (x_m / z) else: tmp = x_m * (y_m / (z * z)) return 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) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (x_m <= 7.5e-82) tmp = Float64(Float64(y_m / z) * Float64(x_m / z)); else tmp = Float64(x_m * Float64(y_m / Float64(z * z))); end return 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);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
tmp = 0.0;
if (x_m <= 7.5e-82)
tmp = (y_m / z) * (x_m / z);
else
tmp = x_m * (y_m / (z * z));
end
tmp_2 = 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]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[x$95$m, 7.5e-82], N[(N[(y$95$m / z), $MachinePrecision] * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(y$95$m / N[(z * z), $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)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \leq 7.5 \cdot 10^{-82}:\\
\;\;\;\;\frac{y\_m}{z} \cdot \frac{x\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \frac{y\_m}{z \cdot z}\\
\end{array}\right)
\end{array}
if x < 7.4999999999999997e-82Initial program 81.2%
*-commutative81.2%
frac-times83.7%
associate-*l/86.1%
times-frac96.7%
Applied egg-rr96.7%
Taylor expanded in z around 0 74.5%
if 7.4999999999999997e-82 < x Initial program 85.2%
sqr-neg85.2%
*-commutative85.2%
times-frac90.3%
sqr-neg90.3%
Simplified90.3%
Taylor expanded in z around 0 72.0%
Final simplification73.8%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (if (<= y_m 1e+77) (* (/ y_m z) (/ x_m z)) (* y_m (/ (/ x_m z) z))))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (y_m <= 1e+77) {
tmp = (y_m / z) * (x_m / z);
} else {
tmp = y_m * ((x_m / z) / z);
}
return 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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
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
real(8) :: tmp
if (y_m <= 1d+77) then
tmp = (y_m / z) * (x_m / z)
else
tmp = y_m * ((x_m / z) / z)
end if
code = 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);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (y_m <= 1e+77) {
tmp = (y_m / z) * (x_m / z);
} else {
tmp = y_m * ((x_m / z) / z);
}
return 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) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if y_m <= 1e+77: tmp = (y_m / z) * (x_m / z) else: tmp = y_m * ((x_m / z) / z) return 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) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (y_m <= 1e+77) tmp = Float64(Float64(y_m / z) * Float64(x_m / z)); else tmp = Float64(y_m * Float64(Float64(x_m / z) / z)); end return 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);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
tmp = 0.0;
if (y_m <= 1e+77)
tmp = (y_m / z) * (x_m / z);
else
tmp = y_m * ((x_m / z) / z);
end
tmp_2 = 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]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[y$95$m, 1e+77], N[(N[(y$95$m / z), $MachinePrecision] * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], N[(y$95$m * N[(N[(x$95$m / z), $MachinePrecision] / z), $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)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 10^{+77}:\\
\;\;\;\;\frac{y\_m}{z} \cdot \frac{x\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot \frac{\frac{x\_m}{z}}{z}\\
\end{array}\right)
\end{array}
if y < 9.99999999999999983e76Initial program 83.4%
*-commutative83.4%
frac-times86.3%
associate-*l/87.4%
times-frac97.5%
Applied egg-rr97.5%
Taylor expanded in z around 0 75.1%
if 9.99999999999999983e76 < y Initial program 78.5%
*-commutative78.5%
frac-times82.9%
associate-*l/87.8%
times-frac94.2%
Applied egg-rr94.2%
Taylor expanded in z around 0 56.8%
*-commutative56.8%
clear-num56.7%
frac-times70.3%
*-un-lft-identity70.3%
Applied egg-rr70.3%
clear-num70.2%
associate-/r/70.3%
associate-/r*70.1%
clear-num70.1%
Applied egg-rr70.1%
Final simplification74.1%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (if (<= y_m 1e-58) (* (/ y_m z) (/ x_m z)) (/ y_m (* z (/ z x_m)))))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (y_m <= 1e-58) {
tmp = (y_m / z) * (x_m / z);
} else {
tmp = y_m / (z * (z / x_m));
}
return 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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
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
real(8) :: tmp
if (y_m <= 1d-58) then
tmp = (y_m / z) * (x_m / z)
else
tmp = y_m / (z * (z / x_m))
end if
code = 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);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (y_m <= 1e-58) {
tmp = (y_m / z) * (x_m / z);
} else {
tmp = y_m / (z * (z / x_m));
}
return 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) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if y_m <= 1e-58: tmp = (y_m / z) * (x_m / z) else: tmp = y_m / (z * (z / x_m)) return 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) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (y_m <= 1e-58) tmp = Float64(Float64(y_m / z) * Float64(x_m / z)); else tmp = Float64(y_m / Float64(z * Float64(z / x_m))); end return 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);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
tmp = 0.0;
if (y_m <= 1e-58)
tmp = (y_m / z) * (x_m / z);
else
tmp = y_m / (z * (z / x_m));
end
tmp_2 = 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]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[y$95$m, 1e-58], N[(N[(y$95$m / z), $MachinePrecision] * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], N[(y$95$m / N[(z * N[(z / x$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)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 10^{-58}:\\
\;\;\;\;\frac{y\_m}{z} \cdot \frac{x\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m}{z \cdot \frac{z}{x\_m}}\\
\end{array}\right)
\end{array}
if y < 1e-58Initial program 81.9%
*-commutative81.9%
frac-times84.6%
associate-*l/85.9%
times-frac97.3%
Applied egg-rr97.3%
Taylor expanded in z around 0 74.8%
if 1e-58 < y Initial program 83.3%
*-commutative83.3%
frac-times87.7%
associate-*l/91.2%
times-frac95.7%
Applied egg-rr95.7%
Taylor expanded in z around 0 62.9%
*-commutative62.9%
clear-num62.8%
frac-times72.4%
*-un-lft-identity72.4%
Applied egg-rr72.4%
Final simplification74.1%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (if (<= y_m 5.6e-73) (/ (/ y_m z) (/ z x_m)) (/ y_m (* z (/ z x_m)))))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (y_m <= 5.6e-73) {
tmp = (y_m / z) / (z / x_m);
} else {
tmp = y_m / (z * (z / x_m));
}
return 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)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
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
real(8) :: tmp
if (y_m <= 5.6d-73) then
tmp = (y_m / z) / (z / x_m)
else
tmp = y_m / (z * (z / x_m))
end if
code = 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);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
double tmp;
if (y_m <= 5.6e-73) {
tmp = (y_m / z) / (z / x_m);
} else {
tmp = y_m / (z * (z / x_m));
}
return 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) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): tmp = 0 if y_m <= 5.6e-73: tmp = (y_m / z) / (z / x_m) else: tmp = y_m / (z * (z / x_m)) return 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) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) tmp = 0.0 if (y_m <= 5.6e-73) tmp = Float64(Float64(y_m / z) / Float64(z / x_m)); else tmp = Float64(y_m / Float64(z * Float64(z / x_m))); end return 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);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp_2 = code(y_s, x_s, x_m, y_m, z)
tmp = 0.0;
if (y_m <= 5.6e-73)
tmp = (y_m / z) / (z / x_m);
else
tmp = y_m / (z * (z / x_m));
end
tmp_2 = 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]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * If[LessEqual[y$95$m, 5.6e-73], N[(N[(y$95$m / z), $MachinePrecision] / N[(z / x$95$m), $MachinePrecision]), $MachinePrecision], N[(y$95$m / N[(z * N[(z / x$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)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 5.6 \cdot 10^{-73}:\\
\;\;\;\;\frac{\frac{y\_m}{z}}{\frac{z}{x\_m}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m}{z \cdot \frac{z}{x\_m}}\\
\end{array}\right)
\end{array}
if y < 5.60000000000000023e-73Initial program 81.5%
associate-*l/81.0%
sqr-neg81.0%
*-commutative81.0%
distribute-rgt1-in71.8%
sqr-neg71.8%
sqr-neg71.8%
cube-unmult71.8%
Simplified71.8%
associate-*l/72.3%
cube-mult72.3%
distribute-rgt1-in81.5%
frac-times84.3%
clear-num84.3%
associate-/r*89.8%
frac-times97.2%
*-un-lft-identity97.2%
Applied egg-rr97.2%
Taylor expanded in z around 0 75.2%
if 5.60000000000000023e-73 < y Initial program 84.2%
*-commutative84.2%
frac-times88.3%
associate-*l/91.6%
times-frac96.0%
Applied egg-rr96.0%
Taylor expanded in z around 0 62.5%
*-commutative62.5%
clear-num62.5%
frac-times71.6%
*-un-lft-identity71.6%
Applied egg-rr71.6%
Final simplification74.1%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (* (/ y_m z) (/ (/ x_m (+ z 1.0)) z)))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * ((y_m / z) * ((x_m / (z + 1.0)) / z)));
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
y_m = abs(y)
y_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
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
code = y_s * (x_s * ((y_m / z) * ((x_m / (z + 1.0d0)) / z)))
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);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * ((y_m / z) * ((x_m / (z + 1.0)) / z)));
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) y_m = math.fabs(y) y_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): return y_s * (x_s * ((y_m / z) * ((x_m / (z + 1.0)) / z)))
x_m = abs(x) x_s = copysign(1.0, x) y_m = abs(y) y_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) return Float64(y_s * Float64(x_s * Float64(Float64(y_m / z) * Float64(Float64(x_m / Float64(z + 1.0)) / z)))) end
x_m = abs(x);
x_s = sign(x) * abs(1.0);
y_m = abs(y);
y_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp = code(y_s, x_s, x_m, y_m, z)
tmp = y_s * (x_s * ((y_m / z) * ((x_m / (z + 1.0)) / z)));
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]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[(N[(y$95$m / z), $MachinePrecision] * N[(N[(x$95$m / N[(z + 1.0), $MachinePrecision]), $MachinePrecision] / z), $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)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \left(\frac{y\_m}{z} \cdot \frac{\frac{x\_m}{z + 1}}{z}\right)\right)
\end{array}
Initial program 82.3%
*-commutative82.3%
frac-times85.6%
associate-*l/87.5%
times-frac96.8%
Applied egg-rr96.8%
Final simplification96.8%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (* (/ y_m z) (/ x_m z)))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * ((y_m / z) * (x_m / z)));
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
y_m = abs(y)
y_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
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
code = y_s * (x_s * ((y_m / z) * (x_m / z)))
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);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * ((y_m / z) * (x_m / z)));
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) y_m = math.fabs(y) y_s = math.copysign(1.0, y) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): return y_s * (x_s * ((y_m / z) * (x_m / z)))
x_m = abs(x) x_s = copysign(1.0, x) y_m = abs(y) y_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) return Float64(y_s * Float64(x_s * Float64(Float64(y_m / z) * Float64(x_m / z)))) end
x_m = abs(x);
x_s = sign(x) * abs(1.0);
y_m = abs(y);
y_s = sign(y) * abs(1.0);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp = code(y_s, x_s, x_m, y_m, z)
tmp = y_s * (x_s * ((y_m / z) * (x_m / z)));
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]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[(N[(y$95$m / z), $MachinePrecision] * N[(x$95$m / z), $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)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \left(\frac{y\_m}{z} \cdot \frac{x\_m}{z}\right)\right)
\end{array}
Initial program 82.3%
*-commutative82.3%
frac-times85.6%
associate-*l/87.5%
times-frac96.8%
Applied egg-rr96.8%
Taylor expanded in z around 0 71.2%
Final simplification71.2%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function. (FPCore (y_s x_s x_m y_m z) :precision binary64 (* y_s (* x_s (/ x_m (/ z y_m)))))
x_m = fabs(x);
x_s = copysign(1.0, x);
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x_m < y_m && y_m < z);
double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * (x_m / (z / y_m)));
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
y_m = abs(y)
y_s = copysign(1.0d0, y)
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
real(8) function code(y_s, x_s, x_m, y_m, z)
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
code = y_s * (x_s * (x_m / (z / 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);
assert x_m < y_m && y_m < z;
public static double code(double y_s, double x_s, double x_m, double y_m, double z) {
return y_s * (x_s * (x_m / (z / 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) [x_m, y_m, z] = sort([x_m, y_m, z]) def code(y_s, x_s, x_m, y_m, z): return y_s * (x_s * (x_m / (z / y_m)))
x_m = abs(x) x_s = copysign(1.0, x) y_m = abs(y) y_s = copysign(1.0, y) x_m, y_m, z = sort([x_m, y_m, z]) function code(y_s, x_s, x_m, y_m, z) return Float64(y_s * Float64(x_s * Float64(x_m / Float64(z / 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);
x_m, y_m, z = num2cell(sort([x_m, y_m, z])){:}
function tmp = code(y_s, x_s, x_m, y_m, z)
tmp = y_s * (x_s * (x_m / (z / 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]
NOTE: x_m, y_m, and z should be sorted in increasing order before calling this function.
code[y$95$s_, x$95$s_, x$95$m_, y$95$m_, z_] := N[(y$95$s * N[(x$95$s * N[(x$95$m / N[(z / 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)
\\
[x_m, y_m, z] = \mathsf{sort}([x_m, y_m, z])\\
\\
y\_s \cdot \left(x\_s \cdot \frac{x\_m}{\frac{z}{y\_m}}\right)
\end{array}
Initial program 82.3%
*-commutative82.3%
frac-times85.6%
associate-*l/87.5%
times-frac96.8%
Applied egg-rr96.8%
Taylor expanded in z around 0 65.2%
neg-mul-165.2%
+-commutative65.2%
unsub-neg65.2%
Simplified65.2%
Taylor expanded in z around inf 22.4%
associate-*r/22.4%
mul-1-neg22.4%
distribute-rgt-neg-out22.4%
associate-*l/27.1%
Simplified27.1%
associate-*l/22.4%
associate-/l*27.2%
add-sqr-sqrt12.8%
sqrt-unprod28.0%
sqr-neg28.0%
sqrt-unprod14.4%
add-sqr-sqrt30.8%
Applied egg-rr30.8%
Final simplification30.8%
(FPCore (x y z) :precision binary64 (if (< z 249.6182814532307) (/ (* y (/ x z)) (+ z (* z z))) (/ (* (/ (/ y z) (+ 1.0 z)) x) z)))
double code(double x, double y, double z) {
double tmp;
if (z < 249.6182814532307) {
tmp = (y * (x / z)) / (z + (z * z));
} else {
tmp = (((y / z) / (1.0 + z)) * x) / z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z < 249.6182814532307d0) then
tmp = (y * (x / z)) / (z + (z * z))
else
tmp = (((y / z) / (1.0d0 + z)) * x) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z < 249.6182814532307) {
tmp = (y * (x / z)) / (z + (z * z));
} else {
tmp = (((y / z) / (1.0 + z)) * x) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z < 249.6182814532307: tmp = (y * (x / z)) / (z + (z * z)) else: tmp = (((y / z) / (1.0 + z)) * x) / z return tmp
function code(x, y, z) tmp = 0.0 if (z < 249.6182814532307) tmp = Float64(Float64(y * Float64(x / z)) / Float64(z + Float64(z * z))); else tmp = Float64(Float64(Float64(Float64(y / z) / Float64(1.0 + z)) * x) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z < 249.6182814532307) tmp = (y * (x / z)) / (z + (z * z)); else tmp = (((y / z) / (1.0 + z)) * x) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Less[z, 249.6182814532307], N[(N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision] / N[(z + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(y / z), $MachinePrecision] / N[(1.0 + z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z < 249.6182814532307:\\
\;\;\;\;\frac{y \cdot \frac{x}{z}}{z + z \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{y}{z}}{1 + z} \cdot x}{z}\\
\end{array}
\end{array}
herbie shell --seed 2024031
(FPCore (x y z)
:name "Statistics.Distribution.Beta:$cvariance from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(if (< z 249.6182814532307) (/ (* y (/ x z)) (+ z (* z z))) (/ (* (/ (/ y z) (+ 1.0 z)) x) z))
(/ (* x y) (* (* z z) (+ z 1.0))))