Home | History | Annotate | Download | only in bigint

Lines Matching refs:sign

13 	// Copy sign
14 sign = x.sign;
19 BigInteger::BigInteger(const Blk *b, Index blen, Sign s) : mag(b, blen) {
24 sign = zero;
28 // If the magnitude is zero, force the sign to zero.
29 sign = mag.isZero() ? zero : s;
33 * that the sign is a valid member of the enumeration. Oh well. */
38 BigInteger::BigInteger(const BigUnsigned &x, Sign s) : mag(x) {
43 sign = zero;
47 // If the magnitude is zero, force the sign to zero.
48 sign = mag.isZero() ? zero : s;
52 * that the sign is a valid member of the enumeration. Oh well. */
62 BigInteger::BigInteger(unsigned long x) : mag(x) { sign = mag.isZero() ? zero : positive; }
63 BigInteger::BigInteger(unsigned int x) : mag(x) { sign = mag.isZero() ? zero : positive; }
64 BigInteger::BigInteger(unsigned short x) : mag(x) { sign = mag.isZero() ? zero : positive; }
66 // For signed input, determine the desired magnitude and sign separately.
72 * itself, from sign-extending in the conversion to Blk. */
76 BigInteger::Sign signOf(X x) {
83 BigInteger::BigInteger(long x) : sign(signOf(x)), mag(magOf<long , unsigned long >(x)) {}
84 BigInteger::BigInteger(int x) : sign(signOf(x)), mag(magOf<int , unsigned int >(x)) {}
85 BigInteger::BigInteger(short x) : sign(signOf(x)), mag(magOf<short, unsigned short>(x)) {}
100 if (sign == negative)
110 if (sign == zero)
115 if (sign == positive) {
140 // A greater sign implies a greater number
141 if (sign < x.sign)
143 else if (sign > x.sign)
145 else switch (sign) {
161 * These do some messing around to determine the sign of the result,
176 if (a.sign == zero)
178 else if (b.sign == zero)
180 // If the arguments have the same sign, take the
181 // common sign and add their magnitudes.
182 else if (a.sign == b.sign) {
183 sign = a.sign;
191 sign = zero;
193 // Otherwise, take the sign of the greater, and subtract
196 sign = a.sign;
200 sign = b.sign;
209 // if one replaces b.sign by its opposite.
211 // If a is zero, copy b and flip its sign. If b is zero, copy a.
212 if (a.sign == zero) {
214 // Take the negative of _b_'s, sign, not ours.
216 sign = Sign(-b.sign);
217 } else if (b.sign == zero)
219 // If their signs differ, take a.sign and add the magnitudes.
220 else if (a.sign != b.sign) {
221 sign = a.sign;
229 sign = zero;
231 // If a's magnitude is greater, take a.sign and
234 sign = a.sign;
238 // of b.sign and subtract b from a.
240 sign = Sign(-b.sign);
250 if (a.sign == zero || b.sign == zero) {
251 sign = zero;
257 sign = (a.sign == b.sign) ? positive : negative;
296 if (b.sign == zero) {
298 q.sign = zero;
302 if (sign == zero) {
304 q.sign = zero;
310 // Do the operands have the same sign?
311 if (sign == b.sign) {
313 q.sign = positive;
316 q.sign = negative;
337 * Find r = (b - 1) - R and give it the desired sign.
344 if (sign != b.sign) {
353 // Sign of the remainder is always the sign of the divisor b.
354 sign = b.sign;
358 sign = zero;
360 q.sign = zero;
370 // Copy the opposite of a.sign
371 sign = Sign(-a.sign);
378 if (sign == negative) {
381 sign = zero;
384 sign = positive; // if not already
395 if (sign == positive) {
398 sign = zero;
401 sign = negative;