Uploaded image for project: 'Commons Numbers'
  1. Commons Numbers
  2. NUMBERS-119

BigFraction(double) constructor does not treat subnormal numbers correctly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.0
    • 1.0-beta1
    • fraction
    • None

    Description

      The constructor BigFraction(double) does not take into account the fact that, when the biased exponent of a double value is 0 and the mantissa is not 0 (i.e. when the value represents a subnormal number), the actual exponent in effect is not -1023 but -1022 (or, in other words, the effective exponent bias is not 1023 but 1022).

      The value of the created BigFraction is therefore not equal to the value of the passed double argument.

      Also, since the constructor does not handle the case of zero separately, it creates a fraction with a numerator of 0 and a denominator of 21075, which is not very memory-efficient.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Schamschi Heinrich Bohne
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 20m
                  1h 20m