Skip to content

Commit

Permalink
fixup logic
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrik-johansson committed Jul 20, 2024
1 parent 373c6ec commit 99bd846
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 26 deletions.
21 changes: 8 additions & 13 deletions src/gr/acf.c
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,11 @@ _gr_acf_cmpabs(int * res, const acf_t x, const acf_t y, const gr_ctx_t ctx)
return _gr_arf_cmpabs(res, a, c, ctx);
if (arf_is_zero(c))
return _gr_arf_cmpabs(res, a, d, ctx);
if (arf_is_zero(a))
{
*res = -1;
return GR_SUCCESS;
}
}

if (arf_is_zero(a))
Expand All @@ -696,20 +701,10 @@ _gr_acf_cmpabs(int * res, const acf_t x, const acf_t y, const gr_ctx_t ctx)
return _gr_arf_cmpabs(res, b, d, ctx);
}

if (arf_is_zero(c))
if (arf_is_zero(c) && arf_is_zero(d))
{
if (arf_is_zero(a))
return _gr_arf_cmpabs(res, b, d, ctx);
if (arf_is_zero(b))
return _gr_arf_cmpabs(res, a, d, ctx);
}

if (arf_is_zero(d))
{
if (arf_is_zero(a))
return _gr_arf_cmpabs(res, b, c, ctx);
if (arf_is_zero(b))
return _gr_arf_cmpabs(res, a, c, ctx);
*res = 1;
return GR_SUCCESS;
}

if (ARF_IS_LAGOM(a) && ARF_IS_LAGOM(b) && ARF_IS_LAGOM(c) && ARF_IS_LAGOM(d))
Expand Down
21 changes: 8 additions & 13 deletions src/nfloat/complex.c
Original file line number Diff line number Diff line change
Expand Up @@ -1566,6 +1566,11 @@ nfloat_complex_cmpabs(int * res, nfloat_complex_srcptr x, nfloat_complex_srcptr
return nfloat_cmpabs(res, a, c, ctx);
if (NFLOAT_IS_ZERO(c))
return nfloat_cmpabs(res, a, d, ctx);
if (NFLOAT_IS_ZERO(a))
{
*res = -1;
return GR_SUCCESS;
}
}

if (NFLOAT_IS_ZERO(a))
Expand All @@ -1576,20 +1581,10 @@ nfloat_complex_cmpabs(int * res, nfloat_complex_srcptr x, nfloat_complex_srcptr
return nfloat_cmpabs(res, b, d, ctx);
}

if (NFLOAT_IS_ZERO(c))
{
if (NFLOAT_IS_ZERO(a))
return nfloat_cmpabs(res, b, d, ctx);
if (NFLOAT_IS_ZERO(b))
return nfloat_cmpabs(res, a, d, ctx);
}

if (NFLOAT_IS_ZERO(d))
if (NFLOAT_IS_ZERO(c) && NFLOAT_IS_ZERO(d))
{
if (NFLOAT_IS_ZERO(a))
return nfloat_cmpabs(res, b, c, ctx);
if (NFLOAT_IS_ZERO(b))
return nfloat_cmpabs(res, a, c, ctx);
*res = 1;
return GR_SUCCESS;
}

aexp = NFLOAT_EXP(a);
Expand Down

0 comments on commit 99bd846

Please sign in to comment.