
(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 15 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 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) 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 1.0) (* z z)) 4e+75)
(* (/ y_m (+ z 1.0)) (/ (/ x_m z) z))
(/ (/ (/ x_m z) (/ z y_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 * z)) <= 4e+75) {
tmp = (y_m / (z + 1.0)) * ((x_m / z) / z);
} else {
tmp = ((x_m / z) / (z / y_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) * (z * z)) <= 4d+75) then
tmp = (y_m / (z + 1.0d0)) * ((x_m / z) / z)
else
tmp = ((x_m / z) / (z / y_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 * z)) <= 4e+75) {
tmp = (y_m / (z + 1.0)) * ((x_m / z) / z);
} else {
tmp = ((x_m / z) / (z / y_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) * (z * z)) <= 4e+75: tmp = (y_m / (z + 1.0)) * ((x_m / z) / z) else: tmp = ((x_m / z) / (z / y_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(z + 1.0) * Float64(z * z)) <= 4e+75) tmp = Float64(Float64(y_m / Float64(z + 1.0)) * Float64(Float64(x_m / z) / z)); else tmp = Float64(Float64(Float64(x_m / z) / Float64(z / y_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 * z)) <= 4e+75)
tmp = (y_m / (z + 1.0)) * ((x_m / z) / z);
else
tmp = ((x_m / z) / (z / y_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[(z + 1.0), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision], 4e+75], N[(N[(y$95$m / N[(z + 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(x$95$m / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x$95$m / z), $MachinePrecision] / N[(z / y$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}\;\left(z + 1\right) \cdot \left(z \cdot z\right) \leq 4 \cdot 10^{+75}:\\
\;\;\;\;\frac{y\_m}{z + 1} \cdot \frac{\frac{x\_m}{z}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{x\_m}{z}}{\frac{z}{y\_m}}}{z}\\
\end{array}\right)
\end{array}
if (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64))) < 3.99999999999999971e75Initial program 77.8%
*-commutative77.8%
associate-/l*83.0%
sqr-neg83.0%
associate-/r*84.4%
sqr-neg84.4%
Simplified84.4%
associate-*r/85.3%
*-commutative85.3%
associate-*r/85.8%
associate-/r*92.3%
associate-*l/96.4%
Applied egg-rr96.4%
*-commutative96.4%
associate-/l*92.3%
Applied egg-rr92.3%
if 3.99999999999999971e75 < (*.f64 (*.f64 z z) (+.f64 z #s(literal 1 binary64))) Initial program 80.8%
*-commutative80.8%
associate-/l*81.0%
sqr-neg81.0%
associate-/r*86.4%
sqr-neg86.4%
Simplified86.4%
associate-*r/88.1%
*-commutative88.1%
associate-*r/88.1%
associate-/r*91.2%
associate-*l/99.8%
Applied egg-rr99.8%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in z around inf 99.9%
Final simplification93.9%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) 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 -1.0)
(* (/ x_m z) y_m)
(if (<= z -5e-310)
(* (/ y_m z) (- x_m))
(if (<= z 3.2e-142) (* x_m (/ y_m z)) (/ 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 <= -1.0) {
tmp = (x_m / z) * y_m;
} else if (z <= -5e-310) {
tmp = (y_m / z) * -x_m;
} else if (z <= 3.2e-142) {
tmp = x_m * (y_m / z);
} 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 <= (-1.0d0)) then
tmp = (x_m / z) * y_m
else if (z <= (-5d-310)) then
tmp = (y_m / z) * -x_m
else if (z <= 3.2d-142) then
tmp = x_m * (y_m / z)
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 <= -1.0) {
tmp = (x_m / z) * y_m;
} else if (z <= -5e-310) {
tmp = (y_m / z) * -x_m;
} else if (z <= 3.2e-142) {
tmp = x_m * (y_m / z);
} 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 <= -1.0: tmp = (x_m / z) * y_m elif z <= -5e-310: tmp = (y_m / z) * -x_m elif z <= 3.2e-142: tmp = x_m * (y_m / z) 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 <= -1.0) tmp = Float64(Float64(x_m / z) * y_m); elseif (z <= -5e-310) tmp = Float64(Float64(y_m / z) * Float64(-x_m)); elseif (z <= 3.2e-142) tmp = Float64(x_m * Float64(y_m / z)); 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 <= -1.0)
tmp = (x_m / z) * y_m;
elseif (z <= -5e-310)
tmp = (y_m / z) * -x_m;
elseif (z <= 3.2e-142)
tmp = x_m * (y_m / z);
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, -1.0], N[(N[(x$95$m / z), $MachinePrecision] * y$95$m), $MachinePrecision], If[LessEqual[z, -5e-310], N[(N[(y$95$m / z), $MachinePrecision] * (-x$95$m)), $MachinePrecision], If[LessEqual[z, 3.2e-142], N[(x$95$m * N[(y$95$m / z), $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 -1:\\
\;\;\;\;\frac{x\_m}{z} \cdot y\_m\\
\mathbf{elif}\;z \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{y\_m}{z} \cdot \left(-x\_m\right)\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-142}:\\
\;\;\;\;x\_m \cdot \frac{y\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m}{\frac{z}{x\_m}}\\
\end{array}\right)
\end{array}
if z < -1Initial program 79.7%
*-commutative79.7%
sqr-neg79.7%
times-frac96.1%
sqr-neg96.1%
Simplified96.1%
Taylor expanded in z around 0 48.3%
mul-1-neg48.3%
unsub-neg48.3%
Simplified48.3%
Taylor expanded in z around inf 37.4%
mul-1-neg37.4%
associate-*l/41.7%
*-commutative41.7%
distribute-rgt-neg-in41.7%
distribute-frac-neg241.7%
Simplified41.7%
add-sqr-sqrt29.1%
sqrt-unprod56.1%
distribute-frac-neg256.1%
distribute-frac-neg256.1%
sqr-neg56.1%
sqrt-unprod35.4%
add-sqr-sqrt44.3%
*-un-lft-identity44.3%
Applied egg-rr44.3%
*-lft-identity44.3%
Simplified44.3%
if -1 < z < -4.999999999999985e-310Initial program 73.5%
*-commutative73.5%
sqr-neg73.5%
times-frac81.7%
sqr-neg81.7%
Simplified81.7%
Taylor expanded in z around 0 80.8%
mul-1-neg80.8%
unsub-neg80.8%
Simplified80.8%
Taylor expanded in z around inf 44.5%
mul-1-neg44.5%
associate-*r/47.8%
distribute-lft-neg-out47.8%
*-commutative47.8%
Simplified47.8%
if -4.999999999999985e-310 < z < 3.1999999999999998e-142Initial program 69.8%
*-commutative69.8%
sqr-neg69.8%
times-frac71.3%
sqr-neg71.3%
Simplified71.3%
Taylor expanded in z around 0 71.3%
mul-1-neg71.3%
unsub-neg71.3%
Simplified71.3%
Taylor expanded in z around inf 0.6%
mul-1-neg0.6%
associate-*l/0.5%
*-commutative0.5%
distribute-rgt-neg-in0.5%
distribute-frac-neg20.5%
Simplified0.5%
distribute-frac-neg20.5%
distribute-frac-neg0.5%
associate-*r/0.6%
Applied egg-rr0.6%
add-sqr-sqrt0.6%
times-frac0.5%
add-sqr-sqrt0.4%
sqrt-unprod22.0%
sqr-neg22.0%
sqrt-unprod19.6%
add-sqr-sqrt32.9%
times-frac22.3%
add-sqr-sqrt22.3%
clear-num22.3%
associate-/r*35.2%
associate-/r/37.3%
clear-num37.3%
Applied egg-rr37.3%
if 3.1999999999999998e-142 < z Initial program 85.5%
*-commutative85.5%
sqr-neg85.5%
times-frac93.4%
sqr-neg93.4%
Simplified93.4%
Taylor expanded in z around 0 60.6%
mul-1-neg60.6%
unsub-neg60.6%
Simplified60.6%
Taylor expanded in z around inf 19.0%
mul-1-neg19.0%
associate-*l/20.2%
*-commutative20.2%
distribute-rgt-neg-in20.2%
distribute-frac-neg220.2%
Simplified20.2%
add-sqr-sqrt18.0%
sqrt-unprod37.2%
distribute-frac-neg237.2%
distribute-frac-neg237.2%
sqr-neg37.2%
sqrt-unprod24.2%
add-sqr-sqrt33.7%
clear-num33.7%
un-div-inv33.7%
Applied egg-rr33.7%
Final simplification40.5%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) 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)))
(/ (* (/ x_m z) (/ y_m z)) 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 ((z <= -1.0) || !(z <= 1.0)) {
tmp = ((x_m / z) * (y_m / z)) / 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 ((z <= (-1.0d0)) .or. (.not. (z <= 1.0d0))) then
tmp = ((x_m / z) * (y_m / z)) / 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 ((z <= -1.0) || !(z <= 1.0)) {
tmp = ((x_m / z) * (y_m / z)) / 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 (z <= -1.0) or not (z <= 1.0): tmp = ((x_m / z) * (y_m / z)) / 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 ((z <= -1.0) || !(z <= 1.0)) tmp = Float64(Float64(Float64(x_m / z) * Float64(y_m / z)) / 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 ((z <= -1.0) || ~((z <= 1.0)))
tmp = ((x_m / z) * (y_m / z)) / 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[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(N[(N[(x$95$m / z), $MachinePrecision] * N[(y$95$m / z), $MachinePrecision]), $MachinePrecision] / z), $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}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{\frac{x\_m}{z} \cdot \frac{y\_m}{z}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m}{z \cdot \frac{z}{x\_m}}\\
\end{array}\right)
\end{array}
if z < -1 or 1 < z Initial program 80.7%
*-commutative80.7%
associate-/l*84.8%
sqr-neg84.8%
associate-/r*89.4%
sqr-neg89.4%
Simplified89.4%
associate-*r/91.6%
*-commutative91.6%
associate-*r/92.3%
associate-/r*95.2%
associate-*l/99.0%
Applied egg-rr99.0%
Taylor expanded in z around inf 98.0%
if -1 < z < 1Initial program 76.3%
*-commutative76.3%
associate-/l*80.6%
sqr-neg80.6%
associate-/r*80.6%
sqr-neg80.6%
Simplified80.6%
associate-*r/80.6%
*-commutative80.6%
associate-*r/80.6%
associate-/r*89.2%
associate-*l/95.4%
Applied egg-rr95.4%
*-commutative95.4%
associate-/l*89.2%
Applied egg-rr89.2%
clear-num89.1%
un-div-inv90.9%
div-inv90.9%
clear-num90.9%
Applied egg-rr90.9%
Taylor expanded in z around 0 89.7%
Final simplification93.7%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) 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)))
(* (/ x_m z) (/ y_m (* z 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 ((z <= -1.0) || !(z <= 1.0)) {
tmp = (x_m / z) * (y_m / (z * 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 ((z <= (-1.0d0)) .or. (.not. (z <= 1.0d0))) then
tmp = (x_m / z) * (y_m / (z * 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 ((z <= -1.0) || !(z <= 1.0)) {
tmp = (x_m / z) * (y_m / (z * 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 (z <= -1.0) or not (z <= 1.0): tmp = (x_m / z) * (y_m / (z * 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 ((z <= -1.0) || !(z <= 1.0)) tmp = Float64(Float64(x_m / z) * Float64(y_m / Float64(z * 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 ((z <= -1.0) || ~((z <= 1.0)))
tmp = (x_m / z) * (y_m / (z * 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[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(N[(x$95$m / z), $MachinePrecision] * N[(y$95$m / N[(z * z), $MachinePrecision]), $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}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{x\_m}{z} \cdot \frac{y\_m}{z \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m}{z \cdot \frac{z}{x\_m}}\\
\end{array}\right)
\end{array}
if z < -1 or 1 < z Initial program 80.7%
*-commutative80.7%
sqr-neg80.7%
times-frac95.0%
sqr-neg95.0%
Simplified95.0%
Taylor expanded in z around inf 94.0%
if -1 < z < 1Initial program 76.3%
*-commutative76.3%
associate-/l*80.6%
sqr-neg80.6%
associate-/r*80.6%
sqr-neg80.6%
Simplified80.6%
associate-*r/80.6%
*-commutative80.6%
associate-*r/80.6%
associate-/r*89.2%
associate-*l/95.4%
Applied egg-rr95.4%
*-commutative95.4%
associate-/l*89.2%
Applied egg-rr89.2%
clear-num89.1%
un-div-inv90.9%
div-inv90.9%
clear-num90.9%
Applied egg-rr90.9%
Taylor expanded in z around 0 89.7%
Final simplification91.8%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) 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 (/ 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 <= -1.0) || !(z <= 1.0)) {
tmp = y_m * ((x_m / (z * z)) / 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 ((z <= (-1.0d0)) .or. (.not. (z <= 1.0d0))) then
tmp = y_m * ((x_m / (z * z)) / 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 ((z <= -1.0) || !(z <= 1.0)) {
tmp = y_m * ((x_m / (z * z)) / 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 (z <= -1.0) or not (z <= 1.0): tmp = y_m * ((x_m / (z * z)) / 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 ((z <= -1.0) || !(z <= 1.0)) tmp = Float64(y_m * Float64(Float64(x_m / Float64(z * z)) / 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 ((z <= -1.0) || ~((z <= 1.0)))
tmp = y_m * ((x_m / (z * z)) / 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[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(y$95$m * N[(N[(x$95$m / N[(z * z), $MachinePrecision]), $MachinePrecision] / 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}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;y\_m \cdot \frac{\frac{x\_m}{z \cdot z}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m}{z \cdot \frac{z}{x\_m}}\\
\end{array}\right)
\end{array}
if z < -1 or 1 < z Initial program 80.7%
*-commutative80.7%
associate-/l*84.8%
sqr-neg84.8%
associate-/r*89.4%
sqr-neg89.4%
Simplified89.4%
Taylor expanded in z around inf 88.3%
if -1 < z < 1Initial program 76.3%
*-commutative76.3%
associate-/l*80.6%
sqr-neg80.6%
associate-/r*80.6%
sqr-neg80.6%
Simplified80.6%
associate-*r/80.6%
*-commutative80.6%
associate-*r/80.6%
associate-/r*89.2%
associate-*l/95.4%
Applied egg-rr95.4%
*-commutative95.4%
associate-/l*89.2%
Applied egg-rr89.2%
clear-num89.1%
un-div-inv90.9%
div-inv90.9%
clear-num90.9%
Applied egg-rr90.9%
Taylor expanded in z around 0 89.7%
Final simplification89.0%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) 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 -3.5e-7)
(* (/ y_m (* z z)) (/ x_m (+ z 1.0)))
(if (<= z 1.0) (/ y_m (* z (/ z x_m))) (/ (/ (/ x_m z) (/ z y_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 <= -3.5e-7) {
tmp = (y_m / (z * z)) * (x_m / (z + 1.0));
} else if (z <= 1.0) {
tmp = y_m / (z * (z / x_m));
} else {
tmp = ((x_m / z) / (z / y_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 <= (-3.5d-7)) then
tmp = (y_m / (z * z)) * (x_m / (z + 1.0d0))
else if (z <= 1.0d0) then
tmp = y_m / (z * (z / x_m))
else
tmp = ((x_m / z) / (z / y_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 <= -3.5e-7) {
tmp = (y_m / (z * z)) * (x_m / (z + 1.0));
} else if (z <= 1.0) {
tmp = y_m / (z * (z / x_m));
} else {
tmp = ((x_m / z) / (z / y_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 <= -3.5e-7: tmp = (y_m / (z * z)) * (x_m / (z + 1.0)) elif z <= 1.0: tmp = y_m / (z * (z / x_m)) else: tmp = ((x_m / z) / (z / y_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 <= -3.5e-7) tmp = Float64(Float64(y_m / Float64(z * z)) * Float64(x_m / Float64(z + 1.0))); elseif (z <= 1.0) tmp = Float64(y_m / Float64(z * Float64(z / x_m))); else tmp = Float64(Float64(Float64(x_m / z) / Float64(z / y_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 <= -3.5e-7)
tmp = (y_m / (z * z)) * (x_m / (z + 1.0));
elseif (z <= 1.0)
tmp = y_m / (z * (z / x_m));
else
tmp = ((x_m / z) / (z / y_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[z, -3.5e-7], N[(N[(y$95$m / N[(z * z), $MachinePrecision]), $MachinePrecision] * N[(x$95$m / N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(y$95$m / N[(z * N[(z / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x$95$m / z), $MachinePrecision] / N[(z / y$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 -3.5 \cdot 10^{-7}:\\
\;\;\;\;\frac{y\_m}{z \cdot z} \cdot \frac{x\_m}{z + 1}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;\frac{y\_m}{z \cdot \frac{z}{x\_m}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{x\_m}{z}}{\frac{z}{y\_m}}}{z}\\
\end{array}\right)
\end{array}
if z < -3.49999999999999984e-7Initial program 80.0%
*-commutative80.0%
sqr-neg80.0%
times-frac96.2%
sqr-neg96.2%
Simplified96.2%
if -3.49999999999999984e-7 < z < 1Initial program 76.1%
*-commutative76.1%
associate-/l*80.5%
sqr-neg80.5%
associate-/r*80.5%
sqr-neg80.5%
Simplified80.5%
associate-*r/80.5%
*-commutative80.5%
associate-*r/80.5%
associate-/r*89.1%
associate-*l/95.3%
Applied egg-rr95.3%
*-commutative95.3%
associate-/l*89.1%
Applied egg-rr89.1%
clear-num89.1%
un-div-inv90.9%
div-inv90.8%
clear-num90.9%
Applied egg-rr90.9%
Taylor expanded in z around 0 90.1%
if 1 < z Initial program 81.8%
*-commutative81.8%
associate-/l*82.0%
sqr-neg82.0%
associate-/r*87.2%
sqr-neg87.2%
Simplified87.2%
associate-*r/88.7%
*-commutative88.7%
associate-*r/88.7%
associate-/r*91.7%
associate-*l/99.7%
Applied egg-rr99.7%
clear-num99.8%
un-div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 98.6%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) 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 -1.0)
(/ (* (/ x_m z) (/ y_m z)) z)
(if (<= z 1.0) (/ y_m (* z (/ z x_m))) (/ (/ (/ x_m z) (/ z y_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) {
tmp = ((x_m / z) * (y_m / z)) / z;
} else if (z <= 1.0) {
tmp = y_m / (z * (z / x_m));
} else {
tmp = ((x_m / z) / (z / y_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)) then
tmp = ((x_m / z) * (y_m / z)) / z
else if (z <= 1.0d0) then
tmp = y_m / (z * (z / x_m))
else
tmp = ((x_m / z) / (z / y_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) {
tmp = ((x_m / z) * (y_m / z)) / z;
} else if (z <= 1.0) {
tmp = y_m / (z * (z / x_m));
} else {
tmp = ((x_m / z) / (z / y_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: tmp = ((x_m / z) * (y_m / z)) / z elif z <= 1.0: tmp = y_m / (z * (z / x_m)) else: tmp = ((x_m / z) / (z / y_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) tmp = Float64(Float64(Float64(x_m / z) * Float64(y_m / z)) / z); elseif (z <= 1.0) tmp = Float64(y_m / Float64(z * Float64(z / x_m))); else tmp = Float64(Float64(Float64(x_m / z) / Float64(z / y_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)
tmp = ((x_m / z) * (y_m / z)) / z;
elseif (z <= 1.0)
tmp = y_m / (z * (z / x_m));
else
tmp = ((x_m / z) / (z / y_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[z, -1.0], N[(N[(N[(x$95$m / z), $MachinePrecision] * N[(y$95$m / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 1.0], N[(y$95$m / N[(z * N[(z / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x$95$m / z), $MachinePrecision] / N[(z / y$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:\\
\;\;\;\;\frac{\frac{x\_m}{z} \cdot \frac{y\_m}{z}}{z}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;\frac{y\_m}{z \cdot \frac{z}{x\_m}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{x\_m}{z}}{\frac{z}{y\_m}}}{z}\\
\end{array}\right)
\end{array}
if z < -1Initial program 79.7%
*-commutative79.7%
associate-/l*87.2%
sqr-neg87.2%
associate-/r*91.3%
sqr-neg91.3%
Simplified91.3%
associate-*r/94.0%
*-commutative94.0%
associate-*r/95.4%
associate-/r*98.2%
associate-*l/98.4%
Applied egg-rr98.4%
Taylor expanded in z around inf 97.5%
if -1 < z < 1Initial program 76.3%
*-commutative76.3%
associate-/l*80.6%
sqr-neg80.6%
associate-/r*80.6%
sqr-neg80.6%
Simplified80.6%
associate-*r/80.6%
*-commutative80.6%
associate-*r/80.6%
associate-/r*89.2%
associate-*l/95.4%
Applied egg-rr95.4%
*-commutative95.4%
associate-/l*89.2%
Applied egg-rr89.2%
clear-num89.1%
un-div-inv90.9%
div-inv90.9%
clear-num90.9%
Applied egg-rr90.9%
Taylor expanded in z around 0 89.7%
if 1 < z Initial program 81.8%
*-commutative81.8%
associate-/l*82.0%
sqr-neg82.0%
associate-/r*87.2%
sqr-neg87.2%
Simplified87.2%
associate-*r/88.7%
*-commutative88.7%
associate-*r/88.7%
associate-/r*91.7%
associate-*l/99.7%
Applied egg-rr99.7%
clear-num99.8%
un-div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 98.6%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) 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 -5e-310)
(* (/ x_m z) (- y_m))
(if (<= z 3.2e-142) (* x_m (/ y_m z)) (/ 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 <= -5e-310) {
tmp = (x_m / z) * -y_m;
} else if (z <= 3.2e-142) {
tmp = x_m * (y_m / z);
} 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 <= (-5d-310)) then
tmp = (x_m / z) * -y_m
else if (z <= 3.2d-142) then
tmp = x_m * (y_m / z)
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 <= -5e-310) {
tmp = (x_m / z) * -y_m;
} else if (z <= 3.2e-142) {
tmp = x_m * (y_m / z);
} 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 <= -5e-310: tmp = (x_m / z) * -y_m elif z <= 3.2e-142: tmp = x_m * (y_m / z) 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 <= -5e-310) tmp = Float64(Float64(x_m / z) * Float64(-y_m)); elseif (z <= 3.2e-142) tmp = Float64(x_m * Float64(y_m / z)); 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 <= -5e-310)
tmp = (x_m / z) * -y_m;
elseif (z <= 3.2e-142)
tmp = x_m * (y_m / z);
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, -5e-310], N[(N[(x$95$m / z), $MachinePrecision] * (-y$95$m)), $MachinePrecision], If[LessEqual[z, 3.2e-142], N[(x$95$m * N[(y$95$m / z), $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 -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{x\_m}{z} \cdot \left(-y\_m\right)\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-142}:\\
\;\;\;\;x\_m \cdot \frac{y\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m}{\frac{z}{x\_m}}\\
\end{array}\right)
\end{array}
if z < -4.999999999999985e-310Initial program 76.7%
*-commutative76.7%
sqr-neg76.7%
times-frac89.3%
sqr-neg89.3%
Simplified89.3%
Taylor expanded in z around 0 63.8%
mul-1-neg63.8%
unsub-neg63.8%
Simplified63.8%
Taylor expanded in z around inf 40.8%
mul-1-neg40.8%
associate-*l/45.3%
*-commutative45.3%
distribute-rgt-neg-in45.3%
distribute-frac-neg245.3%
Simplified45.3%
if -4.999999999999985e-310 < z < 3.1999999999999998e-142Initial program 69.8%
*-commutative69.8%
sqr-neg69.8%
times-frac71.3%
sqr-neg71.3%
Simplified71.3%
Taylor expanded in z around 0 71.3%
mul-1-neg71.3%
unsub-neg71.3%
Simplified71.3%
Taylor expanded in z around inf 0.6%
mul-1-neg0.6%
associate-*l/0.5%
*-commutative0.5%
distribute-rgt-neg-in0.5%
distribute-frac-neg20.5%
Simplified0.5%
distribute-frac-neg20.5%
distribute-frac-neg0.5%
associate-*r/0.6%
Applied egg-rr0.6%
add-sqr-sqrt0.6%
times-frac0.5%
add-sqr-sqrt0.4%
sqrt-unprod22.0%
sqr-neg22.0%
sqrt-unprod19.6%
add-sqr-sqrt32.9%
times-frac22.3%
add-sqr-sqrt22.3%
clear-num22.3%
associate-/r*35.2%
associate-/r/37.3%
clear-num37.3%
Applied egg-rr37.3%
if 3.1999999999999998e-142 < z Initial program 85.5%
*-commutative85.5%
sqr-neg85.5%
times-frac93.4%
sqr-neg93.4%
Simplified93.4%
Taylor expanded in z around 0 60.6%
mul-1-neg60.6%
unsub-neg60.6%
Simplified60.6%
Taylor expanded in z around inf 19.0%
mul-1-neg19.0%
associate-*l/20.2%
*-commutative20.2%
distribute-rgt-neg-in20.2%
distribute-frac-neg220.2%
Simplified20.2%
add-sqr-sqrt18.0%
sqrt-unprod37.2%
distribute-frac-neg237.2%
distribute-frac-neg237.2%
sqr-neg37.2%
sqrt-unprod24.2%
add-sqr-sqrt33.7%
clear-num33.7%
un-div-inv33.7%
Applied egg-rr33.7%
Final simplification40.1%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) 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 -6.8e-308)
(* (/ x_m z) y_m)
(if (<= z 1.04e-168) (* x_m (/ y_m z)) (/ 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 <= -6.8e-308) {
tmp = (x_m / z) * y_m;
} else if (z <= 1.04e-168) {
tmp = x_m * (y_m / z);
} 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 <= (-6.8d-308)) then
tmp = (x_m / z) * y_m
else if (z <= 1.04d-168) then
tmp = x_m * (y_m / z)
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 <= -6.8e-308) {
tmp = (x_m / z) * y_m;
} else if (z <= 1.04e-168) {
tmp = x_m * (y_m / z);
} 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 <= -6.8e-308: tmp = (x_m / z) * y_m elif z <= 1.04e-168: tmp = x_m * (y_m / z) 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 <= -6.8e-308) tmp = Float64(Float64(x_m / z) * y_m); elseif (z <= 1.04e-168) tmp = Float64(x_m * Float64(y_m / z)); 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 <= -6.8e-308)
tmp = (x_m / z) * y_m;
elseif (z <= 1.04e-168)
tmp = x_m * (y_m / z);
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, -6.8e-308], N[(N[(x$95$m / z), $MachinePrecision] * y$95$m), $MachinePrecision], If[LessEqual[z, 1.04e-168], N[(x$95$m * N[(y$95$m / z), $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 -6.8 \cdot 10^{-308}:\\
\;\;\;\;\frac{x\_m}{z} \cdot y\_m\\
\mathbf{elif}\;z \leq 1.04 \cdot 10^{-168}:\\
\;\;\;\;x\_m \cdot \frac{y\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m}{\frac{z}{x\_m}}\\
\end{array}\right)
\end{array}
if z < -6.79999999999999998e-308Initial program 77.3%
*-commutative77.3%
sqr-neg77.3%
times-frac89.9%
sqr-neg89.9%
Simplified89.9%
Taylor expanded in z around 0 64.2%
mul-1-neg64.2%
unsub-neg64.2%
Simplified64.2%
Taylor expanded in z around inf 41.1%
mul-1-neg41.1%
associate-*l/45.6%
*-commutative45.6%
distribute-rgt-neg-in45.6%
distribute-frac-neg245.6%
Simplified45.6%
add-sqr-sqrt27.0%
sqrt-unprod43.9%
distribute-frac-neg243.9%
distribute-frac-neg243.9%
sqr-neg43.9%
sqrt-unprod20.7%
add-sqr-sqrt25.6%
*-un-lft-identity25.6%
Applied egg-rr25.6%
*-lft-identity25.6%
Simplified25.6%
if -6.79999999999999998e-308 < z < 1.04000000000000006e-168Initial program 70.5%
*-commutative70.5%
sqr-neg70.5%
times-frac70.9%
sqr-neg70.9%
Simplified70.9%
Taylor expanded in z around 0 70.9%
mul-1-neg70.9%
unsub-neg70.9%
Simplified70.9%
Taylor expanded in z around inf 0.6%
mul-1-neg0.6%
associate-*l/0.5%
*-commutative0.5%
distribute-rgt-neg-in0.5%
distribute-frac-neg20.5%
Simplified0.5%
distribute-frac-neg20.5%
distribute-frac-neg0.5%
associate-*r/0.6%
Applied egg-rr0.6%
add-sqr-sqrt0.5%
times-frac0.5%
add-sqr-sqrt0.3%
sqrt-unprod22.9%
sqr-neg22.9%
sqrt-unprod20.5%
add-sqr-sqrt34.2%
times-frac23.1%
add-sqr-sqrt23.1%
clear-num23.1%
associate-/r*36.5%
associate-/r/38.8%
clear-num38.8%
Applied egg-rr38.8%
if 1.04000000000000006e-168 < z Initial program 83.8%
*-commutative83.8%
sqr-neg83.8%
times-frac92.1%
sqr-neg92.1%
Simplified92.1%
Taylor expanded in z around 0 60.4%
mul-1-neg60.4%
unsub-neg60.4%
Simplified60.4%
Taylor expanded in z around inf 18.4%
mul-1-neg18.4%
associate-*l/19.5%
*-commutative19.5%
distribute-rgt-neg-in19.5%
distribute-frac-neg219.5%
Simplified19.5%
add-sqr-sqrt17.4%
sqrt-unprod36.0%
distribute-frac-neg236.0%
distribute-frac-neg236.0%
sqr-neg36.0%
sqrt-unprod23.4%
add-sqr-sqrt32.7%
clear-num32.7%
un-div-inv32.7%
Applied egg-rr32.7%
Final simplification30.2%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) 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) (/ (+ z 1.0) y_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 * (((x_m / z) / ((z + 1.0) / y_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 * (((x_m / z) / ((z + 1.0d0) / y_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 * (((x_m / z) / ((z + 1.0) / y_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 * (((x_m / z) / ((z + 1.0) / y_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(Float64(x_m / z) / Float64(Float64(z + 1.0) / y_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 * (((x_m / z) / ((z + 1.0) / y_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[(N[(x$95$m / z), $MachinePrecision] / N[(N[(z + 1.0), $MachinePrecision] / y$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 \frac{\frac{\frac{x\_m}{z}}{\frac{z + 1}{y\_m}}}{z}\right)
\end{array}
Initial program 78.4%
*-commutative78.4%
associate-/l*82.6%
sqr-neg82.6%
associate-/r*84.8%
sqr-neg84.8%
Simplified84.8%
associate-*r/85.9%
*-commutative85.9%
associate-*r/86.2%
associate-/r*92.1%
associate-*l/97.1%
Applied egg-rr97.1%
clear-num97.1%
un-div-inv97.1%
Applied egg-rr97.1%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) 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 (+ 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 * (((x_m / z) * (y_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 * (((x_m / z) * (y_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 * (((x_m / z) * (y_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 * (((x_m / z) * (y_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(Float64(x_m / z) * Float64(y_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 * (((x_m / z) * (y_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[(N[(x$95$m / z), $MachinePrecision] * N[(y$95$m / N[(z + 1.0), $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 \frac{\frac{x\_m}{z} \cdot \frac{y\_m}{z + 1}}{z}\right)
\end{array}
Initial program 78.4%
*-commutative78.4%
associate-/l*82.6%
sqr-neg82.6%
associate-/r*84.8%
sqr-neg84.8%
Simplified84.8%
associate-*r/85.9%
*-commutative85.9%
associate-*r/86.2%
associate-/r*92.1%
associate-*l/97.1%
Applied egg-rr97.1%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) 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 -6.8e-308) (* (/ x_m z) y_m) (* x_m (/ y_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 <= -6.8e-308) {
tmp = (x_m / z) * y_m;
} else {
tmp = x_m * (y_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 <= (-6.8d-308)) then
tmp = (x_m / z) * y_m
else
tmp = x_m * (y_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 <= -6.8e-308) {
tmp = (x_m / z) * y_m;
} else {
tmp = x_m * (y_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 <= -6.8e-308: tmp = (x_m / z) * y_m else: tmp = x_m * (y_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 <= -6.8e-308) tmp = Float64(Float64(x_m / z) * y_m); else tmp = Float64(x_m * Float64(y_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 <= -6.8e-308)
tmp = (x_m / z) * y_m;
else
tmp = x_m * (y_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[z, -6.8e-308], N[(N[(x$95$m / z), $MachinePrecision] * y$95$m), $MachinePrecision], N[(x$95$m * N[(y$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 \begin{array}{l}
\mathbf{if}\;z \leq -6.8 \cdot 10^{-308}:\\
\;\;\;\;\frac{x\_m}{z} \cdot y\_m\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \frac{y\_m}{z}\\
\end{array}\right)
\end{array}
if z < -6.79999999999999998e-308Initial program 77.3%
*-commutative77.3%
sqr-neg77.3%
times-frac89.9%
sqr-neg89.9%
Simplified89.9%
Taylor expanded in z around 0 64.2%
mul-1-neg64.2%
unsub-neg64.2%
Simplified64.2%
Taylor expanded in z around inf 41.1%
mul-1-neg41.1%
associate-*l/45.6%
*-commutative45.6%
distribute-rgt-neg-in45.6%
distribute-frac-neg245.6%
Simplified45.6%
add-sqr-sqrt27.0%
sqrt-unprod43.9%
distribute-frac-neg243.9%
distribute-frac-neg243.9%
sqr-neg43.9%
sqrt-unprod20.7%
add-sqr-sqrt25.6%
*-un-lft-identity25.6%
Applied egg-rr25.6%
*-lft-identity25.6%
Simplified25.6%
if -6.79999999999999998e-308 < z Initial program 79.4%
*-commutative79.4%
sqr-neg79.4%
times-frac85.2%
sqr-neg85.2%
Simplified85.2%
Taylor expanded in z around 0 63.8%
mul-1-neg63.8%
unsub-neg63.8%
Simplified63.8%
Taylor expanded in z around inf 12.6%
mul-1-neg12.6%
associate-*l/13.3%
*-commutative13.3%
distribute-rgt-neg-in13.3%
distribute-frac-neg213.3%
Simplified13.3%
distribute-frac-neg213.3%
distribute-frac-neg13.3%
associate-*r/12.6%
Applied egg-rr12.6%
add-sqr-sqrt12.6%
times-frac12.6%
add-sqr-sqrt5.7%
sqrt-unprod27.8%
sqr-neg27.8%
sqrt-unprod19.3%
add-sqr-sqrt32.5%
times-frac28.8%
add-sqr-sqrt28.9%
clear-num28.9%
associate-/r*36.2%
associate-/r/36.9%
clear-num35.5%
Applied egg-rr35.5%
Final simplification30.6%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) 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 (/ 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) {
return y_s * (x_s * (y_m / (z * (z / x_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 * (y_m / (z * (z / x_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 * (y_m / (z * (z / x_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 * (y_m / (z * (z / x_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(y_m / Float64(z * Float64(z / x_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 * (y_m / (z * (z / x_m))));
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
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[(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 \frac{y\_m}{z \cdot \frac{z}{x\_m}}\right)
\end{array}
Initial program 78.4%
*-commutative78.4%
associate-/l*82.6%
sqr-neg82.6%
associate-/r*84.8%
sqr-neg84.8%
Simplified84.8%
associate-*r/85.9%
*-commutative85.9%
associate-*r/86.2%
associate-/r*92.1%
associate-*l/97.1%
Applied egg-rr97.1%
*-commutative97.1%
associate-/l*92.1%
Applied egg-rr92.1%
clear-num91.7%
un-div-inv92.6%
div-inv92.6%
clear-num92.6%
Applied egg-rr92.6%
Taylor expanded in z around 0 73.8%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) 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 (/ (/ 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) {
return y_s * (x_s * (y_m * ((x_m / z) / 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 * ((x_m / z) / 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 * ((x_m / z) / 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 * ((x_m / z) / 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(y_m * Float64(Float64(x_m / z) / 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 * ((x_m / z) / 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[(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 \left(y\_m \cdot \frac{\frac{x\_m}{z}}{z}\right)\right)
\end{array}
Initial program 78.4%
*-commutative78.4%
associate-/l*82.6%
sqr-neg82.6%
associate-/r*84.8%
sqr-neg84.8%
Simplified84.8%
associate-*r/85.9%
*-commutative85.9%
associate-*r/86.2%
associate-/r*92.1%
associate-*l/97.1%
Applied egg-rr97.1%
*-commutative97.1%
associate-/l*92.1%
Applied egg-rr92.1%
Taylor expanded in z around 0 72.2%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) 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(Float64(x_m / 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[(N[(x$95$m / z), $MachinePrecision] * y$95$m), $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{x\_m}{z} \cdot y\_m\right)\right)
\end{array}
Initial program 78.4%
*-commutative78.4%
sqr-neg78.4%
times-frac87.5%
sqr-neg87.5%
Simplified87.5%
Taylor expanded in z around 0 64.0%
mul-1-neg64.0%
unsub-neg64.0%
Simplified64.0%
Taylor expanded in z around inf 26.7%
mul-1-neg26.7%
associate-*l/29.3%
*-commutative29.3%
distribute-rgt-neg-in29.3%
distribute-frac-neg229.3%
Simplified29.3%
add-sqr-sqrt19.4%
sqrt-unprod39.3%
distribute-frac-neg239.3%
distribute-frac-neg239.3%
sqr-neg39.3%
sqrt-unprod22.0%
add-sqr-sqrt29.9%
*-un-lft-identity29.9%
Applied egg-rr29.9%
*-lft-identity29.9%
Simplified29.9%
Final simplification29.9%
(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 2024185
(FPCore (x y z)
:name "Statistics.Distribution.Beta:$cvariance from math-functions-0.1.5.2"
:precision binary64
:alt
(! :herbie-platform default (if (< z 2496182814532307/10000000000000) (/ (* y (/ x z)) (+ z (* z z))) (/ (* (/ (/ y z) (+ 1 z)) x) z)))
(/ (* x y) (* (* z z) (+ z 1.0))))