Uploaded image for project: 'Spatial Information Systems'
  1. Spatial Information Systems
  2. SIS-120

AngleFormat: Missing minus sign when the degrees field is zero

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.3
    • Utilities
    • None

    Description

      When formatting a small angle with AngleFormat, if the angular value is smaller than 1° in magnitude, then the minus sign is missing. For example formatting -0.1° currently produces 0°06′ while we expect -0°06′.

      The problem appear in the following line:

      degrees += correction;
      

      The problem is that in the Java language, -0.0 + 0 == +0.0. The fix is to explicitly check for zero value.

      if (correction != 0) {
          // Really need the check for 0 value in order to preserve the sign of negative zero.
          degrees += correction;
      }
      

      Attachments

        Activity

          People

            desruisseaux Martin Desruisseaux
            desruisseaux Martin Desruisseaux
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: