Inheritance: numeral
Beispiel #1
0
 public static bool NEGATIVEP_BIGNUM( bignum n )
 {
     return n.value < 0;
 }
Beispiel #2
0
        public static Object bgl_string_to_integer_obj(byte[] s, int r)
        {
            String str = newstring(s);
             Object res;

             try
             {
            res = BINT(Convert.ToInt32(str, r));
             }
             catch (OverflowException e)
             {
            res = new bignum(new BigInteger(str, r));
             }

             return res;
        }
Beispiel #3
0
        public static bignum MUL_BIGNUM( bignum  n1,
				       bignum  n2 )
        {
            return new bignum(n1.value * n2.value);
        }
Beispiel #4
0
        public static bignum QUOTIENT_BIGNUM( bignum  n1,
					    bignum  n2 )
        {
            return new bignum(n1.value / n2.value);
        }
Beispiel #5
0
 public static bool ZEROP_BIGNUM( bignum n )
 {
     return n.value == 0;
 }
Beispiel #6
0
        public static bignum PLUS_BIGNUM( bignum  n1,
					bignum  n2 )
        {
            return new bignum(n1.value + n2.value);
        }
Beispiel #7
0
 public static int bgl_bignum_to_long( bignum n )
 {
     return n.value.IntValue();
 }
Beispiel #8
0
        public static bool EQ_BIGNUM( bignum  n1,
				    bignum  n2 )
        {
            return (n1.value == n2.value);
        }
Beispiel #9
0
 public static bool EVENP_BIGNUM( bignum  n )
 {
     return ((n.value & 1) == 0);
 }
Beispiel #10
0
        public static bignum DIVREM_BIGNUM( bignum  n1,
					bignum  n2 )
        {
            bgldynamic env = BGL_CURRENT_DYNAMIC_ENV();

            env.mvalues_number = 2;
            env.mvalues_values[ 1 ] = REMAINDER_BIGNUM(n1, n2);

            return QUOTIENT_BIGNUM(n1, n2);
        }
Beispiel #11
0
 public static bignum ABS_BIGNUM( bignum  n )
 {
     return new bignum(n.value.abs());
 }
Beispiel #12
0
 public static int CMP_BIGNUM( bignum  n1, bignum  n2 )
 {
     return (n1.value < n2.value) ? -1 : (n1.value == n2.value) ? 0 : 1;
 }
Beispiel #13
0
 public static double BIGNUM_TO_FLONUM( bignum  n )
 {
     return n.DoubleValue();
 }
Beispiel #14
0
 public static Object bgl_write_bignum( bignum n, output_port p )
 {
     p.write( (byte)'#' );
     p.write( (byte)'z' );
     p.write( n.value.ToString() );
     return p;
 }
Beispiel #15
0
 public static bignum NEG_BIGNUM( bignum  n )
 {
     return new bignum(-n.value);
 }
Beispiel #16
0
        public static bignum GCD_BIGNUM( bignum  n1,
				       bignum  n2 )
        {
            return new bignum(n1.value.gcd(n2.value));
        }
Beispiel #17
0
 public static bool ODDP_BIGNUM( bignum  n )
 {
     return ((n.value & 1) != 0);
 }
Beispiel #18
0
        public static bool GE_BIGNUM( bignum  n1,
				    bignum  n2 )
        {
            return (n1.value >= n2.value);
        }
Beispiel #19
0
 public static bool POSITIVEP_BIGNUM( bignum n )
 {
     return n.value > 0;
 }
Beispiel #20
0
        public static bignum LCM_BIGNUM( bignum  n1,
				       bignum  n2 )
        {
            return new bignum(((n1.value / n1.value.gcd(n2.value)) * n2.value).abs());
        }
Beispiel #21
0
 public static byte[] bgl_bignum_to_string(bignum n, int r)
 {
     return getbytes(n.value.ToString(r));
 }
Beispiel #22
0
        public static bool LT_BIGNUM( bignum  n1,
				    bignum  n2 )
        {
            return (n1.value < n2.value);
        }
Beispiel #23
0
        public static bignum REMAINDER_BIGNUM( bignum  n1,
					     bignum  n2 )
        {
            return new bignum(n1.value % n2.value);
        }
Beispiel #24
0
        public static bignum MINUS_BIGNUM( bignum  n1,
					 bignum  n2 )
        {
            return new bignum(n1.value - n2.value);
        }
Beispiel #25
0
 public static Object bgl_display_bignum( bignum n, output_port p )
 {
     p.write( n.value.ToString() );
     return p;
 }
Beispiel #26
0
 public static bignum bgl_rand_bignum( bignum bx )
 {
     return bx.rand(randg);
 }