bridge/class-master/depend/pari/src/kernel/none/cmp.c
/* x and y are reals. Return sign(|x| - |y|) */
x and y are reals.
x and y are reals .
int
abscmprr(GEN x, GEN y)
{
  long ex,ey,lx,ly,lz,i;
  if (!signe(x)) return signe(y)? -1: 0;
  if (!signe(y)) return 1;
  ex=expo(x); ey=expo(y);
  if (ex>ey) return  1;
  if (ex<ey) return -1;
  lx=lg(x); ly=lg(y); lz = (lx<ly)?lx:ly;
  i=2; while (i<lz && x[i]==y[i]) i++;
  if (i<lz) return ((ulong)x[i] > (ulong)y[i])? 1: -1;
  if (lx>=ly)
  {
    while (i<lx && !x[i]) i++;
    return (i==lx)? 0: 1;
  }
  while (i<ly && !y[i]) i++;
  return (i==ly)? 0: -1;
}
int abscmprr ( GEN x , GEN y ) { long ex , ey , lx , ly , lz , i ; if ( ! signe ( x ) ) return signe ( y ) ? -1 : 0 ; if ( ! signe ( y ) ) return 1 ; ex = expo ( x ) ; ey = expo ( y ) ; if ( ex > ey ) return 1 ; if ( ex < ey ) return -1 ; lx = lg ( x ) ; ly = lg ( y ) ; lz = ( lx < ly ) ? lx : ly ; i = 2 ; while ( i < lz && x [ i ] == y [ i ] ) i ++ ; if ( i < lz ) return ( ( ulong ) x [ i ] > ( ulong ) y [ i ] ) ? 1 : -1 ; if ( lx >= ly ) { while ( i < lx && ! x [ i ] ) i ++ ; return ( i == lx ) ? 0 : 1 ; } while ( i < ly && ! y [ i ] ) i ++ ; return ( i == ly ) ? 0 : -1 ; }
x and y are reals.
x and y are reals .