Lines Matching refs:denominator
53 // and denominator.
58 Bignum* denominator,
61 // Multiplies numerator/denominator so that its values lies in the range 1-10.
63 // v = numerator'/denominator' * 10^(decimal_point-1)
64 // where numerator' and denominator' are the values of numerator and
65 // denominator after the call to this function.
68 Bignum* numerator, Bignum* denominator,
72 static void GenerateShortestDigits(Bignum* numerator, Bignum* denominator,
78 Bignum* numerator, Bignum* denominator,
80 // Generates 'count' digits of numerator/denominator.
85 Bignum* numerator, Bignum* denominator,
115 Bignum denominator;
119 // 4e-324. In this case the denominator needs fewer than 324*4 binary digits.
125 &numerator, &denominator,
127 // We now have v = (numerator / denominator) * 10^estimated_power.
129 &numerator, &denominator,
131 // We now have v = (numerator / denominator) * 10^(decimal_point-1), and
132 // 1 <= (numerator + delta_plus) / denominator < 10
135 GenerateShortestDigits(&numerator, &denominator,
141 &numerator, &denominator,
146 &numerator, &denominator,
163 // m- := (numerator - delta_minus) / denominator
164 // m+ := (numerator + delta_plus) / denominator
166 // Precondition: 0 <= (numerator+delta_plus) / denominator < 10.
167 // If 1 <= (numerator+delta_plus) / denominator < 10 then no leading 0 digit
169 static void GenerateShortestDigits(Bignum* numerator, Bignum* denominator,
181 digit = numerator->DivideModuloIntBignum(*denominator);
183 // digit = numerator / denominator (integer division).
184 // numerator = numerator % denominator.
201 Bignum::PlusCompare(*numerator, *delta_plus, *denominator) >= 0;
204 Bignum::PlusCompare(*numerator, *delta_plus, *denominator) > 0;
217 // Let's see if 2*numerator < denominator.
219 int compare = Bignum::PlusCompare(*numerator, *numerator, *denominator);
223 // Remaining digits are more than .5 of denominator. -> Round up.
261 // Let v = numerator / denominator < 10.
268 Bignum* numerator, Bignum* denominator,
273 digit = numerator->DivideModuloIntBignum(*denominator);
275 // digit = numerator / denominator (integer division).
276 // numerator = numerator % denominator.
283 digit = numerator->DivideModuloIntBignum(*denominator);
284 if (Bignum::PlusCompare(*numerator, *numerator, *denominator) >= 0) {
308 // Input verifies: 1 <= (numerator + delta) / denominator < 10.
310 Bignum* numerator, Bignum* denominator,
328 // Initially the fraction lies in range (1, 10]. Multiply the denominator
330 denominator->Times10();
331 if (Bignum::PlusCompare(*numerator, *numerator, *denominator) >= 0) {
347 numerator, denominator,
402 Bignum* numerator, Bignum* denominator,
406 // Since the estimated_power is positive we simply multiply the denominator
412 // denominator = 10^estimated_power.
413 denominator->AssignPowerUInt16(10, estimated_power);
416 // Introduce a common denominator so that the deltas to the boundaries are
418 denominator->ShiftLeft(1);
421 // denominator (of 2) delta_plus equals 2^e.
436 // Increase the common denominator and adapt all but the delta_minus.
437 denominator->ShiftLeft(1); // *2
448 Bignum* numerator, Bignum* denominator,
460 // denominator = 10^estimated_power * 2^-exponent (with exponent < 0)
461 denominator->AssignPowerUInt16(10, estimated_power);
462 denominator->ShiftLeft(-exponent);
465 // Introduce a common denominator so that the deltas to the boundaries are
467 denominator->ShiftLeft(1);
470 // denominator (of 2) delta_plus equals 2^e.
471 // Given that the denominator already includes v's exponent the distance
486 // Increase the denominator and adapt all but the delta_minus.
487 denominator->ShiftLeft(1); // *2
498 Bignum* numerator, Bignum* denominator,
504 // Instead of multiplying the denominator with 10^estimated_power we
527 // denominator = 2 * 2^-exponent with exponent < 0.
528 denominator->AssignUInt16(1);
529 denominator->ShiftLeft(-exponent);
532 // Introduce a common denominator so that the deltas to the boundaries are
535 denominator->ShiftLeft(1);
549 denominator->ShiftLeft(1); // *2
558 // and denominator. The functions GenerateShortestDigits and
566 // - a scaled numerator: s.t. numerator/denominator == v / 10^estimated_power.
567 // - a scaled (common) denominator.
573 // v, m+, m-, and therefore v - m- and m+ - v all share the same denominator.
576 // v / 10^ep = numerator / denominator.
578 // m- / 10^ep == v / 10^ep - delta_minus / denominator
579 // m+ / 10^ep == v / 10^ep + delta_plus / denominator
581 // m- == v - delta_minus * 10^ep / denominator;
582 // m+ == v + delta_plus * 10^ep / denominator;
586 // we then have 0.1 <= numerator/denominator < 1
587 // or 1 <= numerator/denominator < 10
596 Bignum* denominator,
602 numerator, denominator, delta_minus, delta_plus);
606 numerator, denominator, delta_minus, delta_plus);
610 numerator, denominator, delta_minus, delta_plus);
615 // This routine multiplies numerator/denominator so that its values lies in the
617 // 1 <= (numerator + delta_plus) /denominator < 10.
620 // numerator / denominator * 10^estimated_power ==
621 // numerator' / denominator' * 10^(decimal_point - 1)
624 // estimated_power) but do not touch the numerator or denominator.
628 Bignum* numerator, Bignum* denominator,
634 in_range = Bignum::PlusCompare(*numerator, *delta_plus, *denominator) >= 0;
636 in_range = Bignum::PlusCompare(*numerator, *delta_plus, *denominator) > 0;
639 // Since numerator + delta_plus >= denominator we already have
640 // 1 <= numerator/denominator < 10. Simply update the estimated_power.