summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-05-09 03:49:18 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-05-09 03:49:18 +0000
commitab1254448d82ab7ee0c86d35f878b56b29711b4e (patch)
tree2a3b70c5a1ca52aabd86b19883fae2ae332b512e /bignum.c
parent8624d6b3f61dbe9760b28f42821fe99f0e07754b (diff)
* bignum.c: purged trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c84
1 files changed, 42 insertions, 42 deletions
diff --git a/bignum.c b/bignum.c
index 1292d167bb..067ea63e66 100644
--- a/bignum.c
+++ b/bignum.c
@@ -553,7 +553,7 @@ rb_str_to_inum(str, base, badcheck)
s = p;
}
}
- return rb_cstr_to_inum(s, base, badcheck);
+ return rb_cstr_to_inum(s, base, badcheck);
}
#if HAVE_LONG_LONG
@@ -615,7 +615,7 @@ rb_ll2inum(n)
}
#endif /* HAVE_LONG_LONG */
-
+
VALUE
rb_cstr2inum(str, base)
const char *str;
@@ -734,10 +734,10 @@ rb_big2str(VALUE x, int base)
/*
* call-seq:
* big.to_s(base=10) => string
- *
+ *
* Returns a string containing the representation of <i>big</i> radix
* <i>base</i> (2 through 36).
- *
+ *
* 12345654321.to_s #=> "12345654321"
* 12345654321.to_s(2) #=> "1011011111110110111011110000110001"
* 12345654321.to_s(8) #=> "133766736061"
@@ -781,15 +781,15 @@ big2ulong(x, type)
}
unsigned long
-rb_big2ulong_pack(x)
- VALUE x;
-{
+rb_big2ulong_pack(x)
+ VALUE x;
+{
unsigned long num = big2ulong(x, "unsigned long");
if (!RBIGNUM(x)->sign) {
return -num;
}
return num;
-}
+}
unsigned long
rb_big2ulong(x)
@@ -938,10 +938,10 @@ rb_big2dbl(x)
/*
* call-seq:
* big.to_f -> float
- *
+ *
* Converts <i>big</i> to a <code>Float</code>. If <i>big</i> doesn't
* fit in a <code>Float</code>, the result is infinity.
- *
+ *
*/
static VALUE
@@ -954,11 +954,11 @@ rb_big_to_f(x)
/*
* call-seq:
* big <=> numeric => -1, 0, +1
- *
+ *
* Comparison---Returns -1, 0, or +1 depending on whether <i>big</i> is
* less than, equal to, or greater than <i>numeric</i>. This is the
* basis for the tests in <code>Comparable</code>.
- *
+ *
*/
static VALUE
@@ -999,11 +999,11 @@ rb_big_cmp(x, y)
/*
* call-seq:
* big == obj => true or false
- *
+ *
* Returns <code>true</code> only if <i>obj</i> has the same value
* as <i>big</i>. Contrast this with <code>Bignum#eql?</code>, which
* requires <i>obj</i> to be a <code>Bignum</code>.
- *
+ *
* 68719476736 == 68719476736.0 #=> true
*/
@@ -1038,11 +1038,11 @@ rb_big_eq(x, y)
/*
* call-seq:
* big.eql?(obj) => true or false
- *
+ *
* Returns <code>true</code> only if <i>obj</i> is a
* <code>Bignum</code> with the same value as <i>big</i>. Contrast this
* with <code>Bignum#==</code>, which performs type conversions.
- *
+ *
* 68719476736.eql?(68719476736.0) #=> false
*/
@@ -1083,7 +1083,7 @@ rb_big_uminus(x)
* length, the result acts as if it had an infinite number of one
* bits to the left. In hex representations, this is displayed
* as two periods to the left of the digits.
- *
+ *
* sprintf("%X", ~0x1122334455) #=> "..FEEDDCCBBAA"
*/
@@ -1113,7 +1113,7 @@ bigsub(x, y)
BDIGIT *zds;
BDIGIT_DBL_SIGNED num;
long i = RBIGNUM(x)->len;
-
+
/* if x is larger than y, swap */
if (RBIGNUM(x)->len < RBIGNUM(y)->len) {
z = x; x = y; y = z; /* swap x y */
@@ -1134,11 +1134,11 @@ bigsub(x, y)
z = bignew(RBIGNUM(x)->len, z==0);
zds = BDIGITS(z);
- for (i = 0, num = 0; i < RBIGNUM(y)->len; i++) {
+ for (i = 0, num = 0; i < RBIGNUM(y)->len; i++) {
num += (BDIGIT_DBL_SIGNED)BDIGITS(x)[i] - BDIGITS(y)[i];
zds[i] = BIGLO(num);
num = BIGDN(num);
- }
+ }
while (num && i < RBIGNUM(x)->len) {
num += BDIGITS(x)[i];
zds[i++] = BIGLO(num);
@@ -1148,7 +1148,7 @@ bigsub(x, y)
zds[i] = BDIGITS(x)[i];
i++;
}
-
+
return z;
}
@@ -1279,7 +1279,7 @@ rb_big_mul0(x, y)
zds = BDIGITS(z);
while (j--) zds[j] = 0;
for (i = 0; i < RBIGNUM(x)->len; i++) {
- BDIGIT_DBL dd = BDIGITS(x)[i];
+ BDIGIT_DBL dd = BDIGITS(x)[i];
if (dd == 0) continue;
n = 0;
for (j = 0; j < RBIGNUM(y)->len; j++) {
@@ -1525,9 +1525,9 @@ rb_big_modulo(x, y)
/*
* call-seq:
* big.remainder(numeric) => number
- *
+ *
* Returns the remainder after dividing <i>big</i> by <i>numeric</i>.
- *
+ *
* -1234567890987654321.remainder(13731) #=> -6966
* -1234567890987654321.remainder(13731.24) #=> -9906.22531493148
*/
@@ -1579,9 +1579,9 @@ static VALUE rb_big_rshift _((VALUE,VALUE));
/*
* call-seq:
* big.divmod(numeric) => array
- *
+ *
* See <code>Numeric#divmod</code>.
- *
+ *
*/
VALUE
rb_big_divmod(x, y)
@@ -1609,13 +1609,13 @@ rb_big_divmod(x, y)
* call-seq:
* big.quo(numeric) -> float
* big.fdiv(numeric) -> float
- *
+ *
* Returns the floating point result of dividing <i>big</i> by
* <i>numeric</i>.
- *
+ *
* -1234567890987654321.quo(13731) #=> -89910996357705.5
* -1234567890987654321.quo(13731.24) #=> -89909424858035.7
- *
+ *
*/
static VALUE
@@ -2053,20 +2053,20 @@ rb_big_rshift(x, y)
/*
* call-seq:
* big[n] -> 0, 1
- *
+ *
* Bit Reference---Returns the <em>n</em>th bit in the (assumed) binary
* representation of <i>big</i>, where <i>big</i>[0] is the least
* significant bit.
- *
+ *
* a = 9**15
* 50.downto(0) do |n|
* print a[n]
* end
- *
+ *
* <em>produces:</em>
- *
+ *
* 000101110110100000111000011110010100111100010111001
- *
+ *
*/
static VALUE
@@ -2147,9 +2147,9 @@ rb_big_coerce(x, y)
/*
* call-seq:
* big.abs -> aBignum
- *
+ *
* Returns the absolute value of <i>big</i>.
- *
+ *
* -1234567890987654321.abs #=> 1234567890987654321
*/
@@ -2177,7 +2177,7 @@ rb_big_rand(max, rand_buf)
}
v = bignew(len,1);
len--;
- BDIGITS(v)[len] = BDIGITS(max)[len] * rand_buf[len];
+ BDIGITS(v)[len] = BDIGITS(max)[len] * rand_buf[len];
while (len--) {
BDIGITS(v)[len] = ((BDIGIT)~0) * rand_buf[len];
}
@@ -2188,10 +2188,10 @@ rb_big_rand(max, rand_buf)
/*
* call-seq:
* big.size -> integer
- *
+ *
* Returns the number of bytes in the machine representation of
* <i>big</i>.
- *
+ *
* (256**10 - 1).size #=> 12
* (256**20 - 1).size #=> 20
* (256**40 - 1).size #=> 40
@@ -2211,15 +2211,15 @@ rb_big_size(big)
* Fixnum. When a calculation involving
* Bignum objects returns a result that will fit in a
* Fixnum, the result is automatically converted.
- *
+ *
* For the purposes of the bitwise operations and <code>[]</code>, a
* Bignum is treated as if it were an infinite-length
* bitstring with 2's complement representation.
- *
+ *
* While Fixnum values are immediate, Bignum
* objects are not---assignment and parameter passing work with
* references to objects, not the objects themselves.
- *
+ *
*/
void