Ticket #5855: rational_fix.patch

File rational_fix.patch, 879 bytes (added by mlang@…, 11 years ago)

Proposed fix.

  • boost/rational.hpp

     
    389389
    390390    // Determine relative order by expanding each value to its simple continued
    391391    // fraction representation using the Euclidian GCD algorithm.
    392     struct { int_type  n, d, q, r; }  ts = { this->num, this->den, this->num /
    393      this->den, this->num % this->den }, rs = { r.num, r.den, r.num / r.den,
    394      r.num % r.den };
     392    struct { int_type  n, d, q, r; }
     393    ts = { this->num, this->den,
     394           int_type(this->num / this->den), int_type(this->num % this->den) },
     395    rs = { r.num, r.den,
     396           int_type(r.num / r.den), int_type(r.num % r.den) };
    395397    unsigned  reverse = 0u;
    396398
    397399    // Normalize negative moduli by repeatedly adding the (positive) denominator