You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by "Martin Desruisseaux (JIRA)" <ji...@apache.org> on 2013/08/13 15:33:47 UTC

[jira] [Created] (SIS-120) AngleFormat: Missing minus sign when the degrees field is zero

Martin Desruisseaux created SIS-120:
---------------------------------------

             Summary: AngleFormat: Missing minus sign when the degrees field is zero
                 Key: SIS-120
                 URL: https://issues.apache.org/jira/browse/SIS-120
             Project: Spatial Information Systems
          Issue Type: Bug
          Components: Utilities
    Affects Versions: 0.3
            Reporter: Martin Desruisseaux
             Fix For: 0.4


When formatting a small angle with {{AngleFormat}}, if the angular value is smaller than 1°, 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:

{code:java}
degrees += correction;
{code}

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

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


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira